Longtable-Beschriftung

Longtable-Beschriftung

Ich habe diese lange Tabelle und die Überschrift erscheint nicht im ersten Teil der Tabelle

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

Dies führt zur nächsten Ausgabe:

Bildbeschreibung hier eingeben

Danke fürs Lesen

Antwort1

  • Leider liefern Sie mit Ihrer Tabelle kein vollständiges kleines Dokument mit, daher ist die benötigte/verwendete Präambel unbekannt.
  • Wenn ich Ihr Codefragment in ein Standarddokument einfüge article, kann ich Ihr Problem reproduzieren.
  • Wenn ich jedoch Ihre Longtable-„Präambel“ mit Tabelleneinstellungen erneut eingebe, erhalte ich das erwartete Ergebnis (nach der dritten Kompilierung, wie es bei Long Tables erforderlich ist).

Bildbeschreibung hier eingeben

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

Ich würde @daleif-Kommentare in Betracht ziehen und außerdem tabularray Pakete für Ihre Tabelle verwenden. Mit ihnen ist die Tabelle schöner und ihr Code einfacher:

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

Bildbeschreibung hier eingeben

Es ist unklar, warum Sie die oberen, linken und rechten Tabellenzeilen weggelassen haben. Ich würde vorschlagen, alle vertikalen und horizontalen Zeilen zu entfernen, außer wenn sie um die Spaltenüberschriften und den unteren Tabellenrand herum notwendig sind. Für diese Zeilen würde ich Paketregeln verwenden booktabs(von der Bibliothek geladen 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}

Bildbeschreibung hier eingeben

Antwort2

Wie @Zarko in seinemAntwortsiunitx, ich schlage vor, dass Sie das Paket – und insbesondere seinen Spaltentyp – verwenden, Sum die Zahlen an ihren jeweiligen Dezimaltrennzeichen auszurichten.

Ich würde außerdem alle vertikalen Linien entfernen und weniger, dafür aber gut verteilte horizontale Linien verwenden. Um dem Hauptteil der langen Tabelle etwas „visuellen Rhythmus“ zu verleihen, würde ich etwa nach jeder fünften Zeile etwas mehr vertikalen Leerraum hinzufügen.

Und natürlich müssen Sie den zweiten \endfirstheadBlock beseitigen.

Bildbeschreibung hier eingeben

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

verwandte Informationen