2

since 2 weeks working with Tex/Latex I am a beginner but meanwhile frustrated with tables that took me hours.
I want to align the elements of this simple table (with multirows) nicely, i.e.:

1) Each line should have a similar height (tried to solve this \parbox but failed : although for the first two rows the height arguments are higher than for the rest, the row height is smaller ??? [see attached picture of output]
2) the multi row cells should have content that is consistently in the middle of the "merged" cells or consistently are aligned on top with the other cells of the same row. 3) All text in table cells should be aligned to the left horizontally and centered vertically (no justification or grouped style)

Help highly appreciated. Thanks very much in advance. Michael

\begin{table} 
\caption{this is one text example \autocite [Vgl.] [695-770] {Reference29}}
\begin{flushleft}
%\begin{tabularx}{\textwidth}{XXX}
%\begin{tabularx}{\textwidth}{P{0.2\linewidth}P{0.4\linewidth}P{0.4 \linewidth}}
\begin{tabularx}{\textwidth}{P{0.2\linewidth}P{0.3\linewidth}X}
    \toprule
  xxxxxxxxxxxx & xxxxxxxxxxx & xxxxxxxxxxx \\
    \cmidrule{1-3}
    \multirow{4}{\linewidth} {this is one text example} & \multirow{2}{\linewidth}  {this is one text example} & {\parbox[t][4.5ex]{\linewidth}{this is one text example}}\\
    \cmidrule{3-3}
    &  & \parbox[t][4.5ex]{\linewidth}{this is one text example}\\
    \cmidrule{2-3}
    & {this is one text example}
    & {\parbox[t][4.5ex]{\linewidth}{}}\\
    \cmidrule{2-3}  
    & {this is one text example}
    & {\parbox[t][4.5ex]{\linewidth}{}}\\
    \cmidrule{2-3}      
    & {this is one text example}
    & {\parbox[t][4.5ex]{\linewidth}{}}\\
    \cmidrule{1-3}
    this is one text example&{}&{\parbox[t][3.5ex]{\textwidth}{}}\\
    \cmidrule{1-3}
    this is one text example&{}&{\parbox[t][3.5ex]{\textwidth}{}}\\ 
    \cmidrule{1-3}
    \multirow{2}{\linewidth} {this is one text example} &{Bthis is one text example}&{\parbox[t][3.5ex]{\textwidth}{}}\\
    \cmidrule{2-3}
    &{this is one text example}&{\parbox[t][3.5ex]{\textwidth}{}}\\
    \bottomrule
 \end{tabularx}
 \label{tab:Bewertungsmodelle}
 \end{flushleft}
 \end{table}

TEX output of code example from above

  • Welcome to TeX.SE. Please extend your code sniped to complete small document beginning with \documentclass{...} and ending with \end{document} in preamble put only necessary packages and in table ovoid citing anything (it is not essential to your problem, right?). – Zarko Feb 19 '17 at 0:39
4

enter image description here

\documentclass{article}
\usepackage{booktabs,array}
\newlength\tabl
\begin{document}
\begin{table} 

\caption{this is one text example }
\tabl=\dimexpr\textwidth-6\tabcolsep\relax
\begin{tabular}{m{0.3\tabl}p{0.35\tabl}p{0.35\tabl}}
    \toprule
  xxxxxxxxxxxx & xxxxxxxxxxx & xxxxxxxxxxx \\
    \cmidrule{1-3}
    this is one text example & 
\multicolumn{2}{@{}c@{}}{\begin{tabular}{p{0.35\tabl}p{0.35\tabl}}
this is one text example &
\multicolumn{1}{@{}c@{}}{\begin{tabular}{p{0.35\tabl}}
this is one text example\\
    \cmidrule{1-1}
    this is one text example
\end{tabular}}\\
    \cmidrule{1-1}
    this is one text example\\
    \cmidrule{1-2}  
    this is one text example
\end{tabular}}\\
    \cmidrule{1-3}      
    this is one text example&&\\
    \cmidrule{1-3}
    this is one text example&&\\
    \cmidrule{1-3}
 this is one text example &
\multicolumn{2}{@{}c@{}}{\begin{tabular}{p{0.35\tabl}p{0.35\tabl}}
Bthis is one text example&\\
    \cmidrule{1-2}
    this is one text example&
\end{tabular}}\\
    \bottomrule
 \end{tabular}
 \label{tab:Bewertungsmodelle}

 \end{table}

\end{document}
  • tabular within a \multicolumn! There is always to learn here on TeX.SE! – CarLaTeX Feb 19 '17 at 5:53
  • wow! thank you so much. Is there an easy way to get the text of the columns that fit to the merged ones (more right) aligned vertically on top along all columns? – Michael Feb 19 '17 at 9:00
  • @Michael not sure what you mean, all your entries so far are m or p which are justified (although they look flush left if only one line) you can of course use \centering or \raggedleft or \raggedright or any other paragraph setting – David Carlisle Feb 19 '17 at 10:28
  • Hi David, I meant vertical alignment i.e. each text in a cell of the table that has text blocks to its right should be aligned on top, if possible ? – Michael Feb 20 '17 at 22:03
  • @David : One other question regarding\raggedright with respect to the above example: It works for the text in the cell of the second row from top (right column), but not for the text of the cells in the first row from top. Why? I could provide a screenshot and the code of your example extended by the \raggedright commands, but I do not know where to post within the comment section of this post (open a new one?). – Michael Feb 20 '17 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.