TeX - LaTeX Asked by ZhiyuanLck on January 15, 2021
Assume a situation that I have predefined some macros like abc
, aotherc
, … etc. The macro is just like a#1c
, and #1
is defined by x
.
In other words, I don’t know which of abc
, aotherc
, … to be used, but all these macros have been defined. then how can I write axc
with x
expanded first, and then the whole macro expands to the correct content?
It is my naming convention that causes this problem. Adjusting the order of the subnames just fix it. But I wonder if there is a way to solve this.
defabc{abc}
defaotherc{aotherc}
defx{b}
My attemp
expandafteracsname xendcsname c
The first comment is right. Write like this
csname ax cendcsname
then it will expand correctly.
My last run came with other problem.
is the output from the plain TeX file:
defabc{abc}
defaotherc{aotherc}
1:
defx{b}
csname ax cendcsname
2:
defx{other}
csname ax cendcsname
bye
Which shows that in each case, first x
was expanded to construct the csnames abc
(in the first case) or aotherc
(in the second) and then that constructed csname was expanded to produce the appropriate text.
Correct answer by David Carlisle on January 15, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP