Hacker News new | ask | show | jobs
by jordigh 3239 days ago
Nothing here attracts me away from pure LaTeX that much except two things: (1) built-in symbol recognition (I still rely on http://detexify.kirelabs.org/symbols.html but it's rare for me to have to look something up) and (2) auto-resizing delimiters.

Can any TeX experts explain to me why delimiters don't resize by default? Why do we need to insert so many \left and \right commands?

3 comments

Not a typesetting expert but to my eye the auto-sized delimiters are bad more often than they are good. The people that I look to for expert advice on this seem to me to agree. I'll mention https://tex.stackexchange.com/questions/1742/automatic-left-... and https://tex.stackexchange.com/questions/31526/macro-for-left... but more googling will get you more opinions. :-)

Edit: Here is what Knuth says (p 148 in my copy)

At this point you are probably wondering why you should bother learning about |\bigl| and |\bigr| and their relatives, when |\left| and |\right| are there to calculate sizes for you automatically. Well, it's true that |\left| and |\right| are quite handy, but there are at least three situations in which you will want to use your own wisdom when selecting the proper delimiter size: \ (1)~Sometimes |\left| and |\right| choose a smaller delimiter than you want. For example, we used |\bigl| and |\bigr| to produce $\bigl\vert\vert x\vert- \vert y\vert\bigr\vert$ in one of the previous illustrations; |\left| and |\right| don't make things any bigger than necessary, so `|$\left|\||\left|\||x\right|\||-\left|\||y\right|\||\right|\||$|' yields only `$\left\vert \left\vert x\right\vert -\left\vert y\right\vert \right\vert$'. \ (2)~Sometimes |\left| and |\right| choose a larger delimiter than you want. This happens most frequently when they enclose a large operator in a display; for example, compare the following two formulas: \beginlongdisplaymathdemo \noalign{\vskip 6pt} |$$\left( \sum_{k=1}^n A_k \right)$$|&\left( \sum_{k=1}^n A_k \right)\cr \noalign{\vskip 3pt} |$$\biggl( \sum_{k=1}^n A_k \biggr)$$|&\biggl( \sum_{k=1}^n A_k \biggr)\cr \endmathdemo The rules of\/ |\left| and |\right| cause them to enclose the ^|\sum| together with its ^{limits}, but in special cases like this it looks better to let the limits hang out a~bit; |\bigg| delimiters are better here. \ (3)~Sometimes you need to break a huge displayed formula into two or more separate lines, and you want to make sure that its opening and closing delimiters have the same size; but you can't use |\left| on the first line and |\right| on the last, since |\left| and |\right| must occur in pairs. The solution is to use |\Biggl| (say) on the first line and |\Biggr| on the last.

Check out the nath package

... de­lim­iters adapt their size to the ma­te­rial en­closed, ren­der­ing \left and \right al­most ob­so­lete.

https://www.ctan.org/pkg/nath

I am not an expert, but my impression was always that the way it is makes things general, orthogonal, and easy to explain and reason about (if cumbersome to use).

If \left and \right were automatic, then whenever you needed something less-but-often-still common, like [0,1) open intervals, or physics <bra|ket> notation, that would require kludges.

Whether or not it is a smart decision is a different argument.

Why not make auto-sizing the default and manual size control the exceptional case? It's already like this "in reality," I just wish the language would follow that.

I use templates so my editor shims in the above anyway, at the cost of lots of noise.