0

I noticed that the automatic adjustment size for parentheses by use of \left(...\right) "fails" in two cases I use a lot:

Case one:

When a upper index is set as \text{...}. I typeset label-indices as \text{...} (for example $y^\text{p}$ for predicted y-values) since this is how they are usually formatted in the physics context to distinguish labels from mathematical indices.

I marked the upper and lower ends of the parentheses for just brackets (green), \left(...\right) (red) and \left(...^\text{...}\right) (blue). Note that the bracket size for the latter is adjusted, but not to the right size. enter image description here

Case two:

When having large equations in parentheses spanning multiple lines, I break the lines with

\begin{align}
    \left[ ... \right. \\
    \left. ... \right]
\end{align}

In this case, the size of the square brackets is not adjusted synchronously. I understand that this is because the size is determined within a line instead of within the \left[...\right] pair.

Question:

The question connecting this two cases is: Is it possible to access the logic of how the sizes are determined? (Another use case is to increase nested brackets automatically).

Example:

enter image description here

MWE:

\documentclass[preview]{standalone}

\usepackage{amsmath}
\usepackage{listings}
\lstset{language=TeX,
    basicstyle=\footnotesize\ttfamily,
}
\begin{document}

Case one:
\begin{align*}
    (y_i^f) + \left(y_i^f\right) + \left(y_i^\text{f}\right)
\end{align*}


Case two:
\begin{align*}
    y=& \left[ \frac{x}{c} \right. \\
    &+\left. f(x)\right]
\end{align*}
\end{document} 
7
  • 1
    Not directly related but using \text{f} is wrong markup (and slow) it will pick up whatever font is current outside the math, better to use ^{\mathrm{f}} – David Carlisle Dec 21 '20 at 15:52
  • Anyway, it's better, typographically, to adjust the delimiters size by hand, with \bigl... \bigr, \Bigr ... \Bigr and the like. – Bernard Dec 21 '20 at 15:53
  • It is better not to ask two unrelated questions in the same post, the align question is a FAQ, and duplicate) (use \bigl( and \bigr), I'll find a link to the standard answer. – David Carlisle Dec 21 '20 at 15:54
  • The code for the first question is part of the example, I know I can adjust size by hand, but am interested in adjusting \left(...\right) to work correctly. Thank you for the comment with ^{\mathrm{f}} (although it produces the same result here) – audiophiel Dec 21 '20 at 16:03
1

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\[
\left(y^f_i\right) \left(y^{\text{f}}_i\right) \left(y^{\mathrm{f}}_i\right) 
\]
\end{document}

The italic f is raised higher to keep it away from the subscript so simply forces TeX to choose an overlarge delimiter size. This demonstrates why it is usually better to choose the size manually with a simple ( or an explicit \bigl(...\bigr) pair if a larger size is needed.

So the automatically chosen size is Ok for \mathrm (which should be used in preference to \text) although personally I would just use the default size here and not use \left\right at all:

enter image description here

\[
(y^{\mathrm{f}}_i)\left(y^{\mathrm{f}}_i\right) 
\]
3
  • note that this is not really about \text or mathrm it is about italic f If you changed your example to use a superscript n you would see no difference. It is simply that the italic f has a descender and the roman one does not – David Carlisle Dec 21 '20 at 16:11
  • So the uppermost bow of the f should exceed the hight of the bracket? I expected the point was that the brackets "wrap" their content (what is the case for \left( y^f \right) ) – audiophiel Dec 21 '20 at 16:27
  • At the risk of sounding like egreg there is no requirement that the brackets are taller than their content (in fact they are traditionally a little bit less, tex has parameters \delimitershortfall and \delimiterfactor to control how much smaller than the content is acceptable) – David Carlisle Dec 21 '20 at 16: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.