2

I created a minimal example with the bad table in red.

\documentclass{article}
\usepackage{siunitx} % To align the numbers later on
\usepackage{booktabs}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\usepackage{multirow}
\usepackage{rotating}

\begin{document}
    \begin{table*}[t]
        \newcommand{\rot}[1]{\rotatebox{90}{#1}}
        \newcommand{\multirot}[1]{\multirow{2}{*}{\rot{#1}}}
        \centering
        \ra{1.3}
        \begin{tabular}{ccc} \toprule
            \multirot{Minimal example} &
            \multicolumn{2}{c}{Minimal} \\
            \cmidrule{2-3}
            & exa & mple \\ \midrule
            a & a & 10 \\
            a & a & 0.1 \\
            a & a & 0.001 \\ \bottomrule
        \end{tabular}
    \end{table*}
\end{document}

Why does the top left cell not get bigger, when the content exceeds the height of the two rows on the top right? The text "Minimal example" should be aligned at the bottom (so multiple columns like that will flatter on the top).

multirow example

How to I achieve a table similar to the one on the right in my example image?

  • I implemented this question, but it only works for short text.
  • I saw this question, but feel like using a table in a table will make it overly complex.
  • @LaRiFaRi, what error do you get? I use pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian). – Lukas Jul 9 '15 at 9:33
  • It is corrected. – Lukas Jul 9 '15 at 9:38
  • For a start: \newcommand{\multirot}[1]{\raisebox{0pt}[3.8mm][15.6mm]{\multirow{2}{*}{\rot{#1}}}}. But this flushes the word "Minimal" to top. – LaRiFaRi Jul 9 '15 at 10:05
1

It is simple with makecellandt its \rotcell command, if you accept a two-lined column head. I took the opportunity to use siunitx for the last column.

\documentclass{article}
\usepackage{siunitx} % To align the numbers later on
\usepackage{booktabs}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\usepackage{multirow, makecell}
\usepackage{rotating}
\settowidth\rotheadsize{Minimal}

\begin{document}
\begin{table*}[t]
  \newcommand{\rot}[1]{\rotatebox{90}{#1}}
  \newcommand{\multirot}[1]{\multirow{2}{*}{\rot{#1}}}
  \centering
  \ra{1.3}
  \begin{tabular}{@{\,}ccS[table-format=2.3]} \toprule
    \multirow{2}{*}[1.5ex]{\rotcell{Minimal example}}&
    \multicolumn{2}{c}{Minimal} \\
    \cmidrule{2-3}
      & exa & {mple} \\[0.5ex] \midrule
    a & a & 10 \\
    a & a & 0.1 \\
    a & a & 0.001 \\ \bottomrule
  \end{tabular}
\end{table*}
\end{document} 

enter image description here

0

Ok, I took Bernhards answer as a started and created two possible solutions for future reference.

enter image description here

I kept the second one with a longer heading, because all columns with rotated headings remain the same width.

\documentclass{article}
\usepackage{siunitx} % To align the numbers later on
\usepackage{booktabs}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\usepackage{multirow, makecell}
\usepackage{rotating}
\settowidth\rotheadsize{Minimal}

\begin{document}
    \begin{table*}[t]
        \newcommand{\rot}[1]{\rotatebox{90}{#1}}
        \newcommand{\multirot}[1]{\multirow{2}{*}[1.5ex]{\rotcell{#1}}}
        \centering
        \ra{1.3}
        \begin{tabular}{@{\,}cccS[table-format=2.3]} \toprule
            \multirot{Short} &
            \multirot{Extended} &
            \multicolumn{2}{c}{Minimal} \\
            \cmidrule{3-4}
            && exa & {mple} \\[0.5ex] \midrule
            a & a & a & 10 \\
            a & a & a & 0.1 \\
            a & a & a & 0.001 \\ \bottomrule
        \end{tabular}
    \end{table*}

    \begin{table*}[t]
        \newcommand{\multirot}[1]{\multirow{2}{*}[1.5ex]{\rotcell{\rlap{#1}}}}
        \centering
        \ra{1.3}
        \begin{tabular}{@{\,}cccS[table-format=2.3]} \toprule
            \multirot{Short} &
            \multirot{Long Example} &
            \multicolumn{2}{c}{Minimal}\rule{0pt}{1.3cm} \\
            \cmidrule{3-4}
            && exa & {mple} \\[0.5ex] \midrule
            a & a & a & 10 \\
            a & a & a & 0.1 \\
            a & a & a & 0.001 \\ \bottomrule
        \end{tabular}
    \end{table*}
\end{document}

I am happy with the optical results (both versions), but I am not happy that I needed \settowidth\rotheadsize{Minimal} for the second table to work although is not related to this.

Feel free to edit my solution or comment it.

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.