TeX - LaTeX Asked by GerritKi on June 11, 2021
I have a problem with a macro-defined list in a TikZ foreach loop. The macro is built by csname
…endcsname
.
I’ve played around with multiple expandafter
or ##1 instead of #1, but with no success: The list of elements is not considered as of multiple elements then as a complete string.
Here is my MWE:
documentclass[border=10pt]{standalone}
usepackage{tikz}
% Macro to read in configuration parameters
newcommand*ReadCfg[3]{%
expandafterxdefcsname#1#2listendcsname{#3}%
}
% Provide list for upper positions (this macro will be looped by foreach)
% jobname is 'AUT'
providecommandListUpper{%
expandaftercsnamejobname upperlistendcsname%
}
% This configuration will be later provided by external file
ReadCfg{AUT}{upper}{Elem1,Elem2,Elem3}
begin{document}
begin{tikzpicture}
foreach e in ListUpper {
typeout{***spacee} % e is interpreted as "Elem1,Elem2,Elem3" instead of single elements
}
end{tikzpicture}
end{document}
So, how can I loop throu the list of elements?
Thank you!
documentclass[border=10pt]{standalone}
usepackage{tikz}
% Macro to read in configuration parameters
newcommand*ReadCfg[3]{%
expandafterxdefcsname#1#2listendcsname{#3}%
}
% Provide list for upper positions (this macro will be looped by foreach)
% jobname is 'AUT'
providecommandListUpper{%
csnamejobname upperlistendcsname%
}
% This configuration will be later provided by external file
ReadCfg{AUT}{upper}{Elem1,Elem2,Elem3}
begin{document}
begin{tikzpicture}
edeftmpA{ListUpper}
foreach e in tmpA {
typeout{***spacee} % e is interpreted as "Elem1,Elem2,Elem3" instead of single elements
}
end{tikzpicture}
end{document}
From AUT.log:
Answered by Steven B. Segletes on June 11, 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