I don't like the fact that I am required to use \abs*
when I want the vertical line of the absolute value to automatically re-size. I pretty much always want it to re-size, so would like to swap the definition of the two commands, but not sure how to do that. My attempt below is commented out as it does not compile.
I can't think of a case where I'd want to use the version that does not resize, but in case some corner case arises in the future I don't want to loose that. Or, is there a good reason to not to do this swap, and go and change all occurrences of \abs
to \abs*
.
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
%\let\oldabs{\abs}%
%\let\oldabs*{\abs*}%
%\let\abs{oldabs*}%
%\let\abs*{\oldabs}%
\begin{document}
Not sure why this is the default behavior, but it is:
\[\abs{\frac{1}{2}}\]
Would prefer to get this behavior using \textbackslash{abs},
instead of having to use \textbackslash{abs*}.
\[\abs*{\frac{1}{2}}\]
\end{document}
Best Answer
You can redefine
\abs
to call the opposite version of the original command:(The reason that your commented try doesn't work is that technically the
*
is not part of the macro name, but is read by the macro itself using\@ifstar
,\@ifnextchar
or similar commands.)