I'm trying to get my cells in a tabular environment horizontally and vertically centered. MWE to be found at the end.
I tried different orientations: Which does what it is supposed to, as well as m{4cm}
up to complex variations like {\centering}m{4cm}}
or {\centering\arraybackslash}m{4cm}}
, although I must be honest about not knowing what exactly the arraybackslash parameter is supposed to change - I just copied that one from another stackexchange posting.
All texts, including the vertically written one, are supposed to be horizontally and vertically centered. The main part of the table will be pictures with a caption each, the pictures being square. If anybody can tell me how to align the cells, I guess that should work for the cells including pictures as well, does it?
Edit: Updated the code and took a screenshot of the result. \parbox
is used as a placeholder to make a higher cell. The 1,5
stays centered, that is true. Yet, the other text parts seem to be a little off to the top, maybe because of the comma going below the baseline (is that the right word for it?)? Any way of how to lower the overall writing a pt or two? And any way to get the cells to be a tiny bit higher? in the "foobar foobar" cell, the writing scratches the lines at top and bottom. Also, the verticalized text is off-center. Would I have to work with minipages to get that centered?
\documentclass{scrreprt}
\usepackage{array}
\usepackage{multirow}
\usepackage{rotating}
\begin{document}
\begin{table}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{} & \multicolumn{5}{c|}{foo}\\
\cline{3-7}
\multicolumn{2}{|c|}{} & 1,0 & 2,0 & 3,0 & 4,0 & 5,0\\
\hline
\multirow{5}{*}{\rotatebox{90}{bar}} & 1,0 & & & & & \\
\cline{2-7}
& 1,5 & \parbox{2cm}{foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar } & & & & \\
\cline{2-7}
& 2,0 & & & & & \\
\cline{2-7}
& 2,5 & & & & & \\
\cline{2-7}
& 3,0 & & & & & \\
\hline
\end{tabular}
\end{table}
\end{document}