使用 postaction 定义 tikzstyle

使用 postaction 定义 tikzstyle

是否可以postactiontikzstyle命令中使用?如果可以,如何使用?

\documentclass{standalone}
\usepackage[ngerman]{babel}
\usepackage{tikz}
%
\begin{document}
\begin{tikzpicture}
 \tikzstyle{ground/.style}={%
    \draw[postaction={draw,line width=0.35mm,red,dash pattern=on 3pt off 5pt,
          dash phase=4pt,thick}]
    [blue,dash pattern= on 3pt off 5pt,thick,rounded corners]};
 \draw[ground] (0,0) -- (3,3);
\end{tikzpicture}
\end{document}

答案1

就我个人而言,我会使用\tikzset\tikzstyle但总的来说,如果您删除不必要的代码,效果会很好\draw

图案

\documentclass{standalone}
\usepackage[ngerman]{babel}
\usepackage{tikz}
%
\begin{document}
\begin{tikzpicture}
 \tikzset{ground/.style={%
    postaction={draw,line width=0.35mm,red,dash pattern=on 3pt off 5pt,
          dash phase=4pt,thick},
        blue,dash pattern= on 3pt off 5pt,thick,rounded corners}}
 \draw[ground] (0,0) -- (3,3);
\end{tikzpicture}
\end{document}

相关内容