Superscripts too high after macros defined with \DeclarePairedDelimiter
This is a design choice in mathtools. Not all users know \rvert
is better than |
, so we help them, also it helps us if someone wanted to use )(
as the delimiter pair. Short of repeating the fenced material in a \vpahntom
after the fence, I don't know a better method.
But, in this case, as you are using the proper left and right fences, there is an out:
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\reDeclarePairedDelimiterInnerWrapper{\abs}{nostar}{#1#2#3}
DeclarePairedDelimiter
produces a subformula. EDIT as @Daleif suggested this is due to DeclarePairedDelimiter
to call \mathclose
on the right brace.
This is equivalent of using braces ({
and }
), which also produce math subformulas, which can cause alignment issues sometimes. (Incidentally, that's why you don't usually have adjacent braces {}
) in math mode.
See following examples:
\documentclass{minimal}
\usepackage{amsmath,mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\begin{document}
\begin{gather}
\left|x\right|^2 \lvert x\rvert^2 \\
\abs{x}^{2} \lvert x\rvert^{2} \\
{|x|}^{2} \lvert x\rvert^{2}
\end{gather}
\end{document}
Producing:
You can clearly see that the second example (which is your text) and the subformula produce the same alignment.
It seems that the exponent is applied to the whole subformula, and not carried as the exponent of your variable.