我如何定义一种样式,让两个参数在列表中采用成对的值?在我的例子中,样式是
\tikzset{
loop/.style 2 args={decoration={markings,
mark=at position {#1} with {\arrow{>},
\node[anchor=\pgfdecoratedangle-90] {$p_{#2}$};}},
postaction={decorate}}
}
答案1
啊哈,我刚刚明白了。这个有效:
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}
\tikzset{
loop/.style 2 args={thick,decoration={markings,
mark=at position {0.0625*#1} with {\arrow{>},
\node[anchor=\pgfdecoratedangle-90,font=\footnotesize] {$p_{#2}$};}},
postaction={decorate}}
}
\begin{document}
\begin{tikzpicture}
\draw[loop/.list={{1}{6},{3}{1},{5}{2},{7}{3},{10}{4},{14}{5}}] (0,0) circle (1);
\end{tikzpicture}
\end{document}