I would like to be able to transpose a tabular
(x
) table like in the following example. It is not necessary to be completely automated, but I don't want to change the data order, which is a painful and stupid. By "not completely automated" I mean that e.g. the headers can be done seperately etc.
Let's see the MWE:
\documentclass{article}
\usepackage{booktabs}
\def\Midrule{\midrule[\heavyrulewidth]}
\begin{document}
\centering
\begin{tabular}{*6c}\toprule
\bfseries Name & Alice & Bob & Chuck & Dave & Eve\\\Midrule
\bfseries Sex & Female & Male & Male & Male & Female\\\midrule
\bfseries Age & 18 & 19 & 20 & 21 & 22\\\bottomrule
\end{tabular}
\bigskip
Which I want to look like
\bigskip
\begin{tabular}{*3c}\toprule
\bfseries Name & \bfseries Sex & \bfseries Age\\\Midrule
Alice & Female & 18\\\midrule
Bob & Male & 19\\\midrule
Chuck & Male & 20\\\midrule
Dave & Male & 21\\\midrule
Eve & Female & 22\\\bottomrule
\end{tabular}
\end{document}
Note: I know that there's an expl3
solution, but I would like to get it without expl3
(mostly because people would might use my code quite often have an old LaTeX installed and I cannot be convincing them to change this).