我在一个tabular
环境中有一些单元格,其中的文本旋转了 90 度。我不清楚如何让文本“顶部”对齐,即在旋转文本的情况下右对齐。下面是当前正在生成的内容以及生成它的 TeX。我希望看到的是单元格中的所有文本,甚至沿着单元格的顶部,沿着底部参差不齐。
\newcolumntype{R}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{0.32in}}
% other irrelevant preamble code
\begin{center}
{\tabcolsep=0pt\def\arraystretch{1.3}
\begin{tabular}{ | R | R | R | R | R | R | R | R | R | R | }
\multicolumn{10}{c}{\HUGE January}\bigskip\\
\hline
\rotatebox{90} {~~~~~~~~Wednesday, January 1~~} & \rotatebox{90} {~~~~~~~~Thursday, January 2~~} & \rotatebox{90} {~~~~~~~~Friday, January 3~~} & \rotatebox{90} {~~~~~~~~Saturday, January 4~~} & \rotatebox{90} {~~~~~~~~Sunday, January 5~~} & \rotatebox{90} {~~~~~~~~Monday, January 6~~} & \rotatebox{90} {~~~~~~~~Tuesday, January 7~~} & \rotatebox{90} {~~~~~~~~Wednesday, January 8~~} & \rotatebox{90} {~~~~~~~~Thursday, January 9~~} & \rotatebox{90} {~~~~~~~~Friday, January 10~~} \\ \hline
\end{tabular}}
\end{center}
答案1
使用包rotating
和makecell
\documentclass{article}
\usepackage{rotating}
\usepackage{makecell}
\newcolumntype{C}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{0.32in}}
\begin{document}
\begin{center}
\setlength{\tabcolsep}{0pt}% Remove space between tabular columns
\renewcommand{\arraystretch}{1.3}% Stretch rows vertically
\renewcommand\theadfont{\normalsize}
\settowidth\rotheadsize{\theadfont Wednesday, January 22}
\begin{tabular}{ | *{10}{C |} }
\multicolumn{10}{c}{\Huge January} \bigskip\\
\hline
\rothead{\hfill Wednesday, January 1} &
\rothead{\hfill Thursday, January 2} &
\rothead{\hfill Friday, January 3} &
\rothead{\hfill Saturday, January 4} &
\rothead{\hfill Sunday, January 5} &
\rothead{\hfill Monday, January 6} &
\rothead{\hfill Tuesday, January 7} &
\rothead{\hfill Wednesday, January 8} &
\rothead{\hfill Thursday, January 9} &
\rothead{\hfill Friday, January 10} \\
\hline
\end{tabular}
\end{center}
\end{document}
答案2
您需要指定旋转原点;在这种情况下,这origin=r
似乎就是您所追求的:
\documentclass{article}
\usepackage{graphicx,array}
\begin{document}
\newcolumntype{R}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{0.32in}}
% other irrelevant preamble code
\begin{center}
\setlength{\tabcolsep}{0pt}% Remove space between tabular columns
\renewcommand{\arraystretch}{1.3}% Stretch rows vertically
\begin{tabular}{ | *{10}{R |} }
\multicolumn{10}{c}{\Huge January} \bigskip\\
\hline
\rotatebox[origin=r]{90}{~~~~~~~~Wednesday, January 1~~} &
\rotatebox[origin=r]{90}{~~~~~~~~Thursday, January 2~~} &
\rotatebox[origin=r]{90}{~~~~~~~~Friday, January 3~~} &
\rotatebox[origin=r]{90}{~~~~~~~~Saturday, January 4~~} &
\rotatebox[origin=r]{90}{~~~~~~~~Sunday, January 5~~} &
\rotatebox[origin=r]{90}{~~~~~~~~Monday, January 6~~} &
\rotatebox[origin=r]{90}{~~~~~~~~Tuesday, January 7~~} &
\rotatebox[origin=r]{90}{~~~~~~~~Wednesday, January 8~~} &
\rotatebox[origin=r]{90}{~~~~~~~~Thursday, January 9~~} &
\rotatebox[origin=r]{90}{~~~~~~~~Friday, January 10~~} \\
\hline
\end{tabular}
\end{center}
\end{document}