TeX - LaTeX Asked on June 27, 2021
Is there a way to fix the following incompatibility ? I can’t use my private macro for the text of a node.
documentclass{article}
RequirePackage{tikz,amsmath}
usetikzlibrary{babel}
makeatletter
newcommandmy@macro[1]{%
{tiny$substack{-#1}$}%
}
newcommandtest[1]{%
begin{tikzpicture}
path (0, 0)
-- node[draw] {my@macro{#1}}
(1,0);
end{tikzpicture}
}
makeatother
begin{document}
test{PARIS}
end{document}
REVISED SOLUTION
Thanks to Ulrike, who suggested an alternative to my original solution. I like hers better: avoid the catcode issue with the invocation csname my@macroencsname
.
documentclass{article}
RequirePackage{tikz,amsmath}
usetikzlibrary{babel}
makeatletter
newcommandmy@macro[1]{%
{tiny$substack{-#1}$}%
}
newcommandtest[1]{%
begin{tikzpicture}
path (0, 0)
-- node[draw] {csname my@macroendcsname{#1}}
(1,0);
end{tikzpicture}
}
makeatother
begin{document}
test{PARIS}
end{document}
ORIGINAL SOLUTION
Not sure why it is needed, but by placing a makeatletter...makeatother
wrapper around the embedded invocation, it can be made to work.
documentclass{article}
RequirePackage{tikz,amsmath}
usetikzlibrary{babel}
makeatletter
newcommandmy@macro[1]{%
{tiny$substack{-#1}$}%
}
newcommandtest[1]{makeatlettertestaux{#1}makeatother}
newcommandtestaux[1]{%
begin{tikzpicture}
path (0, 0)
-- node[draw] {my@macro{#1}}
(1,0);
end{tikzpicture}
}
makeatother
begin{document}
test{PARIS}
end{document}
Correct answer by Steven B. Segletes on June 27, 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