
Tenho essa longtable e a legenda não está aparecendo na primeira parte da tabela
\begin{longtable}{c|c|c|c}
\caption{Tipo N} \label{tab:Uh_B Ip y t ctes} \\
$U_h$ & $\Delta U_h$ & $B [T]$ & $\Delta B [T]$ \\ \hline\hline
\endfirsthead
\multicolumn{1}{c|}{$U_h$} & \multicolumn{1}{c|}{$\Delta U_h$} & \multicolumn{1}{c|}{$B [T]$ } & \multicolumn{1}{c}{$\Delta B [T]$} \\ \hline
\endfirsthead
\multicolumn{4}{c}%
{{\bfseries \tablename\ \thetable{} -- Continuación}} \\
\multicolumn{1}{c|}{$U_h$} & \multicolumn{1}{c|}{$\Delta U_h$} & \multicolumn{1}{c|}{$B [T]$ } & \multicolumn{1}{c}{$\Delta B [T]$} \\ \hline
\endhead
\hline \multicolumn{4}{|r|}{{Continua en la siguiente página}} \\ \hline
\endfoot
\hline \hline
\endlastfoot
0,054 & 0,001 & -0,300 & 0,001 \\ \hline
0,05 & 0,001 & -0,280 & 0,001 \\ \hline
0,046 & 0,001 & -0,260 & 0,001 \\ \hline
0,041 & 0,001 & -0,240 & 0,001 \\ \hline
0,037 & 0,001 & -0,220 & 0,001 \\ \hline
0,032 & 0,001 & -0,200 & 0,001 \\ \hline
0,028 & 0,001 & -0,180 & 0,001 \\ \hline
0,023 & 0,001 & -0,160 & 0,001 \\ \hline
0,019 & 0,001 & -0,140 & 0,001 \\ \hline
0,014 & 0,001 & -0,120 & 0,001 \\ \hline
0,010 & 0,001 & -0,100 & 0,001 \\ \hline
0,005 & 0,001 & -0,080 & 0,001 \\ \hline
0,001 & 0,001 & -0,060 & 0,001 \\ \hline
-0,002 & 0,001 & -0,040 & 0,001 \\ \hline
-0,007 & 0,001 & -0,020 & 0,001 \\ \hline
-0,011 & 0,001 & 0,000 & 0,001 \\ \hline
-0,016 & 0,001 & 0,020 & 0,001 \\ \hline
-0,021 & 0,001 & 0,040 & 0,001 \\ \hline
-0,026 & 0,001 & 0,060 & 0,001 \\ \hline
-0,030 & 0,001 & 0,080 & 0,001 \\ \hline
-0,034 & 0,001 & 0,100 & 0,001 \\ \hline
-0,039 & 0,001 & 0,120 & 0,001 \\ \hline
-0,043 & 0,001 & 0,140 & 0,001 \\ \hline
-0,048 & 0,001 & 0,160 & 0,001 \\ \hline
-0,052 & 0,001 & 0,180 & 0,001 \\ \hline
-0,057 & 0,001 & 0,200 & 0,001 \\ \hline
-0,061 & 0,001 & 0,220 & 0,001 \\ \hline
-0,065 & 0,001 & 0,240 & 0,001 \\ \hline
-0,070 & 0,001 & 0,260 & 0,001 \\ \hline
-0,074 & 0,001 & 0,280 & 0,001 \\ \hline
-0,079 & 0,001 & 0,300 & 0,001 \\ \hline
\end{longtable}
Isso fornece a próxima saída:
Obrigado por ler
Responder1
- Infelizmente você não fornece um pequeno documento completo com sua tabela, portanto o preâmbulo necessário/usado é desconhecido.
- Se eu inserir seu fragmento de código em um
article
documento padrão, posso reproduzir seu problema. - No entanto, se eu redigitar seu "preâmbulo" da tabela longa com as configurações da tabela, obtive o resultado esperado (após a terceira compilação, conforme exigido na tabela longa).
\documentclass{article}
\usepackage{longtable}
\begin{document}
\begin{longtable}{c c c c}
\caption{Tipo N}
\label{T2.4} \\
$U_h$ & $\Delta U_h$ & $B [T]$ & $\Delta B [T]$ \\
\hline
\endfirsthead
\caption[]{Tipo N -- (cont.)} \\
$U_h$ & $\Delta U_h$ & $B [T]$ & $\Delta B [T]$ \\
\hline
\endhead
\multicolumn{4}{r}{\footnotesize\textit{continued on the next page}}
\endfoot
\hline\hline
\endlastfoot
0,054 & 0,001 & -0,300 & 0,001 \\ \hline
0,05 & 0,001 & -0,280 & 0,001 \\ \hline
0,046 & 0,001 & -0,260 & 0,001 \\ \hline
0,041 & 0,001 & -0,240 & 0,001 \\ \hline
0,037 & 0,001 & -0,220 & 0,001 \\ \hline
0,032 & 0,001 & -0,200 & 0,001 \\ \hline
0,028 & 0,001 & -0,180 & 0,001 \\ \hline
0,023 & 0,001 & -0,160 & 0,001 \\ \hline
0,019 & 0,001 & -0,140 & 0,001 \\ \hline
0,014 & 0,001 & -0,120 & 0,001 \\ \hline
0,010 & 0,001 & -0,100 & 0,001 \\ \hline
0,005 & 0,001 & -0,080 & 0,001 \\ \hline
0,001 & 0,001 & -0,060 & 0,001 \\ \hline
-0,002 & 0,001 & -0,040 & 0,001 \\ \hline
-0,007 & 0,001 & -0,020 & 0,001 \\ \hline
-0,011 & 0,001 & 0,000 & 0,001 \\ \hline
-0,016 & 0,001 & 0,020 & 0,001 \\ \hline
-0,021 & 0,001 & 0,040 & 0,001 \\ \hline
-0,026 & 0,001 & 0,060 & 0,001 \\ \hline
-0,030 & 0,001 & 0,080 & 0,001 \\ \hline
-0,034 & 0,001 & 0,100 & 0,001 \\ \hline
-0,039 & 0,001 & 0,120 & 0,001 \\ \hline
-0,043 & 0,001 & 0,140 & 0,001 \\ \hline
-0,048 & 0,001 & 0,160 & 0,001 \\ \hline
-0,052 & 0,001 & 0,180 & 0,001 \\ \hline
-0,057 & 0,001 & 0,200 & 0,001 \\ \hline
-0,061 & 0,001 & 0,220 & 0,001 \\ \hline
-0,065 & 0,001 & 0,240 & 0,001 \\ \hline
-0,070 & 0,001 & 0,260 & 0,001 \\ \hline
-0,074 & 0,001 & 0,280 & 0,001 \\ \hline
-0,079 & 0,001 & 0,300 & 0,001 \\ \hline
\end{longtable}
\end{document}
Eu consideraria os comentários do @daleif e além deste tabularray
pacote de uso para sua mesa. Com eles a tabela fica mais bonita e seu código é mais simples:
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{longtblr}[
caption = {Tipo N},
label = {T2.4} ]{hline{2-Z}, vline{2-Y},
colspec = {Q[c, si={table-format=-1.3}]
Q[c, si={table-format= 1.3}]
Q[c, si={table-format=-1.3}]
Q[c, si={table-format= 1.3}]},
row{1} = {guard, mode=math},
rowhead=1}
U_h & \Delta U_h & B [T] & \Delta B [T] \\
% table body as before, but without all \hline-s
\end{longtblr}
\end{document}
Não está claro por que você deixou de fora as linhas superior, esquerda e direita da tabela. Eu sugeriria remover todas as linhas verticais e horizontais, exceto as necessárias, nos cabeçalhos das colunas e na parte inferior da tabela. Para essas linhas eu usaria regras de booktabs
pacote (carregadas pela tblr
biblioteca):
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\begin{longtblr}[
caption = {Tipo N},
label = {T2.4} ]{colspec = {Q[c, si={table-format=-1.3}]
Q[c, si={table-format= 1.3}]
Q[c, si={table-format=-1.3}]
Q[c, si={table-format= 1.3}]},
row{1} = {guard, mode=math},
row{2-Z} = {rowsep = 0pt},
row{even[3]} = {abovesep=1ex},
rowhead=1}
\toprule
U_h & \Delta U_h & B [T] & \Delta B [T] \\
\midrule
% table body is the same as before, but without all \hline-s
\bottomrule
\end{longtblr}
\end{document}
Responder2
Como @Zarko faz em seuresponder, sugiro que você utilize o siunitx
pacote - e seu S
tipo de coluna em particular - para alinhar os números em seus respectivos marcadores decimais.
Eu ainda me livraria de todas as regras verticais e usaria menos regras horizontais, mas bem espaçadas. Para fornecer algum "ritmo visual" no corpo da tabela longa, eu adicionaria um pouco mais de espaço em branco vertical após cada quinta linha ou mais.
E, claro, livre-se do segundo \endfirsthead
bloco.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[spanish,es-tabla]{babel}
\usepackage{longtable}
\usepackage{booktabs} % for well-spaced horizontal rules
\usepackage[output-decimal-marker={,}]{siunitx}
\begin{document}
\begin{longtable}{@{} *{4}{S[table-format=-1.3]} @{}}
%% headers and footers
\caption{Tipo N} \label{tab:Uh_B Ip y t ctes} \\
{$U_h$} & {$\Delta U_h$} & {$B[T]$} & {$\Delta B[T]$} \\
\midrule
\endfirsthead
\multicolumn{4}{c}{\tablename\ \thetable\ -- Continuación} \\[1ex]
{$U_h$} & {$\Delta U_h$} & {$B[T]$} & {$\Delta B[T]$} \\
\midrule
\endhead
\midrule
\multicolumn{4}{r@{}}{\footnotesize Continua en la siguiente página} \\
\endfoot
\bottomrule
\endlastfoot
%% body of table
0,054 & 0,001 & -0,300 & 0,001 \\
0,05 & 0,001 & -0,280 & 0,001 \\
0,046 & 0,001 & -0,260 & 0,001 \\
0,041 & 0,001 & -0,240 & 0,001 \\
0,037 & 0,001 & -0,220 & 0,001 \\
\addlinespace
0,032 & 0,001 & -0,200 & 0,001 \\
0,028 & 0,001 & -0,180 & 0,001 \\
0,023 & 0,001 & -0,160 & 0,001 \\
0,019 & 0,001 & -0,140 & 0,001 \\
0,014 & 0,001 & -0,120 & 0,001 \\
\addlinespace
0,010 & 0,001 & -0,100 & 0,001 \\
0,005 & 0,001 & -0,080 & 0,001 \\
0,001 & 0,001 & -0,060 & 0,001 \\
-0,002 & 0,001 & -0,040 & 0,001 \\
-0,007 & 0,001 & -0,020 & 0,001 \\
\addlinespace
-0,011 & 0,001 & 0,000 & 0,001 \\
-0,016 & 0,001 & 0,020 & 0,001 \\
-0,021 & 0,001 & 0,040 & 0,001 \\
-0,026 & 0,001 & 0,060 & 0,001 \\
-0,030 & 0,001 & 0,080 & 0,001 \\
\addlinespace
-0,034 & 0,001 & 0,100 & 0,001 \\
-0,039 & 0,001 & 0,120 & 0,001 \\
-0,043 & 0,001 & 0,140 & 0,001 \\
-0,048 & 0,001 & 0,160 & 0,001 \\
-0,052 & 0,001 & 0,180 & 0,001 \\
\addlinespace
-0,057 & 0,001 & 0,200 & 0,001 \\
-0,061 & 0,001 & 0,220 & 0,001 \\
-0,065 & 0,001 & 0,240 & 0,001 \\
-0,070 & 0,001 & 0,260 & 0,001 \\
-0,074 & 0,001 & 0,280 & 0,001 \\
\addlinespace
-0,079 & 0,001 & 0,300 & 0,001 \\
\end{longtable}
\end{document}