Subseções invisíveis perdem o número da página no sumário

Subseções invisíveis perdem o número da página no sumário

As subseções invisíveis perdem o número da página no sumário, mais precisamente, todas apontam para a mesma página, que é a página onde a macro foi aplicada pela primeira vez.

Minha necessidade é semelhante ao que foi solicitado em tornar os títulos das seções invisíveis?

Por isso experimentei a seguinte macro, que tirei de uma das respostas ali dadas e adaptei.

\makeatletter
\newcommand\invisiblesubsection[1]{%
    \refstepcounter{subsection}%
    \addcontentsline{toc}{subsection}{\protect\numberline{\thesubsection}#1}%
    \subsectionmark{#1}\phantom{}}%
\makeatother

Todo o resto funciona, exceto a numeração das páginas no sumário. O que posso fazer?

Editar:A seu pedido, escrevi o exemplo abaixo. No entanto, o comportamento aqui mudou: Os números das linhas agora são exibidos corretamente, mas uma página em branco é inserida após cada tabela.

\documentclass[10pt,a4paper,oneside]{article}
\makeatletter
\newcommand\invisiblesubsection[1]{%
\refstepcounter{subsection}%
\addcontentsline{toc}{subsection} 
{\protect\numberline{\thesubsection}#1}%
\subsectionmark{#1}\phantom{}}%
\makeatother
\newcommand\tex{\textbf{(0)} \begin{tabular}[c]{c|rrrrrr}
$0$ & $0$ & & & & & \\ $0$ & $0$ & $0$ & & & & \\ $0$ & $0$ & $0$ & 
$0$ & & & \\ $0$ & $0$ & $0$ & $0$ & $0$ & & \\ $0$ & $0$ & $0$ & 
$0$ & $0$ & $0$ & \\ $0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ 
\end{tabular} \vspace{5mm} \newline }
\begin{document}
\section{One}
\invisiblesubsection{1} 
\begin{table}[b] \tex \tex \tex \tex \tex \caption{1} \end{table}
\clearpage \invisiblesubsection{2} 
\begin{table}[b] \tex \tex \tex \tex \tex \caption{2} \end{table}
\clearpage \invisiblesubsection{3} 
\begin{table}[b] \tex \tex \tex \tex \tex \caption{3} \end{table}
\clearpage \invisiblesubsection{4} 
\begin{table}[b] \tex \tex \tex \tex \tex \caption{4} \end{table}
\clearpage \invisiblesubsection{5} 
\begin{table}[b] \tex \tex \tex \tex \tex \caption{5} \end{table}
\clearpage \newpage \tableofcontents\label{toc}
\end{document}

Responder1

Este código resolve o problema usando b!como especificador de localização flutuante para as tabelas.

Quando the !é usado como um modificador para o especificador de localização, ele substituirá quaisquer restrições das regras de localização padrão para carros flutuantes. Com b!o LaTeX, tentaremos colocar o float na parte inferior da página.

O \clearpagecomando força o LaTeX a encerrar a página atual e iniciar uma nova. Se houver carros alegóricos aguardando para serem colocados, eles serão colocados na nova página de acordo com as regras de posicionamento padrão. No entanto, se você usou o "!" modificador, quaisquer carros alegóricos que estejam aguardando para serem colocados serão colocados na parte inferior da página flutuante.

VerComo influenciar a posição dos carros alegóricos

b

\documentclass[10pt,a4paper,oneside]{article}
\makeatletter
\newcommand\invisiblesubsection[1]{%
    \refstepcounter{subsection}%
    \addcontentsline{toc}{subsection} 
    {\protect\numberline{\thesubsection}#1}%
    \subsectionmark{#1}\phantom{}}%
\makeatother
\newcommand\tex{\textbf{(0)} \begin{tabular}[c]{c|rrrrrr}
        $0$ & $0$ & & & & & \\ $0$ & $0$ & $0$ & & & & \\ $0$ & $0$ & $0$ & 
        $0$ & & & \\ $0$ & $0$ & $0$ & $0$ & $0$ & & \\ $0$ & $0$ & $0$ & 
        $0$ & $0$ & $0$ & \\ $0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ 
    \end{tabular} \vspace{5mm} \newline }
\begin{document}
    \section{One}       
    \invisiblesubsection{1} 
    \begin{table}[b!] \tex \tex \tex \tex \tex \caption{1} \end{table}
    \clearpage \invisiblesubsection{2} 
    \begin{table}[b!] \tex \tex \tex \tex \tex \caption{2} \end{table}
    \clearpage \invisiblesubsection{3} 
    \begin{table}[b!] \tex \tex \tex \tex \tex \caption{3} \end{table}
    \clearpage \invisiblesubsection{4} 
    \begin{table}[b!] \tex \tex \tex \tex \tex \caption{4} \end{table}
    \clearpage \invisiblesubsection{5} 
    \begin{table}[b!] \tex \tex \tex \tex \tex \caption{5} \end{table}
    \clearpage \newpage \tableofcontents\label{toc}
\end{document}

informação relacionada