I have a macro for absolute value (using \DeclarePairedDelimiter from mathtools):
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
This works great in terms of adjusting the size of fences etc. But the superscript position when I use \abs{x}^2 is too high. See the following:
Any idea if this is a bug or not, or how I can fix it?
Edit: It appears that the above behavior due to the fact that DeclarePairedDelimiter calls \mathclose / makes a subformula. I don't know if this was a design choice or not -- but I would certainly like to know if there is an easy way to work around it.
Here's my code for the above.
\documentclass{minimal}
\usepackage[active,tightpage]{preview}
\usepackage{varwidth,mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\begin{document}
\begin{preview}\begin{varwidth}{360pt}
The superscript following \verb'\abs{x}' is higher than that following \verb'\lvert x\rvert'.
Here is an example:
\begin{center}
\verb'\abs{x}^2 \lvert x\rvert^2' produces $\abs{x}^2 \lvert x\rvert^2$.
\end{center}
The same happens in displayed math:
\begin{equation*}
\abs{x}^2 \lvert x\rvert^2
\end{equation*}
\end{varwidth}\end{preview}
\end{document}
Thanks in advance.


)(as the delimiter pair? Do you mean use the parenthesis in the wrong order? – gi1242 Apr 11 '17 at 21:30\foo{x} - 2comes out wrong as ( has the class of a math open and then the minus following it is unitary not additional (wrong spacing). So when you remove the explicit you need to be sure the right delimiter is of type math closing (rvert is) – daleif Apr 11 '17 at 21:35\mathclose... – daleif Apr 12 '17 at 06:08mathtoolsupdate. I had to splitnostarinto two separate macros. Attempting to changenostarwill now give an error. On the other hand your original problem is now fixed. – daleif May 24 '17 at 08:17