2

A recent post on Math SE reminds me of an old issue as titled, shown in the screen grab below in case it is edited or deleted. There are several other issues with these few lines, but I'd like to just focus on the vertical white space inside the brackets.

Clearly the problem is partly inherent to the math expressions themselves being unbalanced in the sense that it is a big exponent on top of a small base, and one can certainly do something like \exp\Bigl( # \Bigr). Nonetheless, one can imagine situations where such "proper" formulations are not feasible.

Math StackExchange 4329422

I vaguely recall years ago dealing with this problem and solving it. However right now it seems my memory is faulty. Somehow I can find only a trick bypassing the issue via bmatrix, this using a box and vcenter, a package deal humorously named nath that's incompatible with amsmath, and another forcible practice deemed ugly (by the answerer Phelype Oleinik) using fixit from here.

It appears this cannot really be solved by smash (except in certain cases of inline use) since it defeats the purpose of having automatic sizing delimiters.

This seems to me like a basic thing that can be dealt with easily and "properly" without tricks like the aforementioned use of a matrix or a full-blown fixit.
In light of David Charlisle's comment (about staying on math axis or not), I'm working on refining (and reframing if necessary) my question.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
E\left[e^{-\frac{2\gamma^2}{a^2X+b^2}}\right] \neq E\left[\smash[t]{ e^{-\frac{\gamma^2}{a^2X+b^2}} } \right]^2
\end{equation*}
\end{document}
4
  • 1
    Maybe some of the spacing features of mathtools package (an extension of amsmath) could work. Look to subsection 3.1. Not sure if something there could help Dec 12, 2021 at 2:59
  • 1
    It is not clear if there is a problem to fix (and you do not say how you want the output to change) the output you show is by design and the result of two design constraints, delimiters are vertically centred on the math axis, and fractions have the bar on the math axis. So to avoid the space you need to give up one of those constraints, or re-structure the layout so the expression is more balanced around the math axis. Dec 12, 2021 at 10:03
  • @DavidCarlisle Thanks for the pointer. I'm gonna try some things out to see if I want the delimiters to shift up, or to let the math expression shift off math axis down. I'll update the question post then. BTW I guess this inevitably involves the vcenter as done in the answer I linked and "rejected" before naively. Dec 12, 2021 at 10:17
  • It's been several months, and I've been SLOWLY working on this. Here's a remotely related post where the OP's intention was (unbeknownst to OP) to challenge the principle (constraint) that summation operator should align at the math axis. May 3, 2022 at 14:35

1 Answer 1

4

I wouldn't rely on the matrix trick here: The terms in the numerator and denominator of the e^{-\frac{...}{...}} expression will still look miserably compressed.

Instead, I'd replace with e^{...} notation with \exp(...) notation; see the second line below. In addition, if the formula occurs in an inline math setting, I'd replace the \frac{...}{...} with inline-fraction notation, i.e., .../.... Oh, and don't overuse \left and \right.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\E}{E} % expectations operator

\begin{document}
\begin{align*}
E\left[e^{-\frac{2\gamma^2}{a^2X+b^2}}\right] &\neq 
E\left[\smash[t]{ e^{-\frac{\gamma^2}{a^2X+b^2}} } \right]^2
\\[2ex]
\E\exp\Bigl(-\frac{2\gamma^2}{a^2X+b^2}\Bigr) &\neq 
\E\Bigl[\exp\Bigl(-\frac{\gamma^2}{a^2X+b^2}\Bigr) \Bigr]^2
\\[3ex]
\E\exp\bigl(-2\gamma^2/(a^2X+b^2)\bigr) &\neq 
\E\bigl[\exp\bigl(-\gamma^2/(a^2X+b^2)\bigr) \bigr]^2
\end{align*}
\end{document}
3
  • Thanks for the response. I am aware of your great answer that taught me a lot. Actually I mentioned this in the 2nd paragraph, ha. Dec 12, 2021 at 10:00
  • @LeeDavidChungLin — yes, you did mention that \exp notation is a possibility. My answer is mostly as a practical demonstration of just how much the typography improves once one starts using it.
    – Mico
    Dec 12, 2021 at 10:33
  • Yeah I'm working on how I approach this now. Indeed I have been correcting other people's unnecessary use of \frac{a}{b} when simply a/b is more suitable in mathmode on the exponent or inline. It appears this is basically the same idea. Dec 12, 2021 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .