I created the following table:
with the following code:
\begin{table}[h]
\begin{tabular}
{|M{0.16\textwidth-2\tabcolsep - 1.25\arrayrulewidth}|
M{0.24\textwidth-2\tabcolsep - 1.25\arrayrulewidth}|
M{0.18\textwidth-2\tabcolsep - 1.25\arrayrulewidth}|
M{0.44\textwidth-2\tabcolsep - 1.25\arrayrulewidth}|}
\hline
Zeitpunkt
& Variable
& Datentyp
& Beschreibung
\\
\hline
t0, t1, t2 &
Alter &
Numerisch &
Alter eines Studenten in \newline Jahren
\\
\hline
t0, t1, t2 &
Geschlecht &
Nominal &
Geschlecht eine Studenten
\\
\hline
t0, t1, t2 &
HzbArt &
Nominal &
Art der HZB
\\
\hline
t0, t1, t2 &
HzbNote &
Numerisch &
Notendurchschnitt der HZB
\\
\hline
t0, t1, t2 &
Ang\textunderscore Abschluss &
Nominal &
Bachelor oder Master
\\
\hline
t0, t1, t2 &
Studiengang &
Nominal &
Studiengang eines Studenten
\\
\hline
t0, t1, t2 &
Bildungsland &
Nominal &
Bildungsinländer oder \newline Bildungsausländer
\\
\hline
t1, t2 &
DN \textunderscore Sem\textunderscore1 &
Numerisch &
Notendurchschnitt nach dem ersten Semester
\\
\hline
t1, t2 &
NB\textunderscore Pruef\textunderscore \newline Sem\textunderscore1 &
Numerisch &
Anzahl der nicht bestandenen Prüfungen nach dem ersten Semester
\\
\hline
t2 &
DN \textunderscore Sem\textunderscore2 &
Numerisch &
Notendurchschnitt nach dem zweiten Semester
\\
\hline
t2 &
NB\textunderscore Pruef\textunderscore \newline Sem\textunderscore2 &
Numerisch &
Anzahl der nicht bestandenen Prüfungen nach dem zweiten Semester
\\
\hline
t0, t1, t2 &
Abbrecher &
Nominal &
Studienabbrecher oder \newline Nicht-Studienabbrecher
\\
\hline
\end{tabular}
\caption{Variablen der finalen Datensätze}
\label{Variablen der finalen Datensätze}
\end{table}
Hoewever, I want to create a table that looks like this:
In other words, I want to aggregate the cells of the first column that share the same information and align the corresponding text vertically and horizontally.
I've read that I must use a multicolumn table for doing this. However, once I create a multicolumn element with the following code
\begin{table}[h]
\begin{tabular}
{|M{0.16\textwidth-2\tabcolsep - 1.25\arrayrulewidth}|
M{0.24\textwidth-2\tabcolsep - 1.25\arrayrulewidth}|
M{0.18\textwidth-2\tabcolsep - 1.25\arrayrulewidth}|
M{0.44\textwidth-2\tabcolsep - 1.25\arrayrulewidth}|}
\hline
Zeitpunkt &
Variable &
Datentyp & Beschreibung \\ \hline
\multirow{7}{*}{t0, t1, t2}
&
Alter &
Numerisch &
Alter eines Studenten in Jahren
\\
\cline{2-4}
&
Geschlecht &
Nominal &
Geschlecht eines Studenten
\\
\cline{2-4}
&
HzbArt &
Nominal &
Art der HZB
\\
\cline{2-4}
&
HzbNote &
Numerisch &
Notendurchschnitt der HZB
\\
\cline{2-4}
&
Ang\_Abschluss &
Nominal &
Bachelor oder Master
\\
\cline{2-4}
&
Studiengang &
Nominal &
Studiengang eines Studenten
\\
\cline{2-4}
& Bildungsland
& Nominal
& Bildungsinländer oder Bildungsausländer
\\
\hline
\multirow{2}{*}{t1, t2}
&
DN\_Sem\_1 &
Numerisch &
Notendurchschnitt nach dem ersten Semester
\\
\cline{2-4}
&
NB\_Pruef\_ Sem\_1 &
Numerisch &
Anzahl der nicht bestandenen Prüfungen nach dem ersten Semester
\\
\hline
\multirow{2}{*}{t2}
&
DN\_Sem\_2 &
Numerisch &
Notendurchschnitt nach dem zweiten Semester
\\
\cline{2-4}
&
NB\_Pruef\_ Sem\_2 &
Numerisch &
Anzahl der nicht bestandenen Prüfungen nach dem zweiten Semester
\\
\hline
t0, t1, t2 &
Abbrecher &
Nominal &
Studienabbrecher oder Nicht-Studienabbrecher
\\
\hline
\end{tabular}%
\end{table}
The table will look like this (the text is aligned vertically and horizontally with the wrong proportions):
Another code I tried with regular column sizes looks like this:
\begin{table}[h]
\begin{tabular}{|c|l|l|l|}
\hline
Zeitpunkt &
Variable &
Datentyp & Beschreibung \\ \hline
\multirow{7}{*}{t0, t1, t2}
&
Alter &
Numerisch &
Alter eines Studenten in Jahren
\\
\cline{2-4}
&
Geschlecht &
Nominal &
Geschlecht eines Studenten
\\
\cline{2-4}
&
HzbArt &
Nominal &
Art der HZB
\\
\cline{2-4}
&
HzbNote &
Numerisch &
Notendurchschnitt der HZB
\\
\cline{2-4}
&
Ang\_Abschluss &
Nominal &
Bachelor oder Master
\\
\cline{2-4}
&
Studiengang &
Nominal &
Studiengang eines Studenten
\\
\cline{2-4}
& Bildungsland
& Nominal
& Bildungsinländer oder Bildungsausländer
\\
\hline
\multirow{2}{*}{t1, t2}
&
DN\_Sem\_1 &
Numerisch &
Notendurchschnitt nach dem ersten Semester
\\
\cline{2-4}
&
NB\_Pruef\_ Sem\_1 &
Numerisch &
Anzahl der nicht bestandenen Prüfungen nach dem ersten Semester
\\
\hline
\multirow{2}{*}{t2}
&
DN\_Sem\_2 &
Numerisch &
Notendurchschnitt nach dem zweiten Semester
\\
\cline{2-4}
&
NB\_Pruef\_ Sem\_2 &
Numerisch &
Anzahl der nicht bestandenen Prüfungen nach dem zweiten Semester
\\
\hline
t0, t1, t2 &
Abbrecher &
Nominal &
Studienabbrecher oder Nicht-Studienabbrecher
\\
\hline
\end{tabular}%
\end{table}
In this case, the table doesn't fit the text width any more and is distorted:
How can I manage to create a table that aggregates the desired columns and aligns the their text horizontally and vertically with the right proportions (same space between top-bottom and left-right). Besides, it should also not be larger than the text size of my latex document (which is \documentclass[11pt,a4paper]{article}).
Thanks very much in advance!
\multirow{2}{*}{t1, t2}
to\multirow{3.2}{*}{t1, t2}
. I used 3.2 for example, you set it to whatever value (even fraction) makes the content vertically centered. This happens because multirow uses standard row width to calculate the width.M
column type defined?