有人可以解釋一下這個表中的間距嗎?
- 為什麼某些旋轉框具有由基線分隔的 0、1、2 或 3 個字元?
- 為什麼某些框中有前導/尾隨空格?
我不明白是什麼機制控制這些東西。
\documentclass{article}
\usepackage{array}
\usepackage{rotating}
\renewcommand{\arraystretch}{0}%
\setlength{\fboxsep}{0pt}%
\newcommand{\testBox}[2]{%
\setlength{\fboxsep}{0pt}%
\fboxrule=.1pt%
\fbox{%
\rotatebox[origin=#1]{#2}%
{#1 #2}%
}%
}
\begin{document}
\noindent
\tt
\begin{tabular}%
{@{}|llll|llll|llll|@{}}%
\hline%
\rlap{\rule{211pt}{.1pt}}%
\testBox{rt}{090}&%
\testBox{rb}{090}&%
\testBox{rt}{270}&%
\testBox{rb}{270}&%
%
\testBox{ct}{090}&%
\testBox{cb}{090}&%
\testBox{ct}{270}&%
\testBox{cb}{270}&%
%
\testBox{lt}{090}&%
\testBox{lb}{090}&%
\testBox{lt}{270}&%
\testBox{lb}{270}\\%
\hline%
\end{tabular}
\end{document}
答案1
正如我評論的那樣,這對我來說是有道理的。指定的旋轉原點,例如[原始]框的右下角,在旋轉之前和之後保持在相同的垂直位置。唯一的怪癖是,如果旋轉的框最終會在基線和框之間出現間隙(例如,右上 270),則該框將延伸到基線,而無需重新定位文字。
為了說明我的意思,我對您的 MWE 進行了一些調整,以覆蓋未旋轉和旋轉的框框,其中旋轉點在前圖像和後圖像中都重疊。
\documentclass{article}
\usepackage{array}
\usepackage{rotating}
\renewcommand{\arraystretch}{0}%
\setlength{\fboxsep}{0pt}%
\newcommand{\testBox}[3][0]{%
\setlength{\fboxsep}{0pt}%
\fboxrule=.1pt%
\setbox0=\hbox{\fbox{#2 #3}}%
\fbox{%
{#2 #3}%
}\kern-\wd0%
\rlap{\makebox[\dimexpr\wd0+#1\ht0][r]{\fbox{%
\rotatebox[origin=#2]{#3}%
{#2 #3}%
}}}%
\kern\wd0%
}
\begin{document}
\noindent
\tt
\leavevmode\rlap{\rule{211pt}{.1pt}}
\testBox[1]{rt}{090}\quad
\testBox{rb}{090}\quad
\testBox{rt}{270}\quad
\testBox[1]{rb}{270}
\renewcommand{\testBox}[3][0]{%
\setlength{\fboxsep}{0pt}%
\fboxrule=.1pt%
\setbox0=\hbox{\fbox{#2 #3}}%
\fbox{%
{#2 #3}%
}\kern-\wd0%
\rlap{\makebox[\dimexpr\wd0+#1\ht0][c]{\fbox{%
\rotatebox[origin=#2]{#3}%
{#2 #3}%
}}}%
\kern\wd0%
}
\leavevmode\rlap{\rule{211pt}{.1pt}}
\testBox[1]{ct}{090}\quad
\testBox[-1]{cb}{090}\quad
\testBox[-1]{ct}{270}\quad
\testBox[1]{cb}{270}
\renewcommand{\testBox}[3][0]{%
\setlength{\fboxsep}{0pt}%
\fboxrule=.1pt%
\setbox0=\hbox{\fbox{#2 #3}}%
\fbox{%
{#2 #3}%
}\kern-\dimexpr\wd0+#1\ht0\relax%
\rlap{\makebox[\wd0][l]{\fbox{%
\rotatebox[origin=#2]{#3}%
{#2 #3}%
}}}%
\kern+\dimexpr\wd0+#1\ht0\relax%%
}
\leavevmode\rlap{\rule{211pt}{.1pt}}
\testBox{lt}{090}\quad
\testBox[1]{lb}{090}\quad
\testBox[1]{lt}{270}\quad
\testBox{lb}{270}
\end{document}
為了澄清起見,我在旋轉原點手動添加了(在 LaTeX 之外)紅色標記。