比如我把旋转角度赋值给 \l__skyrmion_rotate_fp
,那么我要让某个 node
绕某点旋转时我会写
\node [ rotate~around = { \fp_use:N \l__skyrmion_rotate_fp:(0,0) } ] at (0,0) {test};
由于 rotate~around
接受的argument中存在冒号 :
,这就回导致在expl3中发生冲突,请问如何解决?
The following is the MWE:
\documentclass{article}
\usepackage{tikz}
\ExplSyntaxOn
\fp_new:N \l__skyrmion_rotate_fp
\fp_set:Nn \l__skyrmion_rotate_fp {30}
\cs_new_protected_nopar:Nn \l__skyrmion_tmp_cs:
{
\draw (0,0) -- (1,1)
node [ rotate~around = { \fp_use:N \l__skyrmion_rotate_fp:(0,0) } ] {test};
}
\ExplSyntaxOff
\begin{document}
\ExplSyntaxOn
\tikz { \l__skyrmion_tmp_cs: }
\ExplSyntaxOff
\end{document}
使用\c_colon_str
替换即可,参考链接
\documentclass{article}
\usepackage{tikz}
\ExplSyntaxOn
\fp_new:N \l__skyrmion_rotate_fp
\fp_set:Nn \l__skyrmion_rotate_fp {30}
\cs_new_protected_nopar:Nn \l__skyrmion_tmp_cs:
{
\draw (0,0) -- (1,1)
node [ rotate~around = { \fp_use:N \l__skyrmion_rotate_fp \c_colon_str (0,0) } ] {test};
}
\ExplSyntaxOff
\begin{document}
\ExplSyntaxOn
\tikz { \l__skyrmion_tmp_cs: }
\ExplSyntaxOff
\end{document}
白嫖快乐~