Seite 1 von 1
Probelm bei multirow in Tabelle
Verfasst: Do 7. Apr 2011, 14:23
von se1234
Hallo zusammen,
sitze nun schon längere Zeit an einer Tabelle, komme aber nicht richtig weiter.
Die Tabelle soll Korrelationen zwischen 4 Grössen zeigen (text1, text2, text3, text4). text1 und text2 gehören zur Klasse 1, die anderen beiden zur Klasse 2.
Habe das in den Spalten fast hinbekommen (siehe Code), nur ein vertikaler Strich fehlt ganz links in der Tabelle und die Zeilen machen Probleme..
Will, dass Klasse 1 und 2 vertikal stehen, text1, text2 usw aber horizontal.
Das macht mir der Code auch, nur er macht auch horizontale Striche innerhalb der Klassen. Weiß nicht warum...
Kann mir jemand helfen?
Danke!
Gruß, Sebi
\documentclass[a4paper,12pt,twoside,openright]{book}
\usepackage{rotating}
\usepackage{multirow}
\begin{document}
\begin{table}[ht]
{\small
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\multicolumn{2}{c}{} \vline & \multicolumn{2}{c}{\textit{1}} \vline & \multicolumn{2}{c}{\textit{2}} \vline\\
\hline & & \begin{sideways}text1\end{sideways} & \begin{sideways}text2\end{sideways} & \begin{sideways}text3\end{sideways} & \begin{sideways}text4\end{sideways} \\
\hline
\multirow{2}{*}{\begin{sideways}\textit{1}\end{sideways}} & text1 & & & & \\ \hline
& text2 & & & & \\ \hline
\multirow{2}{*}{\begin{sideways}\textit{2}\end{sideways}} & text3 & & & & \\ \hline
& text4 & & & & \\ \hline
\end{tabular}
}
\caption{xxx \label{tab:xxx}}
\end{table}
\end{document}
Verfasst: Do 7. Apr 2011, 15:08
von CollmDante
Eigentlich soll man ja ohne vertikale Linien arbeiten

; ich habe einmal versucht einen Kompromiß zu finden. Mit dem Paket tabu lassen sich schön die Linien ziehen und der Abstand von den Linien (\tabulinesep) steuern. Weitere vertikale Linien zu beseitigen überlasse ich deiner Phantasie:
\documentclass[a4paper,12pt,twoside,openright]{book}
\usepackage{rotating}
\usepackage{tabu,multirow}
\begin{document}
\begin{table}[ht]
{\small
\tabulinesep=1ex
\begin{tabu}{|c|c|c|c|c|c|}
\tabucline{3-7}
\multicolumn{2}{c}{} \vline & \multicolumn{2}{c}{\textit{1}} \vline & \multicolumn{2}{c}{\textit{2}} \vline\\ \tabucline{3-7}
\multicolumn{2}{c}{}\vline& \begin{sideways}text1\end{sideways} & \begin{sideways}text2\end{sideways} & \begin{sideways}text3\end{sideways} & \begin{sideways}text4\end{sideways} \\
\tabucline{1-7}
\multirow{2}{*}{\begin{sideways}\textit{1}\end{sideways}} & text1 & & & & \\ \tabucline{2-7}
& text2 & & & & \\ \hline
\multirow{2}{*}{\begin{sideways}\textit{2}\end{sideways}} & text3 & & & & \\ \tabucline{2-7}
& text4 & & & & \\ \tabucline{1-7}
\end{tabu}
}
\caption{xxx \label{tab:xxx}}
\end{table}
\begin{table}[ht]
{\small
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\multicolumn{2}{c}{} \vline & \multicolumn{2}{c}{\textit{1}} \vline & \multicolumn{2}{c}{\textit{2}} \vline\\
\hline & & \begin{sideways}text1\end{sideways} & \begin{sideways}text2\end{sideways} & \begin{sideways}text3\end{sideways} & \begin{sideways}text4\end{sideways} \\
\hline
\multirow{2}{*}{\begin{sideways}\textit{1}\end{sideways}} & text1 & & & & \\ \hline
& text2 & & & & \\ \hline
\multirow{2}{*}{\begin{sideways}\textit{2}\end{sideways}} & text3 & & & & \\ \hline
& text4 & & & & \\ \hline
\end{tabular}
}
\caption{xxx \label{tab:xxx}}
\end{table}
\end{document}
Gruß Jens
Verfasst: Do 7. Apr 2011, 16:21
von se1234
Hallo!
Ja, so soll es aussehen, vielen Dank!
Habe aber nun folgendes Problem:
Anstatt der Klassen 1 und 2 kommen Namen hin, die unterschiedlich lang sind.
Wie kann ich sagen, dass er mir die Zeilen der 1.Spalte (da, wo die Klassen vertikal stehen) so ausgibt, dass der Name der jeweiligen Klasse genau reinpasst? Genau so wie in der allerersten Zeile?
Sollte doch eigentlich mit \multirow{2}{*} funktionieren, oder? Tut es aber nicht.
Wie kann ich das machen?
Gruß, Sebi
Verfasst: Do 7. Apr 2011, 17:57
von se1234
Hi,
hier ist nun der Text, der tatsächlich in die Tabelle soll.
Habe nur in der ersten Spalte Probleme, da die Klassen ARPEGE und BCM zu lang (hoch) für die Zeilen sind. Kann mir jemand helfen???
Sebi
\begin{table}[ht]
{\tiny
\tabulinesep=1ex
\begin{tabu}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\tabucline{3-19}
\multicolumn{2}{c}{} \vline & \multicolumn{7}{c}{ECHAM5} \vline & \multicolumn{2}{c}{ARPEGE} \vline & \multicolumn{1}{c}{BCM} \vline & \multicolumn{6}{c}{HadCM} \vline\\ \tabucline{3-19}
\multicolumn{2}{c}{}\vline& \begin{sideways}RACMO\end{sideways} & \begin{sideways}RCA\end{sideways} & \begin{sideways}REMO\end{sideways} & \begin{sideways}RegCM\end{sideways} & \begin{sideways}DMI-HIRHAM5\end{sideways} & \begin{sideways}COSMO-CLM-1\end{sideways} & \begin{sideways}COSMO-CLM-2\end{sideways} & \begin{sideways}Aladin\end{sideways} & \begin{sideways}HIRHAM\end{sideways} & \begin{sideways}RCA\end{sideways} & \begin{sideways}RCA\end{sideways} & \begin{sideways}RCA3\end{sideways} & \begin{sideways}CLM\end{sideways} & \begin{sideways}HadRM3Q0\end{sideways} & \begin{sideways}HadRM3Q3\end{sideways} & \begin{sideways}HadRM3Q16\end{sideways}\\
\tabucline{1-19}
\multirow{7}{*}{\begin{sideways}ECHAM5\end{sideways}} & RACMO & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& RCA & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& REMO & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& RegCM & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& DMI-HIRHAM5 & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& COSMO-CLM-2 & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& COSMO-CLM-1 & & & & & & & & & & & & & & & & \\ \tabucline{1-19}
\multirow{2}{*}{\begin{sideways}ARPEGE\end{sideways}} & Aladin & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& HIRHAM & & & & & & & & & & & & & & & & \\ \tabucline{1-19}
\multirow{1}{*}{\begin{sideways}BCM\end{sideways}} & RCA & & & & & & & & & & & & & & & & \\ \tabucline{1-19}
\multirow{6}{*}{\begin{sideways}HadCM\end{sideways}} & RCA & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& RCA3 & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& CLM & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& HadRM3Q0 & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& HadRM3Q3 & & & & & & & & & & & & & & & & \\ \tabucline{2-19}
& HadRM3Q16 & & & & & & & & & & & & & & & & \\ \tabucline{1-19}
\end{tabu}
}
\caption{xxx. \label{tab:xxx}}
\end{table}
Verfasst: Do 7. Apr 2011, 19:30
von CollmDante
Ich habe dann versucht Breite und Höhe der Zellen anzugleichen,hoffentlich ist sie jetzt nicht zu groß, aber mit dem Prinzip läst sich auch noch anderes anstellen (statt \newtabh müsste auch \\[1em] funktionieren)
\documentclass[a4paper,12pt,twoside,openright]{book}
\usepackage{rotating}
\usepackage{tabu,multirow}
\begin{document}
\begin{table}[ht]
{\tiny
\tabulinesep=1ex
\newlength\tabh %Hilfslänge
\settowidth\tabh{1em} %Größe zugewiesen
\newcommand{\newtabh}{\parbox[0pt][\tabh][c]{0cm}{}\\} %parbox setzt Höhe auf tabh
\begin{tabu}{|c|c|*{16}{p{\tabh}|}} %Breite der Spalte an Zeilenhöhe angepasst
\tabucline{3-19}
\multicolumn{2}{c}{} \vline & \multicolumn{7}{c}{ECHAM5} \vline & \multicolumn{2}{c}{ARPEGE} \vline & \multicolumn{1}{c}{BCM} \vline & \multicolumn{6}{c}{HadCM} \vline\newtabh \tabucline{3-19}
\multicolumn{2}{c}{}\vline& \begin{sideways}RACMO\end{sideways} & \begin{sideways}RCA\end{sideways} & \begin{sideways}REMO\end{sideways} & \begin{sideways}RegCM\end{sideways} & \begin{sideways}DMI-HIRHAM5\end{sideways} & \begin{sideways}COSMO-CLM-1\end{sideways} & \begin{sideways}COSMO-CLM-2\end{sideways} & \begin{sideways}Aladin\end{sideways} & \begin{sideways}HIRHAM\end{sideways} & \begin{sideways}RCA\end{sideways} & \begin{sideways}RCA\end{sideways} & \begin{sideways}RCA3\end{sideways} & \begin{sideways}CLM\end{sideways} & \begin{sideways}HadRM3Q0\end{sideways} & \begin{sideways}HadRM3Q3\end{sideways} & \begin{sideways}HadRM3Q16\end{sideways}\newtabh
\tabucline{1-19}
\multirow{7}{*}{\begin{sideways}ECHAM5\end{sideways}} & RACMO & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& RCA & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& REMO & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& RegCM & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& DMI-HIRHAM5 & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& COSMO-CLM-2 & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& COSMO-CLM-1 & & & & & & & & & & & & & & & & \newtabh \tabucline{1-19}
\multirow{2}{*}{\begin{sideways}ARPEGE\end{sideways}} & Aladin & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& HIRHAM & & & & & & & & & & & & & & & & \newtabh \tabucline{1-19}
\multirow{1}{*}{\begin{sideways}BCM\end{sideways}} & RCA & & & & & & & & & & & & & & & & \newtabh \tabucline{1-19}
\multirow{6}{*}{\begin{sideways}HadCM\end{sideways}} & RCA & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& RCA3 & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& CLM & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& HadRM3Q0 & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& HadRM3Q3 & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& HadRM3Q16 & & & & & & & & & & & & & & & & \newtabh \tabucline{1-19}
\end{tabu}
}
\caption{xxx. \label{tab:xxx}}
\end{table}
\end{document}
Verfasst: Fr 8. Apr 2011, 06:58
von CollmDante
Da habe ich beim Ausgleich Höhe Breite Bockmist gebaut

;
also noch einmal:
\documentclass[a4paper,12pt,twoside,openright]{book}
\usepackage{rotating}
\usepackage{tabu,multirow}
\begin{document}
\begin{table}[ht]
{\tiny
\tabulinesep=1ex
\newlength\tabh %Hilfslänge
\settowidth\tabh{BCM} %Größe zugewiesen
\newcommand{\newtabh}{\parbox[0pt][\tabh][c]{0cm}{}\\} %parbox setzt Höhe
\setlength\tabcolsep{0.7ex}
\begin{tabu} to \linewidth{|X[0.5,c]|c|*{16}{X[c]|}} %Breite der Spalte an Zeilenhöhe angepasst
% dabei Tabelle auf Zeilenlänge beschränkt
\tabucline{3-19}
\multicolumn{2}{c}{} \vline & \multicolumn{7}{c}{ECHAM5} \vline & \multicolumn{2}{c}{ARPEGE} \vline & \multicolumn{1}{c}{BCM} \vline & \multicolumn{6}{c}{HadCM} \vline\newtabh \tabucline{3-19}
\multicolumn{2}{c}{}\vline& \begin{sideways}RACMO\end{sideways} & \begin{sideways}RCA\end{sideways} & \begin{sideways}REMO\end{sideways} & \begin{sideways}RegCM\end{sideways} & \begin{sideways}DMI-HIRHAM5\end{sideways} & \begin{sideways}COSMO-CLM-1\end{sideways} & \begin{sideways}COSMO-CLM-2\end{sideways} & \begin{sideways}Aladin\end{sideways} & \begin{sideways}HIRHAM\end{sideways} & \begin{sideways}RCA\end{sideways} & \begin{sideways}RCA\end{sideways} & \begin{sideways}RCA3\end{sideways} & \begin{sideways}CLM\end{sideways} & \begin{sideways}HadRM3Q0\end{sideways} & \begin{sideways}HadRM3Q3\end{sideways} & \begin{sideways}HadRM3Q16\end{sideways}\newtabh
\tabucline{1-19}
\multirow{7}{*}{\begin{sideways}ECHAM5\end{sideways}} & RACMO & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& RCA & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& REMO & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& RegCM & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& DMI-HIRHAM5 & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& COSMO-CLM-2 & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& COSMO-CLM-1 & & & & & & & & & & & & & & & & \newtabh \tabucline{1-19}
\multirow{2}{*}{\begin{sideways}ARPEGE\end{sideways}} & Aladin & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& HIRHAM & & & & & & & & & & & & & & & & \newtabh \tabucline{1-19}
\multirow{1}{*}{\begin{sideways}BCM\end{sideways}} & RCA & & & & & & & & & & & & & & & & \newtabh \tabucline{1-19}
\multirow{6}{*}{\begin{sideways}HadCM\end{sideways}} & RCA & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& RCA3 & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& CLM & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& HadRM3Q0 & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& HadRM3Q3 & & & & & & & & & & & & & & & & \newtabh \tabucline{2-19}
& HadRM3Q16 & & & & & & & & & & & & & & & & \newtabh \tabucline{1-19}
\end{tabu}
}
\caption{xxx. \label{tab:xxx}}
\end{table}
\end{document}
Gruß Jens
Verfasst: Fr 8. Apr 2011, 12:53
von se1234

!!!
Super, vielen Dank!
Genau so wollte ich es!
DANKE!
Gruß, Sebi