TeX - LaTeX Asked by Peter Gerdes on January 10, 2021
Can I use xparse e-type arguments to redefine how subscripts and superscripts work for a command (e.g., make mybeta put all sub/super scripts in parens)? I tried defining
NewDocumentCommand{mybeta}{e_e^}{beta_{(#1)}^{(#2)}}
And it seems to work fine if I place them in the order the arguments are specified but not when I try
mybeta^{n}_{s}
where I get a double subscript warning when I want $beta^{(n)}_{(s)}$
I’m guessing that maybe I need to use e{_^} as the argument specification but if I do that how do I tell the _ and ^ arguments apart or recover them? Or is there a different/better way I should be going about this and I’ve misunderstood the embellishments entirely?
The solution is, as you predicted, to use e{_^}
in your argument specification. The order of the embellishments doesn’t matter. And yes, it’s amazing that it works!
Correct answer by LaTeXereXeTaL on January 10, 2021
Apparently (thanks to @LateXeraXeTal) you just use
NewDocumentCommand{mybeta}{e{_^}}{beta_{(#1)}^{(#2)}}
I admit I'm a bit confused as to why you don't use multiple e argument type specifiers to do this. Would one ever use multiple e type arguments?
Answered by Peter Gerdes on January 10, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP