3

Consider this minimal example:

\documentclass{report}
\delimitershortfall=0pt
\delimiterfactor=1100
\begin{document}
$$\left(\left(\left(\left(x\right)\right)\right)\right)$$
\end{document}

which renders with pdflatex to:

enter image description here

As \delimitershortfall is zero and \delimiterfactor begin over 1000 (where 1000 means do not change calculated delimiter size) I would assume that the delimiters (=parenthesis in this case) get larger by the same factor every nested level. I have added the red lines above to indicate that this is not the case. The factor by which parenthesis grow is not constant. Digging into TeXBook Appendix G Rule 19:

\rule 19. If the math list begins and ends with boundary items, compute
the maximum height~$h$ and depth~$d$ of the boxes in the translation of
the math list that was made on the first pass, taking into account the
fact that some boxes may be raised or lowered. Let $a=\sigma_{22}$ be the
axis height, and let $\delta=\max(h-a,d+a)$ be the amount by which the
formula extends away from the axis. Replace the boundary items by
delimiters whose height plus depth is at least $\max(\lfloor\delta/500\rfloor
f,2\delta-l)$, where $f$ is the ^|\delimiterfactor|
and $l$ is the ^|\delimitershortfall|.  Shift the delimiters up or down so
that they are vertically centered with respect to the axis. Change the left
boundary item to an Open atom and the right boundary item to
a Close atom. The entire resulting list now becomes the nucleus of an
Inner atom. \ (All of the calculations in this step are done with
$C$ equal to the starting style of the math list; style items in the
middle of the list do not affect the style of the right boundary item.)

That confirms my assumption -- up to a certain degree: In the example there should be an increase of 1100/1000 spread evenly to height and depth as the delimiter is vertically centered around axis and as axis is at the point where height and depth meet, according to page 150:

If you look closely at the examples of math typesetting in this chapter, you will notice that large parentheses and brackets are symmetric with respect to an invisible horizontal line that runs a little bit above the baseline; when a delimiter gets larger, its height and depth both grow by the same amount. This horizontal line is called the axis of the formula;

Well, the assumption is confirmed except for the words "at least" above. TeXBook says the delimiter grows "at least" max( delta / 1000 * \delimiterfactor, delta - \delimitershortfall). That, to me, makes rule 19 under specified as it is not stated how big at least is and the example shows that it is neither zero, nor constant across nested levels, at least for pdfTeX implementation.

So my question is: Where (in TeXBook or elsewhere) is that "at least" specified and is there a way to change any TeX primitive configuration / implementation to control that amount, ideally setting it to zero?

(It seems there are factors which alter the amount of at least. E.g. specifying the document class to use 12pt or including the amsmath package alters the amount of at least.)

EDIT: Thanks for @david-carlisle and @egreg for pointing out in detail that and how, according to your understanding, TeX requests a certain character (at what font size?) by the cm font and does not further scale that character to the user desired size.

To clarify: The extra amount of space in my question title is referring to the additional height/space between the user desired size of the delimiter calculated by the max(..) term and the height of the delimiter shape TeX will render, which, in rule 19 is described by the words "at least". I actually hoped that this was clear. So yes, according to your answer @egreg this extra space exists and comes from the fact that TeX in that case does not scale the delimiter as needed. The wording "Replace the current boundary items with delimiters whose height...", however, do not prohibit any scaling. In fact, I would have never assumed your described implementation by reading that wording. It is very clever though, to have different delimiter characters with different aspect ratios, such that a higher delimiter is not growing that large in width.

The gold standard of a \left and \right implementation in my point of view, however would be to select the next largest character the font delivers and scale that down to exactly match the max(...) value. The current implementation leads to unevenly growing nested delimiters, which does not look good IMHO. Here is another example at 12pt where it is even worse:

enter image description here

Comparing both images, one can see that even worse the amount of "at least" is different for the same nesting level of a different base font size.

2
  • The first four levels use specific characters; only from the fifth on the parenthesis ii built with the top, the bottom and a repeater in the middle.
    – egreg
    Dec 1 '21 at 13:55
  • basically tex requests that size but the font returns whatever size it has, tex never scales the result, so the size increases in discrete jumps Dec 1 '21 at 14:28
2

Look at the \delcode for the closed parenthesis:

\delcode`\)="029301

When \right) is used, TeX looks at the first half of the \delcode. If the character (family "0 and slot "29) fits into what's specified by \delimitershortfall and \delimiterfactor, TeX uses that character.

The specification is as follows. TeX determines the height h and depth d of the material to enclose; then it considers δ as the maximum between h − a and d + a (where a is the height of the math axis). The delimiter's height plus depth must be at least

max(⌊δ/500⌋ f, 2δ − l)

where f is the value of \delimiterfactor and l is the value of \delimitershortfall. The chosen delimiter will be moved up or down in such a way that its geometric center lies on the formula axis.

Otherwise it tries the second half (family "3, slot "01); if it fits, then that character is used. Otherwise TeX looks whether the metric for this character have a NEXTLARGER specification and indeed we find (from tftopl cmex10)

(CHARACTER O 1
   (CHARWD R 0.458336)
   (CHARHT R 0.039999)
   (CHARDP R 1.160013)
   (NEXTLARGER O 21)
   )

(the characters are numbered in octal). Yes, there is; so the lookup is with the character in slot '21 that has

(CHARACTER O 21
   (CHARWD R 0.597224)
   (CHARHT R 0.039999)
   (CHARDP R 1.760019)
   (NEXTLARGER O 23)
   )

and TeX can go further if needed

(CHARACTER O 23
   (CHARWD R 0.7361145)
   (CHARHT R 0.039999)
   (CHARDP R 2.360025)
   (NEXTLARGER O 41)
   )
(CHARACTER O 41
   (CHARWD R 0.79167)
   (CHARHT R 0.039999)
   (CHARDP R 2.9600315)
   (NEXTLARGER O 61)
   )

Now something different happens, because character in slot '61 has

(CHARACTER O 61
   (CHARWD R 0.875003)
   (CHARHT R 0.039999)
   (CHARDP R 1.760019)
   (VARCHAR
      (TOP O 61)
      (BOT O 101)
      (REP O 103)
      )
   )

At this stage, if the previous attempts don't give a suitable result, the parenthesis of the appropriate size is built with the top, bottom and repeater as specified.

So there is no “extra amount of vertical space” to be described, because there isn't any. And there is no scaling. The sizes of the series of parentheses in cmex10 increase linearly; why the ratio of the height of the parenthesis in cmr10 and the initial one in cmex10 does not agree with that linear increase should be asked to Knuth.

17
  • See EDIT of my question for further clarification of "extra amount" wording. Thnx for pointing out in detail how you assume tex chooses the shape to render. I, however, asked for two things in my question: 1) Where (ideally) in TexBook is that extra height the delimiter renders specified. And 2) Is there a way to change the behaviour that that extra height is greater than zero. For an accepted answer, I would need an answer to point 2) as well as references in TexBook for the behavior you described and also the fact that after selecting a character, only discrete steps of scaling are done.
    – Mart
    Dec 2 '21 at 9:28
  • or, however you see it, that no scaling is done after a certain character at a certain font size is selected (ignoring the scaling done by selecting the font size itself)
    – Mart
    Dec 2 '21 at 9:45
  • @Mart That selection with NEXTLARGER is just hinted at in the TeXbook, see rule 19 on page 446. You need to go to the Metafontbook for the real rules. See also pages 191–192 of TeX by Topic. About the “extra height”, I can't understand what you mean: there is no scaling.
    – egreg
    Dec 2 '21 at 11:02
  • Rule 19 is posted in my question, no NEXTLARGER is not mentioned there, nor is any section of any other document. Thnx alot for the reference to pages 191-192 of TeX by Topic which basically backs your explanation. Could you please mention this reference in your actual answer? Sure there is always scaling from the coordinate system the characters vectors are stored in the font file up to the coordinate system the characters are stored in the pdf file (would be surpised if they are the same), or even the coordinate system of the display the characters are rendered.
    – Mart
    Dec 9 '21 at 9:46
  • regarding the extra height: I do not know how to explain it better than in my question: "To clarify: The extra amount of space in my question title is referring to the additional height/space between the user desired size of the delimiter calculated by the max(..) term and the height of the delimiter shape TeX will render, which, in rule 19 is described by the words "at least". " Please be more specific in what you do not understand here. That there is no additional scaling after scaling done by selection font size is the problem and causes the "at least" in Rule 19, to be greater than 0
    – Mart
    Dec 9 '21 at 9:46

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.