# Why does using \biggl <stuff> \biggl not throw an error?

I consider myself a recovering user of \left...\right and stumbled onto this issue today. I have a \virtualparens command that puts light gray parentheses around its argument. I can provide optional delimiter sizes (\big, \bigg, etc.). I noticed that when I provide \biggl no error occurs and I don't understand why. I would think \biggl requires a paired \biggr but I think this answer (https://tex.stackexchange.com/a/295041/218142) explains why. I don't fully understand the argument there, but it appears that \biggl merely indicates sizing information and doesn't "know" what the delimiter is. Is that correct?

Also, if there is a better way to to handle the optional sizing arguments I am open to using it.

Here is my MWE:

% !TEX TS-program = lualatexmk
% !TEX encoding = UTF-8 Unicode

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}

\NewDocumentCommand{\virtualparens}{ O{} m }{%
\textcolor{lightgray}{#1(}#2\textcolor{lightgray}{#1)}
}%

\begin{document}
$\virtualparens[\biggl]{-G\frac{m_1 m_2}{r}}$
\end{document}


Here is the output:

• \biggl and \biggr are not defined as a linked pair, so they can be used to match sizes of fences where \left and \right would result in an error, such as in different cells of a table, or on opposite sides of an aligned relation. Therefore the user has to be careful to specify the correct directionality for each such command on input. Dec 21 '20 at 1:57
• Is what I'm doing ill-advised? If there's a better way I'm open to learning it. Dec 21 '20 at 2:14
• Yes, it is not correct, therefore, ill advised. Dec 21 '20 at 2:23
• The minus sign in front of the G is being set as binary subtraction, not as a unary minus. The same happens in the first two of the four examples in @egreg's answer. Dec 21 '20 at 19:53

You want to use l version on the left and r version on the right. I modified your syntax a bit to achieve it. Using two left versions does not throw an error, but it could mess up the natural spacings between surrounding material.

However, there is a drawback to using this paired approach...you can't naturally break up the argument across a linebreak, which one can do if he individually specifies the \biggl( and \biggr). So, you have to weigh the advantages and disadvantages.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}

\NewDocumentCommand{\virtualparens}{ O{} m }{%
\textcolor{lightgray}{\csname#1l\endcsname(}#2
\textcolor{lightgray}{\csname#1r\endcsname)}
}%

\begin{document}
$\virtualparens[bigg]{-G\frac{m_1 m_2}{r}}$
\end{document}


I'd prefer a syntax à la mathtools, where you just specify the size with \big \Big \bigg or \Bigg. In any case you should specify the type of the objects you build, because \textcolor hides it.

\NewDocumentCommand{\virtualparens}{ O{} m }{%
\mathopen{\textcolor{lightgray}{#1(}}% opening fence
#2% contents
\mathclose{\textcolor{lightgray}{#1)}}% closing fence
}


Here's the full example, with comparisons.

\documentclass[twocolumn]{article}
\usepackage{amsmath}
\usepackage{xcolor}

\NewDocumentCommand{\virtualparens}{ O{} m }{%
\mathopen{\textcolor{lightgray}{#1(}}#2\mathclose{\textcolor{lightgray}{#1)}}%
}

%%% for comparison
\NewDocumentCommand{\wrongvirtualparens}{ O{} m }{% your definition
\textcolor{lightgray}{#1(}#2\textcolor{lightgray}{#1)}%
}
\NewDocumentCommand{\alsowrongvirtualparens}{ O{} m }{% Steven's definition
\textcolor{lightgray}{\csname#1l\endcsname(}#2%
\textcolor{lightgray}{\csname#1r\endcsname)}%
}
%%%

\begin{document}

\begin{gather}
\sin\wrongvirtualparens[\bigg]{-G\frac{m_1 m_2}{r}} \\
\sin\alsowrongvirtualparens[bigg]{-G\frac{m_1 m_2}{r}} \\
\sin\virtualparens[\bigg]{-G\frac{m_1 m_2}{r}} \\
\sin\biggl(-G\frac{m_1 m_2}{r}\biggr)
\end{gather}

\end{document}


Do you see the difference?

• I must admit the only differences I see are the spacing between sin and the left parenthesis and the overall width of the distance between the parentheses. Is that what I'm supposed to see? Do \mathopen and \mathclose do the same thing as appending l and r to the sizes? Dec 21 '20 at 11:25
• @LaTeXereXeTaL That's the difference to be noted. The definition of \Biggl( is essentially \mathopen{\Bigg(} and similarly for \Biggr. Dec 21 '20 at 11:33
• Maybe it’s obvious, but I don’t see it. Why does Steven’s definition give wrong spacing albeit using \biggl and \biggr? Dec 21 '20 at 15:49
• @EuklidAlexandria Because \Biggl and \Biggr are hidden inside \textcolor. Dec 21 '20 at 15:50
• Ah, ok. Thanks! Dec 21 '20 at 15:52

You can keep the decision about parentheses size to \left...\right primitives:

\def\virtualparens#1#2#3{\mathopen{}\color{lightgray}\left#1
\color{black}#2\color{lightgray}\right#3\color{black}\mathclose{}}

$$\sin \virtualparens ({-G {m_1 m_2\over r}}) x$$
compare with:
$$\sin \Bigl( -G {m_1 m_2\over r} \Bigr) x$$

• Thanks for helping me understand more about \mathopen and \mathclose. Dec 25 '20 at 11:51