ich habe seit wenigen Monaten längere Arbeiten mit Latex anzufertigen und muss sagen, ich bin weiterhin sehr glücklich damit. In den allermeisten Fällen findet man schnell Support und lösungen für die Probleme und es funktioniert ganz hervorragend. Ein Problem mit der Formatierung einer Tabelle habe ich jedoch bisher nicht lösen können.
Zwei kurze Worte zur Tabelle, es handelt sich um eine Aufstellung der Kosten eines Projektes, mit Zeilen für jede Aufwendung, eine Markierung für wann die Kosten eines Quartals anfallen und einigen selbst geschriebenen Funktionen die die einzelnen Punkte miteinander verknüpfen. Der Übersicht halber, habe ich die Tabelle mit einem dummy Text versehen und ein MWE geschrieben:
\documentclass[paper=a4, fontsize=11pt, headings=small, DIV=12]{scrreprt} \usepackage[utf8x]{inputenc} \usepackage{lmodern,textcomp} \usepackage[onehalfspacing]{setspace} \usepackage{booktabs,tabularx,dcolumn, threeparttable, ragged2e} \newcolumntype{L}{>{\RaggedRight\arraybackslash}X} \newcolumntype{R}{>{\RaggedLeft\arraybackslash}X} \usepackage{multirow} \usepackage{parskip} \usepackage{hyperref} \usepackage{multirow} \usepackage{float} \usepackage[table]{xcolor} \definecolor{lightgrey}{RGB}{184,184,184} \begin{document} \begin{table}[!h]\onehalfspacing \footnotesize \begin{threeparttable} \caption{Lorem ipsum dolor sit amet, consetetur sadipscing elitr} \label{table:kostenplan} \begin{tabularx}{1\textwidth}{@{} L R c c c c c c c c R @{}} \toprule Kostenpunkt & Kosten & \multicolumn{4}{>{\hsize=4\hsize}c}{\parbox{3cm}{\centering Jahr 1}} &\multicolumn{4}{>{\hsize=4\hsize}c}{\parbox{3cm}{\centering Jahr 2}} & Summe \\ \cmidrule(l){3-6}\cmidrule(l){7-10} & &Q1 &Q2 &Q3 &Q4 &Q1 &Q2 &Q3 &Q4 & \\ \midrule Lorem ipsum dolor sit amet, consetetur sadipscing & 99999 p. Qu. & \cellcolor{lightgrey}\textbf{$\times$} & \cellcolor{lightgrey}\textbf{$\times$} & \cellcolor{lightgrey}\textbf{$\times$} & \cellcolor{lightgrey}\textbf{$\times$} & \cellcolor{lightgrey}\textbf{$\times$} & \cellcolor{lightgrey}\textbf{$\times$} & \cellcolor{lightgrey}\textbf{$\times$} & \cellcolor{lightgrey}\textbf{$\times$} & 99999€\\ Lorem ipsum dolor 1 & 33433€ p. Qu.& & &\cellcolor{lightgrey}\textbf{$\times$} &\cellcolor{lightgrey}\textbf{$\times$} & & & & & 33433€ \\ Lorem ipsum dolor 1 & 22322€ p. Qu.& & & & \cellcolor{lightgrey}\textbf{$\times$} &\cellcolor{lightgrey}\textbf{$\times$} & & & & 23322€ \\ Lorem ipsum dolor 1 & 11211€ p. Qu.& & & & & \cellcolor{lightgrey}\textbf{$\times$} & \cellcolor{lightgrey}\textbf{$\times$} & & & 11211 € \\ Lorem ipsum & \textit{einm} & \cellcolor{lightgrey}\textbf{$\times$} & & & & & & & & 56789 € \\ Lorem ipsum & \textit{einm.} &\cellcolor{lightgrey}\textbf{$\times$} & & & & & & & & 4565 € \\ Lorem & \textit{einm.} & \cellcolor{lightgrey}\textbf{$\times$} & & & & & & & & 2345 € \\ Lorem ipsum & & & & & & & & & \cellcolor{lightgrey}\textbf{$\times$} & 1212€\\ Lorem ipsum dolor & & & & & & & & & \cellcolor{lightgrey}\textbf{$\times$} & 1111€ \\ \bottomrule & & & & & & & & & \textit{Gesamt} & 1234567 € \\ \end{tabularx} \end{threeparttable} \end{table} \end{document}
1. wie stelle ich die Breite der Kopfzeile ein, dass bspw. Q1-Q4 jeweils identisch ist und die zweie und letzte Spalte an den Inhalt angepasst ist. Der Rest soll für die erste Spalte übrig bleiben.
2.Wenn bei der ersten Zeile ein Umbruch erfolgt, wie stellt man den abstand ein, dass dieser kleiner ist?
3. wie kann man den Text innerhalb der grauen Zellen zentreieren, wenn es einen Zeilenumbruch gibt? Also bspw. über >>Gesamt<<
Wäre für eine Antwort dankbar.
Viele Grüße, David