Hi,
I have a document with muliple occurences of $x^2^p$. I find that as is, the equation looks ambiguous and could be interpreted as $x^(2p)$. So, to avoid ambiguity, I would like to raise the exponent by a few pixels.
I came up with this solution:
#show math.equation: it => {
show "p": i => text(baseline: -2pt)[p]
it
}
This solution fixes my problem, but introduces a new one, that is that every p (even those not in the exponent) are now awkwardly shifted up.
Does anyone have suggestions for how to fix this? TIA!
Edit: Also, I realise I could make a special “raised” glyph and use that instead of p. This would work, but I am trying to avoid re-writing large parts of the document.
Alternatively, I wouldn’t bother trying to shift up and down the attachments. I think it would be more straightforward, and clearer to the reader if you just write
I understand that, I am suggesting an alternative solution that does not require complicated scripting for the maths. You can simply remove the ambiguity by writing either (x^2)^p or x^(2^p)
Unfortunately, this fix still does not work for me.
Not only does
x^2^p
Render exactly the same as
x^(2^p)
But adding more parentheses
x^((2^p))
Still runs into the same ambiguity, just with more parentheses. Maybe it’s an issue with the fonts I am using, but I find that it is ambiguous even with the default font.
It’s perfectly possible to automate it to a certain extent, you just need to write a show rule like you did in your first try. The most difficult part is getting rid of edge cases, because you don’t want to replace all p, just 2^p probably. I would just suggest using a variable
Another option is to create a function. This is not as convenient as a show rule when writing the document, but has the benefit of only ever affecting things that it should (no false triggering of the show rule)