Guten Abend!
Ich verwende in meinem LaTeX-Dokument einige Longtables und hätte da gerne die Überschriften der einzelnen Spalten auf jeder der Seiten, auf der die Tabelle ist.
Wie bekomme ich das am elegantesten und einfachsten hin?
Grüße aus Wien
TH
Longtable Überschriften auf allen Seiten
Man braucht \endfirsthead nur, wenn der Kopf auf der ersten Seite anders sein soll als auf anderen Seiten. Im Beispiel kann man sich das zusätzliche Makro also sparen und einfach schreiben.
Die Sache mit den unterschiedlichen Köpfen wird so richtig interessant, wenn man mit \caption arbeitet: Dabei bewirkt das leere optionale Argument von \caption innerhalb einer longtable, dass diese (Wiederholungs-)Überschrift nicht im Verzeichnis landet. Alles weitere zu \endhead, \endfirsthead, \endfoot, \endlastfoot und \caption innerhalb von longtable ist der longtable-Anleitung zu entnehmen. Alles weitere zu \toprule, \midrule und \bottomrule ist der Anleitung zu booktabs (← dies ist ein geprüfter Link, der direkt zur Paketkurzbeschreibung auf CTAN führt!) zu entnehmen.
\documentclass[a4paper]{article} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage[ngerman]{babel} \usepackage{longtable,array} \begin{document} \begin{longtable}{p{3cm}p{3cm}p{3cm}} \textbf{Spalte1}&\textbf{Spalte2}&\textbf{Spalte3}\\\endhead bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\ \end{longtable} \end{document}
Die Sache mit den unterschiedlichen Köpfen wird so richtig interessant, wenn man mit \caption arbeitet:
\documentclass[a4paper]{article} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage[ngerman]{babel} \usepackage{longtable} \usepackage{booktabs} \newcommand{\spaltenueberschrift}{\textbf{Spalte1}&\textbf{Spalte2}&\textbf{Spalte3}\\} \begin{document} \listoftables \begin{longtable}{p{3cm}p{3cm}p{3cm}} \caption{Eine Beispieltabelle}\\ \toprule \textbf{Spalte1}&\textbf{Spalte2}&\textbf{Spalte3}\\ \midrule \endfirsthead \caption[]{Eine Beispieltabelle \emph{(Fortsetzung)}}\\ \toprule \textbf{Spalte1}&\textbf{Spalte2}&\textbf{Spalte3}\\ \midrule \endhead \midrule\nopagebreak \multicolumn3r\dots \endfoot \bottomrule \endlastfoot bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ bsvsfsdsc&vsfsvsdss&vsfsdss \\bsvsfsdsc&vsfsvsdss&vsfsdss \\ \end{longtable} \end{document}
goLaTeX-Knigge (mit Minimalbeispiel und »So stellst Du Deine Frage richtig«)
Wie kann ich Code in meinem Beitrag hervorheben?
Wie hänge ich ein Bild an meine Frage?
KOMA-Script
Wie kann ich Code in meinem Beitrag hervorheben?
Wie hänge ich ein Bild an meine Frage?
KOMA-Script