TeX - LaTeX Asked on June 21, 2021
I’m using pgfplotsinvokeforeach{0,1,2} {...}
and would like to somehow dispatch on #1
to get one of three strings:
$s_A$
if #1 == 0
$s_B$
if #1 == 1
$s_C$
if #1 == 2
Is there an easy way to do this? I’ve tried using xstring’s StrMid
but it bombs and complains about let
doing something wrong.
You can try this solution based on LaTeX3. Not sure if it works with pgfplotsinvokeforeach
in your code though.
documentclass{article}
usepackage{expl3}
ExplSyntaxOn
newcommand{intcase}[1]{
int_case:nn {#1} {
{1} {$sc_math_subscript_token A$}
{2} {$sc_math_subscript_token B$}
{3} {$sc_math_subscript_token C$}
}
}
ExplSyntaxOff
begin{document}
intcase{1}intcase{2}intcase{3}
end{document}
Answered by Alan Xiang on June 21, 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