TeX - LaTeX Asked by audiophiel on January 10, 2021
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.
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:
MWE:
documentclass[preview]{standalone}
usepackage{amsmath}
usepackage{listings}
lstset{language=TeX,
basicstyle=footnotesizettfamily,
}
begin{document}
Case one:
begin{align*}
(y_i^f) + left(y_i^fright) + 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}
documentclass{article}
usepackage{amsmath}
begin{document}
[
left(y^f_iright) left(y^{text{f}}_iright) left(y^{mathrm{f}}_iright)
]
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 leftright
at all:
[
(y^{mathrm{f}}_i)left(y^{mathrm{f}}_iright)
]
Answered by David Carlisle on January 10, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP