Drasil icon indicating copy to clipboard operation
Drasil copied to clipboard

Fix subscript and superscript display for variables that have both

Open smiths opened this issue 3 years ago • 3 comments

When we have a variable with a both subscript and a superscript it displays in awkward way. The symbols in Projectile are an example. For instance, we have a_y^c (y-component of constant acceleration). In both LaTeX and html the display is a_y with the superscript c. Instead of a with the subscript y and the superscript c. In pdf generated by LaTeX the difference looks like this:

image

The Drasil-generated LaTeX code is:

${{a_{\text{y}}}^{\text{c}}}$

what we want is:

${a_{\text{y}}^{\text{c}}}$

Hopefully, this is an easy fix, but I wonder if it was done the "wrong" way because the "right" way isn't intuitive?

We can function with the examples as they are, so I'll set this as an enhancement.

smiths avatar Dec 19 '22 19:12 smiths

Not really the same case but this issue reminds me of this #2815. The symbols display awkwardly as well if we have two subscripts or two superscripts. Maybe can take both cases into consideration when making an enhancement.

tingyuw avatar Dec 21 '22 03:12 tingyuw

Hmm, finding what code puts out an extra set of {} might not be so easy! Normally they help and don't hinder -- except here. I'm quite sure that this fix will require actual extra logic, not just a small code fix.

JacquesCarette avatar Dec 22 '22 18:12 JacquesCarette

Yes, I was afraid that this wouldn't be minor. We'll have to identify the problematic case, and not break all the other cases where we want the extra set of {}.

smiths avatar Dec 23 '22 15:12 smiths