假设我有这个平均能量损失将单位右对齐:
\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\makeatletter
\providecommand\add@text{}
\newcommand\tagaddtext[1]{%
\gdef\add@text{#1\gdef\add@text{}}}%
\renewcommand\tagform@[1]{%
\maketag@@@{\llap{\add@text\qquad}(\ignorespaces#1\unskip\@@italiccorr)}%
}
\makeatother
\begin{document}
Unfortunately the bracket does not fit to the height of the unit.
The units exponent is already positioned above the upper edge of the bracket. :-(
\begin{equation}
A = B + C \tagaddtext{[\si{\square\meter}]}
\end{equation}
How can I change this behavior?
\end{document}
结果截图:
眼中钉的描述:
可以看到,相应的括号不会自动适应单位的高度。指数高于括号。
我怎样才能改变这种行为,以便支架自动调整到单位最高/最低点的高度?
答案1
flalign
我建议使用以下命令来解决问题\addunit
:
\documentclass{article}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\usepackage{mathtools}
\usepackage{siunitx}
\newcommand{\addunit}[1]{\mathllap{\left[\si{#1}\right]\quad}}
\begin{document}
\begin{flalign}
& & A & = B + C & & \addunit{\square\meter}
\end{flalign}
\end{document}