我如何设置透明度以便箭头transparency group
与路径属于同一类别?
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\tikzset{%
> = stealth,
arrow over path/.style = {%
decoration = {%
markings,
mark = at position .5 with {\arrow {>};}
},
postaction = decorate
}
}
\draw[arrow over path, semitransparent] (0,0) -- (1,1);
\end{tikzpicture}
\end{document}
答案1
根据要求,该评论变为答案:
据我所知,目前无法在路径内完成此操作。但是,transparency group
可以使用(前提是后端驱动程序支持它)。请注意,透明度是在周围的scope
不是路径:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\tikzset{%
> = stealth,
arrow over path/.style = {%
decoration = {%
markings,
mark = at position .5 with {\arrow {>};}
},
postaction = decorate
}
}
\begin{scope}[opacity=.5, transparency group]
\draw [arrow over path] (0,0) -- (1,1);
\end{scope}
\end{tikzpicture}
\end{document}