我有一张表格,前两列有数字和旋转的文本。我不明白两个问题:
- 我如何对齐并特别居中文本?对于我包含的图像(所有图像大小相同且为二次方,缩放到适合页面),文本未居中,而是左对齐(第 2 列)并看似随机对齐(第 1 列)。
- 行与行之间的间隙是如何确定的?目前并非所有行都等宽。如果我在第一行的选项中使用较小的字体大小,间隙是否相等?!
我已经尝试过这些选项,但现在我陷入困境,非常感谢您的帮助!
\documentclass[12pt]{article}
\usepackage{array,multirow}
\usepackage{rotating}
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{ccccc}
& & \multicolumn{1}{c}{$\nu=-2\%$} & \multicolumn{1}{c}{$\nu=0\%$} & \multicolumn{1}{c}{$\nu=10\%$}\\
\hline
\parbox[t]{\multirow{2}{*}{\rotatebox[origin=c]{90}{Case A}}} & \rotatebox[origin=left]{90}{Value} &
\includegraphics{Tux.png} & \includegraphics{test.png} & \includegraphics{test.png} \\
& \rotatebox[origin=left]{90}{Value change} & \includegraphics{test.png} & \includegraphics{test.png} & \includegraphics{test.png} \\
\parbox[t]{\multirow{2}{*}{\rotatebox[origin=c]{90}{Case B XYZ}}} & \rotatebox[origin=left]{90}{Value} & \includegraphics{test.png} & \includegraphics{test.png} & \includegraphics{test.png} \\
& \rotatebox[origin=left]{90}{Value change} & \includegraphics{test.png} & \includegraphics{test.png} & \includegraphics{test.png}
\end{tabular}
\caption{Value }
\label{tab:num12}
\end{table}
\end{document}
答案1
这里有一些可能有用的代码。
\documentclass[12pt]{article}
\usepackage{array,multirow}
\usepackage{rotating}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{cc*{3}{C{0.25\textwidth}}}
& & \multicolumn{1}{c}{$\nu=-2\%$} & \multicolumn{1}{c}{$\nu=0\%$} & \multicolumn{1}{c}{$\nu=10\%$}\\
\hline
\multirow{2}{*}{\rotatebox[origin=c]{90}{\parbox[t]{3cm}{\centering Case A}}} & \rotatebox[origin=c]{90}{\parbox[t]{1cm}{Value}} &
\includegraphics[width=1cm]{Tux.png} & \includegraphics[width=3cm]{test.png} & \includegraphics[width=3cm]{test.png} \\
& \rotatebox[origin=c]{90}{\parbox[t]{3cm}{\centering Value change}} & \includegraphics[width=3cm]{test.png} & \includegraphics[width=3cm]{test.png} & \includegraphics[width=3cm]{test.png} \\
\multirow{2}{*}{\rotatebox[origin=c]{90}{\parbox[t]{3cm}{\centering Case B XYZ}}} & \rotatebox[origin=c]{90}{\parbox[t]{1cm}{Value}} & \includegraphics[width=3cm]{test.png} & \includegraphics[width=3cm]{test.png} & \includegraphics[width=3cm]{test.png} \\
& \rotatebox[origin=c]{90}{\parbox[t]{3cm}{\centering Value change}} & \includegraphics[width=3cm]{test.png} & \includegraphics[width=3cm]{test.png} & \includegraphics[width=3cm]{test.png}
\end{tabular}
\caption{Value }
\label{tab:num12}
\end{table}
\end{document}
您必须调整每个的宽度,调整列内\parbox
图像的宽度以满足您的需要。\includegraphics
C{0.25\textwidth}