TeX knows the difference between a "left" and a "right" delimiter (e.g. ( and )) and adjusts spacing accordingly. However, the left and right versions of the delimiter | are the same, so TeX has to guess. Usually TeX guesses correctly, but sometimes it does not. Now, I know that I can use \left and \right to force TeX to consider a given | as a left or right delimiter, however these have the additional effect of changing the size (which maybe I don't want). Even the smallest "big" commands \bigl and \bigr increase the size (albeit only a small amount). Is there a way to make | a left or right delimiter without changing its size at all?

Here is a specific example where I know how to do it, but it isn't a general solution:








The spacing is incorrect on the first line and correct on the second and third lines. The second line works well, but seems a bit hacked to me. The third line isn't good since it would increase the size of the delimiters if the stuff in between were taller (and maybe I don't want that).

(Yes, I know that the reason the spacing is incorrect on the first line is because TeX is treating the second | as the "argument" of \operatorname{A}.)

  • 1
    Note that if you load mathtools, define \abs` with DeclarePairedDelimiter||, you won't have this problem, and it will be shorter to type.
    – Bernard
    Aug 18, 2019 at 22:54
  • @Bernard Cool, thanks, I'll have to check out mathtools! This doesn't solve everything though, since if I have an equation with more than two |, how will it know how to pair them up? Aug 18, 2019 at 23:05
  • Could give more details? It's not very clear to me.
    – Bernard
    Aug 18, 2019 at 23:09
  • 1
    It is always possible to add \mathopen or \mathclose before a symbol to force interpretation of that symbol as an opening atom or a closing atom, respectively. For example, $\mathopen|-x\mathclose| \neq |-x|$.
    – GuM
    Aug 18, 2019 at 23:12
  • @Bernard for example |a|b|c| could be either \left|a\left|b\right|c\right| or \left|a\right|b\left|c\right| Aug 18, 2019 at 23:18

1 Answer 1


If you say, in a math formula, \mathopen|, then the vertical bar will be interpreted as an Open atom (i.e., a left delimiter), yet its size won’t be changed. Similarly, \mathclose| yields a Close atom (i.e., a right delimiter) without any change in size. See also the answer to Exercise 18.14 in The TeXbook. MWE:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.


For example, \( \mathopen|-x\mathclose| \neq |-x| \).


Notwithstanding this, I think that the solution that @Bernard recommends in a comment, that is, to use \DeclarePairedDelimiter, is The Right Thing To Do.

Edit: As Barbara Beeton reminds in her comment, if the problem is confined to single and double vertical bars (and if you prefer not to load the mathtools package, but stick to amsmath), you can also use the four predefined commands \lvert, \rvert, \lVert, and \rVert: l stands for “left”, r for “right”, lowercase v for single bar, uppercase V for double bar.

For a deeper discussion, see, for example, Using \big| and \right| versus \bigr\rvert and \right\rvert (I remember this question because one of the answers was mine!).

  • 3
    In amsmath, \lvert is defined to be \mathopen and \rvert is defined to be \mathclose. Those definitions ensure that the spacing is appropriate for their use as "fences". (Similarly, the double verts are defined as \lVert and \rVert.) Aug 19, 2019 at 1:54
  • @barbarabeeton: Yes, I know, but the question seemed to ask for a general method. I’ve augmented my answer, anyway: thank you for the remark.
    – GuM
    Aug 19, 2019 at 10:53

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.