3

Assumed I have this MWE to align the units off right:

\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}

Screenshot of the result:

Screenshot of the issue


Description of the eyesore:

As you can see the corresponding brackets do not automatically adapt to the height of the unit. The exponent is higher than the bracket.

How can I change that behavior, so that the brackets will automatically adjust to the height of the highest/lowest point of the unit?

Dave
  • 3,758

1 Answers1

2

I propose for what it's worth a work-around with flalign and an \addunit command:

\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} 

enter image description here

Bernard
  • 271,350
  • Thanks a lot! So I should stop using \begin{equation}blabla\end{equation}? Or better use \begin{flalign} inside of \begin{equation}? – Dave Dec 06 '18 at 21:46
  • If you want to use   \addunit, yes, use flalign in the place of equationflalign can't be used inside another math environment, and flaligned does not exist. – Bernard Dec 06 '18 at 21:51