Latex Tabelle richtig formatieren

yxy

Lieutenant
Registriert
Juli 2014
Beiträge
556
Hallo,

ich habe folgende Tabelle gebastelt, bin aber noch nicht ganz zufrieden. Leider weiß ich nicht, wie ich meine Wünsche noch hinbekomme.

Code:
\documentclass[9pt,twocolumn]{article}

\usepackage{tabularx}
\usepackage[format=plain, indention=1cm]{caption}
\usepackage{booktabs}
\usepackage{multirow}




\begin{document}

Here some text.

%.......................................Table..................................
\begin{table*}[!htb]
\captionsetup{size=footnotesize}
\caption{Heading}
\label{tab:Test1}
\setlength\tabcolsep{0pt}
 
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}p{2cm}p{5cm}p{5cm}p{5cm}}

\hline \toprule
Col 1 & \multicolumn{2}{c}{Col 2} & Col 3\\
\hline \midrule

\multirow{4}{*}{\parbox{1.5cm}{This is row 1}}
  & \multicolumn{2}{c}{Subheading 1}
  & \multirow{4}{*}{\parbox{4.5cm}{This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long text \\ with a line break \\ and a second one}}\\
 
& \parbox[t][][t]{4.5cm}{content, content, content, content, content, content, content, content, content, content, content}
& \parbox[t][][t]{4.5cm}{content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content, content} & \\

  & \multicolumn{2}{c}{\parbox[t][][t]{10cm}{\centering This is a very very very very very long centered Subheading 2 over two lines}} & \\
 
& \multicolumn{2}{c}{\parbox[t][][t]{9.5cm}{This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long text}} & \\

\hline

    \multirow{3}{*}{\parbox[t][][c]{1.5cm}{This is row 2}}
  & \multicolumn{2}{c}{\parbox[t][][c]{9.5cm}{This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long text}}
 
    & \multirow{6}{*}{\parbox{4.5cm}{This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long text}} \\
  & \multicolumn{2}{c}{\parbox[t][][t]{2cm}{\centering Subheading 3}} & \\
 
& \multicolumn{2}{c}{\parbox[t][][t]{9.5cm}{This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long text}} & \\

\cline{1-3}

  \multirow{3}{*}{\parbox[t][][c]{1.5cm}{This is row 3}}
  & \multicolumn{2}{c}{\parbox[t][][c]{9.5cm}{fleet, older generation, preceding generation, previous generation}} & \\
  & \multicolumn{2}{c}{\parbox[t][][t]{2cm}{\centering Subheading 4}} & \\
& \multicolumn{2}{c}{\parbox[t][][t]{9.5cm}{This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long text}} & \\

\bottomrule
\hline

\end{tabular*}
\end{table*}
%................
\end{document}

Was stört mich noch:
1. In der ersten Zeile beginnen "content" und "This is a very" nicht gleichzeitig.
1651853014156.png

2. Der Inhat der ersten Zeile in der letzten Spalte läuft über die Zeile hinweg. Eigentlich sollte sich einfach die erste Zeile an den Inhalt anpassen d.h. sich verlängern
1651853140588.png

3. Der Text in der linken Spalte beginnt immer unterhalb des Textes in der mittleren Spalte. Sie sollen aber auf der selben Höhe beginnen
1651853240633.png

4. Der Abstand zwischen "Subheading 1" und dem Text darunter ist größer als zwischen "This is a very ... long centered Subheadin 2..." und dem Text darunter.
1651853363557.png

Das wären aktuell die brennensten Themen. Hat jemand eine Idee, wie ich das lösen kann?
 
1) Poste doch mal bitte einen Screenshot der kompletten Tabelle. Nicht nur Fetzen davon, die man sich zusammen denken muss. So hat man nämlich keine Ahnung, welcher Teil des Quellcodes wo in welchem Bild auftaucht.

2) Kannst du die Tabelle vllt mit etwas mehr echtem Inhalt füllen? Und uns bitte sagen, warum du was wie gemacht hast? Das sieht mir nämlich schon im Quelltext wie Kraut und Rüben aus. Hier eine Parbox mit 10cm, darauf folgende eine mit 9,5cm.Mit/ohne Centering, mal der Inhalt oben orientiert, dann wieder in der Mitte...

Warum überhaupt die ganzen parbox? Das macht mich schon etwas skeptisch. Normalerweise geht das auch ganz gut ohne...
 
Hallo, danke für deine Antwort.

1.
1651859927695.png




2.
Vorweg: Wie Kraut und Rüben sieht es deshalb aus, da ich noch nie vorher eine solche komplexe Latex-Tabelle erstellt habe ☹️. Gewollt gemacht ist eigentlich nur die "Rahmenstruktur" der Tabelle d.h. die Zeilen- und Spalteneinteilung.

Parbox habe ich benutzt, um bei multrow bzw. multicolumn einen automatischen Zeilenumbruch hinzubekommen. Oder geht das auch eleganter? Ja, denke das mit der Orientierung des Inhalts etc. ist genau mein Problem. Grundsätzlich sollte alles oben stehen und linksbündig. Nur die Subheadings sollten zentriert sein.
 
Zuletzt bearbeitet:
Zurück
Oben