[Tex/LaTex] Latex: Nice abs

delimitersmath-mode

I have this expression: |x-|x-|x-4|||
Now, every | sign has the same size, but I'd like to make the outward pairs bigger.

Is it possible to do it automatically, or do I have to define the size of each | sign manually? It doesn't work with $\left| \right|$. In this case I have 3 abs signs. But what if there would be for example 12? Is it possible to do it automatically?

This works fine:

\[
\abs*{\VPhantomL x-\abs*{\VPhantomM x-\abs{x-4}}}
\]

This works fine

But the inline version doesn't:

$\abs*{\VPhantomL x-\abs*{\VPhantomM x-\abs{x-4}}}$

enter image description here

Best Answer

TeX also offers a primitive parameter to always make delimiters grow.

\documentclass{article}
\delimitershortfall-1sp
\newcommand\abs[1]{\left|#1\right|}
\begin{document}
\[
\abs{ x-\abs{ x-\abs{x-4}}}
\]
\end{document}

gives the desired output.

enter image description here

\delimitershortfall is meant to measure how much larger the content is allowed to get before the delimiters start growing, but by setting it to a negative value delimiters always grow.