9

Can you explain why the \delimitershortfall cannot be modified inside a align environment?

This is a MWE:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation}
    \delimitershortfall -1pt     \left(\left((x)\right)\right)
\end{equation}

\begin{align}
    \delimitershortfall = -1pt     \left(\left((x)\right)\right)
\end{align}

\end{document}

The output is the following:

Example

In the first case the outer parenthesis are larger, as expected. But in the second case, the new value of \delimitershortfall seems ignored.

7

What happens in align is that every cell is in a group, like {<formula>}, so when the formula is eventually typeset, the change to \delimiterfactor has been forgotten. How to get out of this problem? A workaround would be to execute the change after the group has ended.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\dsf}{\delimitershortfall=-1pt }

\begin{document}
\begin{align}
\aftergroup\dsf \left(\left((x)\right)\right)
\end{align}

\end{document}

enter image description here

The group is visible in lines 2074–2086 of amsmath.sty in the definition of \align@preamble; basically, every cell is typeset in a box using

$\m@th\displaystyle{##}$

where \m@th is used for neutralizing possible settings of \mathsurround and ## stands for the actual contents of the alignment cell. In our case, the input with \aftergroup\dsf is equivalent to use

$\m@th\displaystyle{\left(\left((x)\right)\right)}\dsf$

which causes TeX to use the desired value.

Note that TeX uses only one value for \delimitershortfall, the one current when math mode is exited and the math list is converted into a horizontal list.

See, for example,

\documentclass{article}

\newcommand{\test}{\left(\left((x)\right)\right)}
\newcommand{\testa}{\delimitershortfall=-1pt \test}

\begin{document}

$\displaystyle\test$

$\displaystyle\testa$

$\displaystyle\test\testa$

$\displaystyle\test{\testa}$

\end{document}

enter image description here

As you see, in the third and fourth lines, only one value of \delimitershortfall is used: in the third line -1pt for both tests, in the fourth line the default 5pt for both.

Thus you won't be able to change \delimitershortfall for two parts of the same equation or alignment cell.

| improve this answer | |
  • Thanks ! What I retain is that I cannot use different values \delimitershortfall in the same equation. Also I found confusing that it is the last value of the parameter which is use. – Paul Pichaureau Jun 25 '13 at 8:54
  • @PaulPichaureau The same happens with many parameters for formulas, like \relpenalty. It even happens for assignment of fonts to families (see p. 153 in the TeXbook). You can “cheat“ by using align and <formula1>&<formula2>, where the subformulas can have distinct values of \delimitershortfall (with the above trick). However I don't see why you'd want to do it. – egreg Jun 25 '13 at 8:59
  • I need to define the probability of an event: P((X=5) \cap A) In this case, I would like that the outer parenthesis is slightly larger than the inner one. But I don't want to modify \delimitershortfall for the whole document. – Paul Pichaureau Jun 25 '13 at 17:54
  • @PaulPichaureau P\bigl((X=5\cap A\bigr) is the way to go. Don't use \left or \right for every delimiter. – egreg Jun 25 '13 at 17:58
  • It is what I've done. The interesting point with \left\right is the variation of size... Thanks! – Paul Pichaureau Jun 26 '13 at 5:15
2

use

\begin{align}
    \global\delimitershortfall=-1pt     
    \left(\left((x)\right)\right)
\end{align}

or

{\delimitershortfall=-1pt
\begin{align} 
    \left(\left((x)\right)\right)
\end{align}}

the contents of align is set inside a group

| improve this answer | |
  • I don't want use these solutions, since my goal is to write a macro to change \delimitershortfall inside a formula. See my comment to the preceding answer. Thanks anyway ! – Paul Pichaureau Jun 25 '13 at 8:56

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.