長表標題

長表標題

我有這個長表,標題沒有出現在表的第一部分

\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}

這提供了下一個輸出:

在此輸入影像描述

謝謝閱讀

答案1

  • 不幸的是,您沒有隨表格提供完整的小文檔,因此所需/使用的序言未知。
  • 如果我將您的程式碼片段插入標準article文件中,我可以重現您的問題。
  • 但是,如果我使用表格設定重新輸入您的長表“前導碼”,我會得到預期的結果(在第三次編譯之後,正如長表所要求的那樣)。

在此輸入影像描述

\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}

我會考慮@daleif 評論,並在tabularray 您的桌子上使用此包。有了它們,表格就更好了,程式碼也更簡單了:

\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}

在此輸入影像描述

目前還不清楚為什麼你遺漏了頂部、左側和右側的表格線。我建議刪除所有垂直和水平線,除非列標題和表格底部周圍有必要。對於這些行,我將使用套件規則booktabs(由庫載入tblr):

\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}

在此輸入影像描述

答案2

就像@Zarko 在他的作品中所做的那樣回答,我建議您使用該siunitx套件(S特別是其列類型)來對齊各自小數點標記上的數字。

我會進一步擺脫所有垂直規則,並使用更少但間隔良好的水平規則。為了在長表的主體中提供一些“視覺節奏”,我會在每隔五行左右添加一點垂直空白。

當然,一定要去掉第二個\endfirsthead區塊。

在此輸入影像描述

\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}

相關內容