4

I noticed that with many nested sub/superscripts, LaTeX starts really messing with the script placements. For example I need to typeset math like \varphi_e^{A_{s(x)}, 1} or even \mathcal{W}_{\varphi_e^{A_{s(x)}, 1}(y)}. In both cases the A is typeset very high relative to the \varphi. It is entirely above the \varphi. I think the expression A_{s(x)}, 1 becomes too disconnected from the \varphi, impeding readability. Also, in the second expression, the \varphi is typeset every far from the \mathcal{W}.

\varphi_e^{A_{s(x)}, 1} \mathcal{W}_{\varphi_e^{A_{s(x)}, 1}(y)}

Is there a way to typeset the A more like it is normally typeset (without a subscript, like in \varphi_e^A)?

\varphi_e^A

I would (of course) prefer to have a somewhat automatic solution, i.e. not having to fiddle with \fontdimenXX parameters every time I need to typeset an equation involving nested sub- and superscripts.

PS: I am using LuaLaTeX with unicode-math and the (default) latin modern math font.

4
  • 1
    The default spacing is entirely determined by the constants in the math table for the font you are using. You haven't said what that is, a test file that shows the font setup and allows people to test answers is always useful in any question. Commented Apr 10, 2021 at 12:58
  • 2
    note that tex is positioning vertical boxes the bottom of the (x) only just clears the top of the e and tex doesn't know they won't over-print. you cound hide the extent of the terms with \smash{...} Commented Apr 10, 2021 at 13:01
  • I'm just using latin modern math. Added that to the question. Tried \smash{e} as the subscript and that indeed significantly improves the typesetting! Still, the $\mathcal{W}$ is quite distant from it's subscript, both horizontal and vertical. Thank you for very fast the comments!
    – beehive
    Commented Apr 10, 2021 at 13:09
  • it would have been better to provide a test document (as in egreg's answer) Commented Apr 10, 2021 at 13:16

1 Answer 1

4

In the particular case, where the superscript's descender will not clash with the subscript, you can \smash the bottom of the superscript.

But you should consider alternative and easier to read notation, in my opinion.

documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\mathcal{W}_{\varphi_{e}^{\smash[b]{A_{s(x)},1}}(y)}
\]

\[
\mathcal{W}\bigl(\varphi_{e}^{A_{s(x)},1}(y)\bigr)
\]

\end{document}

enter image description here

2
  • Thank you. Indeed the notation is a bit unfortunate, but it is not always possible to deviate from long-standing conventions in mathematics...
    – beehive
    Commented Apr 10, 2021 at 13:30
  • 1
    @beehive I know, of course. On the other hand a four-story formula is really hard to read.
    – egreg
    Commented Apr 10, 2021 at 13:31

You must log in to answer this question.

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