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

  • 2
    Have a look at this-similar question How to make math symbols bigger? – Abhimanyu Arora Jun 8 '12 at 19:35
  • 52
    It is very hard to not post \DoMoreSitups as an answer. – Scribblemacher Jun 8 '12 at 19:36
  • 7
    I'd try hard not to write such formulas in the first place. :) My (professional) opinion is that things like this live only in high school textbooks, and they shouldn't. – egreg Jun 8 '12 at 19:49
  • @AbhimanyuArora: I converted your post to a comment because links to other answers or questions do not qualify as new answers. I hope you don't mind. – Martin Scharrer Jun 8 '12 at 19:54
  • @MartinScharrer:Thanks, shall keep it in mind for next time :-) – Abhimanyu Arora Jun 8 '12 at 20:47

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

\abs{ x-\abs{ x-\abs{x-4}}}

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.

  • 4
    Wow!! Never heard of this before!! There was a question here about parenthesis automatically increasing the more nesting there was -- perhaps this would be applicable there. I think I would add the \delimitershortfall-1sp as part of the \abs macro so that the effect of this localized. – Peter Grill Jun 9 '12 at 5:42
  • @PeterGrill Of course, modify as appropriate. Though if part of the \abs macro, still other delimiters inside the \abs would be affected, so it must be explicitly reset before the #1. In my documents, I like all delimiters to grow ;-) – Stephan Lehmke Jun 9 '12 at 5:47
  • 1
    @StephanLehmke OH THANKS! It's the best solution! I'll use this with braces too! – balping Jun 9 '12 at 16:11

As egreg commented, for this specific case you could also use the optional parameter to the commands declared with DeclarePairedDelimiter and specify the size:


enter image description here


  • The \left|, \right| pair only resize when there is content in between that has different vertical height. In your case, the content all had the same vertical size and hence no resizing took place.

As an alternate, which might be useful in other cases (but does require more work), you could insert a \vphantom{<content with larger vertical size>}.

Here is a solution that inserts a different \vphatom{} between the pairs of \abs to yield:


  • As declared below with DeclarePairedDelimiter, you need to use \abs*{} if you want the delimiter resized based on the vertical size of the content.
  • You can tweak the content of the \VPhamtomL (large), and \VPhantomM (medium), to control the size of the delimiter.


You can use the optional paramater to \verb|\abs|:

With inline math $\abs[\Big]{x-\abs[\big]{x-\abs{x-4}}}$.

or you can insert a \verb|\vphantom{}|
\abs*{\VPhantomL x-\abs*{\VPhantomM x-\abs{x-4}}}

With inline math $\abs*{\VPhantomL x-\abs*{\VPhantomM x-\abs{x-4}}}$.
  • \abs[\Big]{x-\abs[\big]{x-\abs{x-4}}} – egreg Jun 8 '12 at 19:37
  • Thanks! This works! My only problem is that it works only with [ ] and doesn't work with $ $. Can I fix it? – balping Jun 8 '12 at 19:47
  • @balping: Both version seem to work fine in inline math -- see updated MWE. If it does not work for you, please edit the question and provide a MWE that illustrates the problem. – Peter Grill Jun 8 '12 at 20:10
  • @PeterGrill I edited the question – balping Jun 8 '12 at 20:34
  • 1
    @balping: What you posted is a code snippet, and while code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages. Does it work for you if you compile the MWE I provided? Plus have a look at the updated solution that provides a simpler version for this specific equation. – Peter Grill Jun 8 '12 at 20:51

The low-TeX (pun obviously irresistible) solution:

$\Bigl| x - \bigl| x - | x-4 | \bigr| \Bigr|$

enter image description here

  • To whoever down-voted this answer: would you be so kind as to explain your reason for doing so? Did the pun offend you? After all, I'm pretty sure that the code itself is correct -- especially as its output is pretty much identical to that of some of the other answers. – Mico Jun 10 '12 at 21:05
  • I didn't downvote, but I guess it's related to the boldface "automatically" in the question. – Hendrik Vogt Jun 11 '12 at 5:49
  • @HendrikVogt: Thanks for this interesting observation. Well, the bold-facing of one instance of the word "automatically" and the addition of the second instance were applied in an edit that occurred only after I posted my answer. I wonder if the other answer who apparently missed this qualifier also got downvoted... – Mico Jun 11 '12 at 7:33
  • 1
    Ah, yes! One should always check the revisions of the question before downvoting. – Hendrik Vogt Jun 11 '12 at 7:34

You can use nath for automatic scaling of delimiters, but keep in mind that it is incompatible with amsmath (although it does provide its own version of multiline display math environments)


\abs{x \abs{x - \abs{x-4}}}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.