![使用 \rotatebox 和 tabularx 垂直居中单元格](https://linux22.com/image/367659/%E4%BD%BF%E7%94%A8%20%5Crotatebox%20%E5%92%8C%20tabularx%20%E5%9E%82%E7%9B%B4%E5%B1%85%E4%B8%AD%E5%8D%95%E5%85%83%E6%A0%BC.png)
我似乎找不到解决此问题的先前答案:在下表中,我希望左上角单元格中的文本垂直居中,而不是像现在这样在顶部对齐。
\documentclass[a4paper,12pt]{article}
\usepackage[margin=129pt]{geometry}
\usepackage{tabularx,graphics,makecell,mathptmx}
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{document}
\begin{table}[h]
\begin{tabularx}{\textwidth}{|c|X|c|c|}
\hline
\scriptsize \rotatebox{90}{\makecell{No. of\\the line.}} & \tiny\centering
THE COLUMN WITH THE MOST TEXT. & \scriptsize\makecell{A header\\AND\\the
description\\to go\\with it} & \scriptsize\makecell{Another header\\AND\\the
description\\to go\\with it}\\ \hline
O & Some quite long text that will definitetly wrap over three lines&
\makecell{100, 500 Values.\\36 No.} & 36, 24 No.\\ \hline
\end{tabularx}
\end{table}
\end{document}
感谢您的帮助...
答案1
您可以使用固定宽度类型的第一列m
:
\documentclass{article}
\usepackage{tabularx,graphics,makecell}
\renewcommand\tabularxcolumn[1]{ m{#1} }
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{ | >{\centering} m{2em} | X | c | c | }
\hline
\scriptsize \rotatebox{90}{\makecell{No.\ of \\ the line.}}
& \tiny\centering THE COLUMN WITH THE MOST TEXT.
& \scriptsize\makecell{A header \\ AND \\ the description \\ to go \\ with it}
& \scriptsize\makecell{Another header \\ AND \\ the description \\ to go \\ with it} \\
\hline
O & Some quite long text that will definitely wrap over three lines
& \makecell{100, 500 Values. \\ 36 No.} & 36, 24 No. \\
\hline
\end{tabularx}
\end{document}