0

I have the following MWE:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align} A1 &= \left{\frac{1}{2\omega} \right. \ & \enspace \left. \left[\frac{z_{v}^2}{\left(\omega + \frac{z_{v}^2}{\omega}\right) t_{v}\left(z_{v}\right)}\right]\right} \ A2 &= ...\ \end{align}

\end{document}

Now, the problem is that the rectangular brackets do not completely surround the larger inner curvy brackets in the major fraction denominator (themselves containing a minor fraction). Similarly, the outer curly brackets do not completely surround the rectangular brackets surrounding the major fraction. Is there a relatively straightforward way to automatically extend those rectangular brackets to surround the larger curvy brackets in the major fraction denominator and to extend the curly brackets just enough to surround the rectangular brackets?

I tried to use the usual \bigl-\bigr, \biggl-\biggr, \Bigl-\Bigr, and \Biggl-\Biggr combinations, but they are not large enough. I also tried to use vphantom, but that is too ad-hoc for my taste. I was looking for something cleaner. In principle, the \left-\right combination should work. Maybe that \frac command is preventing the left rectangular delimeter from gaining access to the extended delimeters in the major fraction denominator. Not sure. If there is no \left-\right-based solution available, I might need to set \vastl-\vastr and \Vastl-\Vastr commands as in this example: mathtools brackets larger than \Bigg but, if possible, I want to avoid that and stick to a \left-\right-based solution. The \left(\rule{0cm}{2cm}\right. approach could be an option, but I have equations with brackets opening in one line and closing in another. Not sure how to break sets of brackets across lines with \left(\rule{0cm}{2cm}\right.. Any help would be very welcome!

enter image description here

UPDATE: @Mico/@Werner: I just extended the original MWE to a multiline equation with a shorter major fraction (and a shorter left rectangular bracket) on the first line and a taller major fraction (and a taller right rectangular bracket) on the second line, whereby said equation is part of several within the broader align and split environments I use. I can of course use fixed size brackets like \Biggl-\Biggr, but they cannot adequately surround the inner curvy brackets surrounding the minor fraction in the denominator of the major fraction in the second line. That is the actual problem!

Werner
  • 603,163
  • 2
    Please don't down vote posts without explaining how they can be improved! – cfr Oct 28 '23 at 02:35
  • 1
    Which of these options do you prefer? – Werner Oct 28 '23 at 04:24
  • @Werner: thanks a lot for the help! Well, I would prefer the one on the left-hand side, but ideally with the term in the numerator also vertically centered (right now only the term in the denominator looks vertically centered to me). Still, I would be interested in having both codes, since I need to harmonize quite long equations, and the solution on the right-hand side might unexpectedly become useful. – Euclides Oct 28 '23 at 04:51
  • I've taken the liberty of extending your code snippet into an actual, i.e., compilable MWE. Feel free to revert. – Mico Oct 28 '23 at 04:54
  • @Mico: no problem! I am engaged in multiple fronts and wanted to have this issue addressed as soon as possible, so I wrote text and code a bit in a rush. My sincere apologies for that! – Euclides Oct 28 '23 at 04:55
  • @Mico: yes, I had written that minor fraction inline as well in a desperate attempt to shorten those inner curly brackets in the denominator of the major fraction, but I have all my other fractions in the much broader equations I wrote not inline, so I wanted to stay consistent there. As I said, both codes may be useful. There is a certain level of uncertainty still from where I stand. – Euclides Oct 28 '23 at 05:00
  • Off-topic: Don't overuse \left and \right. Even if you decide to do nothing else, please change t_{v}\left(z_{v}\right to t_{v}(z_{v}) in order to fix the wretched spacing between t_{v} and (z_{v}). – Mico Oct 28 '23 at 05:07
  • @Mico: thanks again for the recommendation. I just do this to be on the safe side so to say and make sure that those brackets are always correctly sized in relation to one another. It can be tricky when you have really long and complex mathematical expressions with large numbers of brackets. I was not aware of that spacing issue though. Will correct. Thanks again! – Euclides Oct 28 '23 at 05:12
  • @Euclides - It is decidedly not the case that parentheses and brackets autosized via \left and \right "are always correctly sized". Sometimes they're too small, sometimes they're too large. For more information on this see, e.g., Is it ever bad to use \left and \right? – Mico Oct 28 '23 at 09:32
  • @Mico/@Werner: I just extended the original MWE to a multiline equation with a shorter major fraction (and a shorter left rectangular bracket) on the first line and a taller major fraction (and a taller right rectangular bracket) on the second line, whereby said equation is part of several within the broader align and split environments I use. – Euclides Oct 28 '23 at 17:05

2 Answers2

0

I'd like to suggest a third option to complement @Werner's two options: An all-inline-fraction solution. It's shown on the left in the following screenshot, along with my own interpretation of one of @Werner's options; note that I don't use \left[ and \right] as I don't want to force LaTeX to place the fraction's horizontal line in in the middle of the space created by the square brackets.

enter image description here

If the \Big symbols are too big for your taste, you could always switch to \big.

Inline-style fraction notation has been around for at least a couple of centuries. Don't underestimate your readers' ability to understand it right away. Compared with \frac notation, one of its main advantages is that the symbols don't ever become very small.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
%% all-inline-fraction notation
\Bigl\{
z_{v}^2 \Big/ \Bigl[(\omega + z_{v}^2/\omega)\, t_{v}(z_{v})\Bigr]
\Bigr\}
\qquad
%% my interpretation of one of @Werner's suggestions
\left\{
  \begin{bmatrix}
  \frac{z_{v}^2}{\bigl(\omega + \frac{z_{v}^2}{\omega}\bigr)
  t_{v}(z_{v})}
  \end{bmatrix}
\right\}
\]
\end{document}
Mico
  • 506,678
  • @Mico: thanks a lot! I will prepare a version of my (multiple) multiline (roughly 4 line) equations with only inline fractions and see how that looks like. Still, I would be grateful if I could access Werner's solution for display fractions with correctly sized nested brackets. – Euclides Oct 28 '23 at 05:14
  • @Euclides - I've edited my answer to include code with my own interpretation of how to code one of Werner's solution suggestions. – Mico Oct 28 '23 at 06:20
  • @Mico: interesting approach. I might try to add yet another matrix layer with curly brackets. Just to see if the inner matrix is better surrounded by the outer matrix. But as it is this already is an improvement. However, I have rectangular brackets starting in one line and ending in another, and I guess the matrix cannot start in one line and end in another, without affecting bracket sizes, or can it? – Euclides Oct 28 '23 at 06:46
  • @Euclides - Replacing \left\{ ... \end\} in the second solution with \begin{Bmatrix} ... \end{Bmatrix} won't change the result. About your guess: A single matrix-like environment cannot span several lines. Neither can \left in one row and \right in another. – Mico Oct 28 '23 at 07:11
  • @Mico: absolutely! Question: is there an equation linebreak set of commands for \begin{Bmatrix}-\end{Bmatrix} that's equivalent to the \right. \\ and \left. ones used for \left-\right? – Euclides Oct 28 '23 at 16:21
  • @Mico: I guess I would need to look deeper into \Bmatrix to understand how those brackets are actually constructed. Anyway, I will now test the all inline approach. See how that looks like. I agree it has many advantages, but one big disadvantage is that it makes long equations even longer, especially if you have many many fractions; so, in my case I may have 6-line equations rather than 4-line (spanning the standard width of A4 page minus equation label width, roughly speaking). – Euclides Oct 28 '23 at 16:29
  • @Mico: one more question. What would be a good alternative to \Bmatrix that would yield the same results? I guess the only way is to define those \vastl-\vastr or Vastl-Vastr sets of commands as in the example I mentioned in my original question, right? Also, I read that \Bmatrix is based on \left-\right, so maybe I could find something in the definition of \Bmatrix. – Euclides Oct 28 '23 at 16:54
  • @Mico: I will have a version of my multiline, multibracket equations with only inline fractions ready, just to be on the safe side; while I/ we try to find a good solution for multiline, multibracket equations with only display fractions. I will also probably update the MWE to an actual multiline equation, so that the complete problem can be fully addressed. – Euclides Oct 28 '23 at 16:54
  • @Euclides - Yes, posting a representative equation would be helpful. – Mico Oct 29 '23 at 08:14
0

Some comments regarding your setup:

  • Think about using some space to spread out your constructions so it's easier to see the grouping of elements.
  • Use Left/Right across multi-line equation to spread a large construction across a multi-line equation structure. For this, the suggested solution is to use a \vphantom to spread the brackets in locations it doesn't have sufficient height.
  • Superficial stretching of \left/\right delimiters can be achieved with a strut - \rule[<height/depth>]{0pt}{0pt}.

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align} A1 &= \left{ \vphantom{ \left[ \frac {z_v^2} {\rule[-10pt]{0pt}{0pt} \left(\omega + \frac{z_v^2}{\omega}\right) t_v (z_v)} \right] } \dfrac{1}{2 \omega} \right. \ & \qquad \left. \left[ \frac {z_v^2} {\rule[-10pt]{0pt}{0pt} \left(\omega + \frac{z_v^2}{\omega}\right) t_v (z_v)} \right] \right} \ A2 &= \ldots \end{align}

\end{document}

Werner
  • 603,163
  • @Werner: thanks a lot! This is almost perfect. I say almost, because we still have that empty space above the term in the numerator, I guess because \left and \right always center the fraction bar. I tried to use the same strut with \biggl and \biggr (which do not center the fraction bar), but the bracket won't extend. Is there any solution for this? If this is solved, then I will almost certainly upvote your answer. I prepared a version with inline fractions as suggested by @Mico, and it looks good, except that it costs me one extra bracket type, which I need for my expressions. – Euclides Oct 29 '23 at 03:32
  • @Werner: obviously the strut won't work with \biggl and \biggr as these are non extensible brackets. Perhaps this (link) approach could be useful? Not sure. – Euclides Oct 29 '23 at 03:50
  • @Euclides: If you're wanting to reduce the empty space above the numerator you won't have the braces on the vertical center. For this, review How to get uneven size/space of numerator and denominator in fraction enclosed by \left\{ and \right} brackets. – Werner Oct 29 '23 at 04:26
  • @Werner: those uneven braces would be interesting, but would require quite extensive programming, especially with my multiline equations. I think I can live with that space above the numerator, for now. In any case, I will work in more detail on versions with display or inline fractions and see how those look like, before finally upvoting an answer (latest in about 12 hours), Thanks a lot for your help Werner! – Euclides Oct 29 '23 at 04:39