3

A subscript to a subscript can be accomplished by a_{b_c} in a way that the c is really subscript to b, and both together subscript to a. However, {a_b}_c behaves differently (either b and c appear at the same height, or c is only slightly lower).

My problem is that I'm generating LaTeX code from a script language, and I get an expression like {a_b} (in parentheses) and a subscript c, and I can't take the expression apart to form a_{b_c}. Is there a way to leave the expression {a_b} unchanged and produce the same behavior as a_{b_c} or to lower subscript c somehow?

Edit: Here's the test script including the two suggestions by David Carlisle:

\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
  a_{b_c} {a_b}_c a_b\vphantom{a}_c a_b{}_c
\end{align}
\end{document}

which produces:

result

1
  • To me it sounds as if the real solution is to use parentheses, (a_b)_c.
    – mickep
    Nov 22, 2023 at 5:05

2 Answers 2

4

{a_b}_c would seem to be the natural result although a couple of alternatives to get closer to a_{b_c} layout

enter image description here

\documentclass{article}

\begin{document}


\[
a_{b_c}
+
a_b\vphantom{a_b}_{\scriptscriptstyle c}
+
a_b{}_{_{c}}
\]

\end{document}

The vphantom will handle cases where the terms are not just a and b and have larger depth, but require you to have access to the preceding term to duplicate it, the last form just uses empty math atoms and handles most "normal" cases.

7
  • Hmm, for me that has exactly the opposite effect in both cases: the small vertical offset completely disappears.
    – Ralf
    Nov 21, 2023 at 14:21
  • It does ;-), please see the edit in my question.
    – Ralf
    Nov 21, 2023 at 14:54
  • oh sorry I misread, I thought you wanted same result as a_{bc} so you want a_b\vphantom{a_b}_{\scriptscriptsyle c} if you really want to do this Nov 21, 2023 at 15:00
  • Thanks, but a_b\vphantom{a_b}_c doesn't work either; b and c have the same height.
    – Ralf
    Nov 21, 2023 at 15:06
  • 1
    @Ralf that makes a scriptsize c, but you seemed to indicate you wanted it to look like a_{b_c} which has a scriptscript size ie 5pt rather than 7pt. \! is -3mu you can use whatever space you want (but beware the space in b_c is specified by the font and will depend on the characters used, you can not reproduce that without a lot of effort. Nov 21, 2023 at 15:13
3

If you use Unicode math Latin-Modern-Math font, then ${a_b}_c$ gives result with visible lowering of c. Compare two math fonts: the source file

Computer Modern, classic math: ${a_b}_c$

\fontfam[lm]

Latin Modern Unicode math: ${a_b}_c$

\bye

processed by OpTeX gives the result:

asubb

1
  • This works with \fontfam[newcm] and \fontfam[ebgaramond], too.
    – user206750
    Nov 21, 2023 at 20:15

You must log in to answer this question.

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