TransWikia.com

Parsing macros found in user inputs

TeX - LaTeX Asked on January 30, 2021

I am trying to parse macros that are found within user inputs for my custom draw package.

As an example suppose a user wants to set multiple quantities to have the same index. Currently I offer the possibility of typing the code line

set {q1,q2,q3}=$*_{customSubscript}$

where q1,q2,q3 are the quantities, which I have previously mentioned and * can be regarded as a placeholder for the quantities. Now, the individual parts of the input can be parsed using

defset #1=$*#2$

Let’s say I want to offer my users the possibility to apply a macro like mathbf{} to each quantity, hence the input would become:

set {q1,q2,q3}=$someMacro{*}_{customSubscript}$

Is there a way to parse the someMacro and save it into a variable so I can apply it to q1,q2,q3 later on in my code?

Desired ouput:

I would like to have a parsing function of the form:

defset #1=$#2{*}#3$

where #1 is {q1,q2,q3}, #2 is someMacro, and #3 is _{customSubscript}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP