有没有一种简单的方法(也许是通过mathtools
对齐正常下标提供的)?
我知道我可以手动完成此操作\vphantom
,但我正在寻找更好的方法。
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\noindent Looks pretty bad:
\[
T_\theta T_\theta^{-1} = \begin{pmatrix*}[r]
\cos\theta & -\sin\theta\\
\sin\theta & \cos\theta
\end{pmatrix*}\begin{pmatrix*}[r]
\cos\theta & \sin\theta\\
-\sin\theta & \cos\theta
\end{pmatrix*}
= \begin{pmatrix}1&0\\0&1\end{pmatrix} = I
\]
adjustlimits doesn't work:
\[
\adjustlimits T_\theta T_\theta^{-1} = \begin{pmatrix*}[r]
\cos\theta & -\sin\theta\\
\sin\theta & \cos\theta
\end{pmatrix*}\begin{pmatrix*}[r]
\cos\theta & \sin\theta\\
-\sin\theta & \cos\theta
\end{pmatrix*}
= \begin{pmatrix}1&0\\0&1\end{pmatrix} = I
\]
vphantom does work
\[
T_\theta^{\vphantom{-1}} T_\theta^{-1} = \begin{pmatrix*}[r]
\cos\theta & -\sin\theta\\
\sin\theta & \cos\theta
\end{pmatrix*}\begin{pmatrix*}[r]
\cos\theta & \sin\theta\\
-\sin\theta & \cos\theta
\end{pmatrix*}
= \begin{pmatrix}1&0\\0&1\end{pmatrix} = I
\]
\end{document}
答案1
尝试\mathstrut
,它恰好是\vphantom(
,并且始终将下标放在内{}
。
编辑:大师说这个\vphantom{-}
概念更好,为了方便,我创建了一个新的命令:
\documentclass{article}
\usepackage{mathtools}
\newcommand{\egreg}{\vphantom{-}}% new command for alignment adjustment (you can choose another name, of course!)
\begin{document}
\noindent egreg's version:
\[
T_{\theta}^{\egreg}\, T_{\theta}^{-1} = \begin{pmatrix*}[r] % I've added also a little space \,
\cos\theta & -\sin\theta\\
\sin\theta & \cos\theta
\end{pmatrix*}\begin{pmatrix*}[r]
\cos\theta & \sin\theta\\
-\sin\theta & \cos\theta
\end{pmatrix*}
= \begin{pmatrix}1&0\\0&1\end{pmatrix} = I
\]
\noindent My previous version:
\[
T_{\theta}^{\mathstrut}\, T_{\theta}^{-1} = \begin{pmatrix*}[r] % I've added also a little space \,
\cos\theta & -\sin\theta\\
\sin\theta & \cos\theta
\end{pmatrix*}\begin{pmatrix*}[r]
\cos\theta & \sin\theta\\
-\sin\theta & \cos\theta
\end{pmatrix*}
= \begin{pmatrix}1&0\\0&1\end{pmatrix} = I
\]
\end{document}
答案2
您可以相应地调整字体尺寸。
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
% Regular subscript positon
\fontdimen16\textfont2=\dimexpr
\fontdimen17\textfont2 % subscript position in presence of superscript
+ \fontdimen19\textfont2 % subscript drop in presence of superscript
\relax
T_\theta T_\theta^{-1} = \begin{pmatrix*}[r]
\cos\theta & -\sin\theta\\
\sin\theta & \cos\theta
\end{pmatrix*}\begin{pmatrix*}[r]
\cos\theta & \sin\theta\\
-\sin\theta & \cos\theta
\end{pmatrix*}
= \begin{pmatrix}1&0\\0&1\end{pmatrix} = I
\]
\end{document}
答案3
另一个手动解决方法是使用括号将下标与上标分开:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\noindent
\[
T_{\theta}\, {T_{\theta}}^{-1} = \begin{pmatrix*}[r] % I've also added also a little space \,
\cos\theta & -\sin\theta\\
\sin\theta & \cos\theta
\end{pmatrix*}\begin{pmatrix*}[r]
\cos\theta & \sin\theta\\
-\sin\theta & \cos\theta
\end{pmatrix*}
= \begin{pmatrix}1&0\\0&1\end{pmatrix} = I
\]
\end{document}
最终输出结果中,下标已经对齐,与第一个解法稍有不同: