longtable zentriert mit Seitenumbruch und farbigen Zeilen

Tabellen und Grafiken erstellen und anordnen


blablubb1234
Forum-Newbie
Forum-Newbie
Beiträge: 3
Registriert: So 18. Mai 2014, 20:51

longtable zentriert mit Seitenumbruch und farbigen Zeilen

Beitrag von blablubb1234 »

Hallo Leute,

ich gehe wirklich auf dem Zahnfleisch gerade, weil ich einen Bericht zu Ende kriegen muss und mit einer Tabelle, die über mehrere Seiten gehen soll, einfach nicht zu Rande komme. Sie ist ebenfalls sehr breit, daher kann ich sie nicht einfach drehen oder dergleichen.

Ich benötige \usepackage[table]{xcolor}, um einzelne Zellen in der Tabelle farbig zu markieren.

Über \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} habe ich (von einer anderen Seite übernommen) eine feste Spaltenbreite eingestellt, damit die sehr breite Tabelle auf eine Seite passt.

Kompilieren tut das untenstehende Minimalbeispiel ohne Fehlermeldung, aber die Tabelle bricht am Seitenende einfach nicht um. Wie kriege ich das hin? Ich bitte Euch inständig mir zu helfen, diese elende Tabelle automatisch umzubrechen und auf der nächsten Seite fortzusetzen. Die Dokumentation von longtable hilft mir dabei irgendwie auch nicht wirklich weiter.

Ich weiß, es gibt hier zig Beispiele zu Seitenumbrüchen in Tabellen, aber damit habe ich es nict hinbekommen. Davor hatte ich anstatt

\begin{longtabu} noch \begin{tabular} im Einsatz, aber damit funktionierte auch kein Seitenumbruch.

Vielen Dank für Eure Hilfe.
\documentclass[12pt,a4paper,twoside,titlepage]{scrreprt}
\usepackage[table]{xcolor}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{timetable}
\usepackage{siunitx}
% Centered tables
\usepackage{longtable}
\usepackage{tabularx}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}
\usepackage{tabu}
% Left-aligned captions for tables.
\usepackage[bf,small,singlelinecheck=off]{caption}
\usepackage{eso-pic}
\usepackage{everyshi}
\usepackage{ifthen}
\usepackage{calc}
%Zum Einbinden von pdf-Dokumenten (Präsentation in diesem Fall)
\usepackage{pdfpages} 
%Für mehrere Bilder nebeneinander
\usepackage{subfig}

\begin{document}
\begin{table}
	\caption{Messergebnisse DoEM2x}
	\begin{longtabu}{|C{1cm}|C{1cm}|C{1cm}|C{1cm}|C{1cm}|C{1cm}|C{1cm}|C{1cm}|C{1cm}|C{1cm}|C{1cm}|}
	\hline
	Bond-kraft [F] / \si{\centi\newton} & Ultra-schall-dauer [tt] / \si{\milli\second} & Ultra-schall-energie [P] / \si{\percent} & Pull-tester & Burst & Start-kraft [F] / \si{\centi\newton} & Touch-down-kraft [F] / \si{\centi\newton} & Ramp-zeit [tt] / \si{\milli\second} & Oxida-tions-level & Scher-kraft Mittelwert [F] / \si{\gram} & Stand-ardab-weich-ung\\
	\hline\hline
	800 & 50 & 50 & An & An & 400 & 800 & 40 & Low & 1282.6 & 70.7\\
	\hline
	\cellcolor{green}800 & \cellcolor{green}600 & \cellcolor{green}50 & \cellcolor{green}Aus & \cellcolor{green}Aus & \cellcolor{green}400 & \cellcolor{green}100 & \cellcolor{green}50 & \cellcolor{green}Low & \cellcolor{green}1927.1 & \cellcolor{green}88.4\\
	\hline
	1800 & 50 & 50 & An & Aus & 800 & 100 & 40 & Low & 1531.2 & 229.1\\
	\hline
	\cellcolor{yellow}1800 & \cellcolor{yellow}50 & \cellcolor{yellow}50 & \cellcolor{yellow}Aus & \cellcolor{yellow}An & \cellcolor{yellow}800 & \cellcolor{yellow}800 & \cellcolor{yellow}20 & \cellcolor{yellow}Low & \cellcolor{yellow}1873.2 & \cellcolor{yellow}141.8\\
	\hline
	\cellcolor{yellow}1800 & \cellcolor{yellow}600 & \cellcolor{yellow}50 & \cellcolor{yellow}Aus & \cellcolor{yellow}An & \cellcolor{yellow}800 & \cellcolor{yellow}100 & \cellcolor{yellow}80 & \cellcolor{yellow}Low & \cellcolor{yellow}1856.1 & \cellcolor{yellow}134.1\\
	\hline
	\cellcolor{yellow}1800 & \cellcolor{yellow}600 & \cellcolor{yellow}50 & \cellcolor{yellow}An & \cellcolor{yellow}Aus & \cellcolor{yellow}400 & \cellcolor{yellow}800 & \cellcolor{yellow}20 & \cellcolor{yellow}Low & \cellcolor{yellow}1856.4 & \cellcolor{yellow}195.1\\
	\hline
	800 & 325 & 130 & An & Aus & 400 & 100 & 80 & Low & 877.1 & 257.4\\
	\hline
	800 & 50 & 130 & Aus & An & 800 & 100 & 40 & Low & 1184.2 & 151.3\\
	\hline
	\cellcolor{yellow}1800 & \cellcolor{yellow}50 & \cellcolor{yellow}50 & \cellcolor{yellow}Aus & \cellcolor{yellow}An & \cellcolor{yellow}400 & \cellcolor{yellow}100 & \cellcolor{yellow}40 & \cellcolor{yellow}Low & \cellcolor{yellow}1844.9 & \cellcolor{yellow}329.9\\
	\hline
	\cellcolor{red}800 & \cellcolor{red}600 & \cellcolor{red}130 & \cellcolor{red}An & \cellcolor{red}Aus & \cellcolor{red}800 & \cellcolor{red}800 & \cellcolor{red}80 & \cellcolor{red}Low & \cellcolor{red}1065.9 & \cellcolor{red}143.7\\
	\hline
	\cellcolor{red}800 & \cellcolor{red}600 & \cellcolor{red}130 & \cellcolor{red}Aus & \cellcolor{red}An & \cellcolor{red}400 & \cellcolor{red}800 & \cellcolor{red}20 & \cellcolor{red}Low & \cellcolor{red}958.1 & \cellcolor{red}193.6\\
	\hline
	1800 & 600 & 130 & An & Aus & 600 & 100 & 20 & Low & 1046.1 & 292.7\\
	\hline
	1800 & 50 & 130 & Aus & Aus & 400 & 100 & 20 & Low & 1192.3 & 132.3\\
	\hline
	1800 & 600 & 130 & An & An & 800 &800 & 20 & Low & 1233.5 & 275.2\\
	\hline
	800 & 50 & 90 & An & Aus & 800 & 800 & 20 & Low & 1885.2 & 116.0\\
	\hline
	1800 & 50 & 130 & Aus & Aus & 800 & 800 & 40 & Low & 1345.2 & 106.5\\
	\hline
	800 & 50 & 50 & An &An &400 & 100 & 20 & Low & 1468.1 & 139.6\\
	\hline
	500 & 20 & 150 & An & An & 400 & 400 & 80 & Med & 769.9 & 289.1\\
	\hline
	\cellcolor{green}1250 & \cellcolor{green}400 & \cellcolor{green}30 & \cellcolor{green}Aus & \cellcolor{green}An & \cellcolor{green}400 & \cellcolor{green}400 & \cellcolor{green}80 & \cellcolor{green}Med & \cellcolor{green}1778.4 & \cellcolor{green}90.2\\
	\hline
	\cellcolor{yellow}800 & \cellcolor{yellow}600 & \cellcolor{yellow}50 & \cellcolor{yellow}Aus & \cellcolor{yellow}Aus & \cellcolor{yellow}800 & \cellcolor{yellow}800 & \cellcolor{yellow}20 & \cellcolor{yellow}Med & \cellcolor{yellow}1734.4 & \cellcolor{yellow}160.8\\
	\hline
	500 & 20 & 150 & Aus & An & 400 & 400 & 80 & Med & 724.9 & 131.1\\
	\hline
	2000 & 210 & 150 & An & An & 400 & 400 & 80 & Med & 1056.0 & 220.5\\
	\hline
	800 & 500 & 50 & An & Aus & 800 & 450 & 40 & Med & 872.3 & 258.0\\
	\hline
	800 & 600 & 130 & Aus & An & 600 & 100 & 80 & Med & 926.3 & 188.7\\
	\hline
	500 & 400 & 30 & Aus & An & 400 & 400 & 80 & Med & 1110.7 & 123.2\\
	\hline
	2000 & 210 & 30 & An & An & 400 & 400 & 80  & Med & 1172.0 & 158.1\\
	\hline
	500 & 400 & 90 & An & An & 400 & 400 & 80 & Med & 1460.9 & 158.6\\
	\hline
	1800 & 50 & 130 & Aus & Aus & 800 & 100 & 40 & Med & 1157.1 & 224.8\\
	\hline
	800 & 600 & 130 & Aus & Aus & 400 & 800 & 20 & Med & 949.8 & 282.0\\
	\hline
	800 & 50 & 50 & Aus & Aus & 600 & 100 & 20 & Med & 837.6 & 256.5\\
	\hline
	1250 & 20 & 90 & An & An & 400 & 400 & 80 & Med & 950.0 & 280.3\\
	\hline
	500 & 400 & 150 & An & An & 400 & 400 & 80 & Med & 1144.4 & 138.1\\
	\hline
	2000 & 20 & 150 & An & An & 400 & 400 & 80 & Med & 1209.3 & 429.8\\
	\hline
	\cellcolor{yellow}1800 & \cellcolor{yellow}50 & \cellcolor{yellow}90 & \cellcolor{yellow}Aus & \cellcolor{yellow}Aus & \cellcolor{yellow}400 & \cellcolor{yellow}800 & \cellcolor{yellow}40 & \cellcolor{yellow}Med & \cellcolor{yellow}1745.6 & \cellcolor{yellow}257.9\\
	\cellcolor{red}800 & \cellcolor{red}600 & \cellcolor{red}130 & \cellcolor{red}An & \cellcolor{red}Aus & \cellcolor{red}800 & \cellcolor{red}100 & \cellcolor{red}20 &\cellcolor{red}Med & \cellcolor{red}1063.5 & \cellcolor{red}274.6\\
	\hline
	1250 & 210 & 150 & Aus & An & 400 & 400 & 80 & Med & 1260.4 & 188.8\\
	\hline
	800 & 50 & 130 & Aus & An & 800 & 800 & 20 & Med & 1228.9 & 296.4\\
	\hline
	500 & 210 & 90 & Aus & An & 400 & 400 & 80 & Med & 1209.5 & 191.2\\
	\hline
	1800 & 600 & 130 & An & An & 400 & 10 & 20 & Med & 1109.0 & 231.4\\
	\hline
	2000 & 400 & 30 & An & An & 400 & 400 & 80 & Med & 1323.8 & 215.8\\
	\hline
	2000 & 400 & 90 & Aus & An & 400 & 400 & 80 & Med & 1509.8 & 248.2\\
	\hline
	800 & 50 & 50 & An & Aus & 400 & 800 & 40 & Med & 1034.4 & 1594\\
	\hline
	50 & 50 & 50 & Aus & An & 800 & 100 & 40 & Med & 548.7 & 230.8\\
	\hline
	1250 & 400 & 150 & An & An & 400 & 400 & 80 & Med & 1138.4 & 128.2\\
	\hline
	\cellcolor{yellow} 1800 & \cellcolor{yellow}600 & \cellcolor{yellow}50 & \cellcolor{yellow}An & \cellcolor{yellow}An & \cellcolor{yellow}800 & \cellcolor{yellow}800 & \cellcolor{yellow}80 & \cellcolor{yellow}Med & \cellcolor{yellow}1854.4 & \cellcolor{yellow}194.3\\
	\hline
	\cellcolor{yellow}1800 & \cellcolor{yellow}600 & \cellcolor{yellow}50 & \cellcolor{yellow}An & \cellcolor{yellow}Aus & \cellcolor{yellow}400 & \cellcolor{yellow}100 & \cellcolor{yellow}80 & \cellcolor{yellow}Med & \cellcolor{yellow}1655.5 & \cellcolor{yellow}556.8\\
	\hline
	2000 & 400 & 150 & Aus & An & 400 & 400 & 80 & Med & 1027.1 & 115.9\\
	\hline
	1800 & 50 & 50 & An & Aus & 800 & 800 & 20 & Med & 1262.8 & 299.5\\
	\hline
	800 & 50 & 50 & Aus & Aus & 800 & 100 & 40 & High & 800.8 & 98.7\\
	\hline
	\cellcolor{yellow}800 & \cellcolor{yellow}600 & \cellcolor{yellow}50 & \cellcolor{yellow}An & \cellcolor{yellow}An & \cellcolor{yellow}800 & \cellcolor{yellow}800 & \cellcolor{yellow}20 & \cellcolor{yellow}High & \cellcolor{yellow}1680.6 & \cellcolor{yellow}228.3\\
	\hline
	1800 & 50 & 130 & An & An & 800 & 100 & 20 & High & 1266.2 & 341.6\\
	\hline
	1800 & 50 & 130 & An & An & 400 & 800 & 20 & High & 1480.9 & 179.0\\
	\hline
	\cellcolor{yellow}1800 & \cellcolor{yellow}50 & \cellcolor{yellow}130 & \cellcolor{yellow}An & \cellcolor{yellow}Aus & \cellcolor{yellow}600 & \cellcolor{yellow}450 & \cellcolor{yellow}40 & \cellcolor{yellow}High & \cellcolor{yellow}1660.0 & \cellcolor{yellow}233.3\\
	\hline
	1800 & 50 & 50 & Aus & An & 800 & 800 & 40 & High & 1249.9 & 211.4\\
	\hline
	1800 & 600 & 130 & Aus & Aus & 400 & 100 & 80 & High & 1233.7 & 322.4\\
	\hline
	1800 & 600 & 130 & Aus & Aus & 800 & 800 & 20 & High & 1020.8 & 302.3\\
	\hline
	\cellcolor{red}800 & \cellcolor{red}600 & \cellcolor{red}130 & \cellcolor{red}An & \cellcolor{red}An & \cellcolor{red}800 & \cellcolor{red}100 & \cellcolor{red}80 & \cellcolor{red}High & \cellcolor{red}1237.8 & \cellcolor{red} 247.8\\
	\hline
	\cellcolor{yellow}1300 & \cellcolor{yellow}50 & \cellcolor{yellow}130 & \cellcolor{yellow}An & \cellcolor{yellow}Aus & \cellcolor{yellow}800 & \cellcolor{yellow}800 & \cellcolor{yellow}40 & \cellcolor{yellow}High & \cellcolor{yellow}1911.0 & \cellcolor{yellow}283.2\\
	\hline
	\cellcolor{yellow}1800 & \cellcolor{yellow}600 & \cellcolor{yellow}50 & \cellcolor{yellow}Aus & \cellcolor{yellow}An & \cellcolor{yellow}400 & \cellcolor{yellow}800 & \cellcolor{yellow}50 & \cellcolor{yellow}High & 1917.4 & \cellcolor{yellow}167.6\\
	\hline
	\cellcolor{yellow}1800 & \cellcolor{yellow}600 & \cellcolor{yellow}50 & \cellcolor{yellow}Aus & \cellcolor{yellow}An & \cellcolor{yellow}800 & \cellcolor{yellow}100 & \cellcolor{yellow}20 & \cellcolor{yellow}High & \cellcolor{yellow}1621.8 & \cellcolor{yellow}465.4\\
	\hline
	800 & 50 & 50 & Aus & Aus & 400 & 800 & 20 & High & 1051.5 & 183.7\\
	\hline
	1800 & 600 & 50 & An & Aus & 800 & 800 & 80 & High & 1878.1 & 214.1\\
	\hline
	800 & 50 & 50 & An & An & 400 & 100 & 40 & High & 1071.2 & 196.7\\
	\hline
	1800 & 600 & 50 & An & Aus & 400 & 100 & 20 & High & 1481.3 & 476.4\\
	\hline
	800 & 600 & 130 & Aus & An & 400 & 100 & 20 & High & 1199.2 & 350.1\\
	\hline
	800 & 600 & 130 & An & Aus & 400 & 800 & 80 & High & 1254.6 & 185.5\\
	\hline
	\end{longtabu}
	\label{tab:DoEM2x}
\end{table}
\end{document}

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Innerhalb von Gleitumgebungen sind keine Seitenumbrüche möglich, deshalb gehören longtable und longtabu auch nicht in eine table Umgebung:
\begin{document}
    \begin{longtabu}{|*{11}{C{1cm}|}} 
    \caption{Messergebnisse DoEM2x}\label{tab:DoEM2x}\\
    \hline 
...
    \end{longtabu} 
\end{document}
Gruß
Elke

blablubb1234
Forum-Newbie
Forum-Newbie
Beiträge: 3
Registriert: So 18. Mai 2014, 20:51

Beitrag von blablubb1234 »

Hi esdd,

Du bist mein Held :)

So funktioniert es, ich war mir nicht bewusst, dass longtable nicht floaten darf.

Eine Frage habe ich nun noch. Du hast ja bereits in Deinem Code das \label{} direkt hinter \caption{} geschrieben. Nur wenn ich das auch so mache, kann ich die Tabelle mittels
\\
\hline
\end{longtabu}
beenden, sodass die letzte (gefüllte) Zeile mit einem Querstrich beendet wird. Schreibe ich das \label{} wie in meinem Code nach unten, sieht es so aus, als würde über die ersten beiden Spalten eine weitere Zeile angefangen und es folgt keine durchgehende Querlinie... wie kommt das? Ist mir irgendwie nicht klar....

Danke jedenfalls nochmal :)

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Du befindest dich dabei innerhalb der Tabelle. Wenn du Material in die erste Zelle einer Zeile setzt, dann wird diese begonnen, selbst wenn da keine Ausgabe erfolgt. Auch \caption wird da intern eigentlich als Tabellenzeile gesetzt, weshalb am Ende das \\ notwendig ist.

Gruß
Elke

PS: Bitte schau dir an, was der Status "Rückfrage" bedeutet.

blablubb1234
Forum-Newbie
Forum-Newbie
Beiträge: 3
Registriert: So 18. Mai 2014, 20:51

Beitrag von blablubb1234 »

Danke für die Erklärung.

Habe gerade den Status nachgelesen... Pardon.

Antworten