我正在尝试重新调整两条路径上的装饰使底部的箭头朝向另一个方向。我按以下方式命名路径
\begin{tikzpicture} [decoration={markings,
mark=at position 1cm with {\arrow[line width=1pt]{>}},
mark=at position 5cm with {\arrow[line width=1pt]{>}}}]
\path[draw, line width=0.4, postaction=decorate,
name path=contour1]
plot[smooth] coordinates
{(1.3,0.1)(1.1,1.7)(-1.2,1.4)(-.9,0.1)} -- (1.3,0.1)
-- cycle;
\path[draw, line width=0.4, postaction=decorate,
name path=contour2]
plot[smooth] coordinates
{(1.3,-0.1)(1.1,-1.7)(-1.2,-1.4)(-.9,-0.1)} -- (1.3,-0.1)
-- cycle;
\end{tikzpicture}
但是,我不知道如何让装饰只出现在一条路径上。
答案1
这是您需要的吗?这是最简单的方法:mymark
使用单个参数设置样式(此处称为)。您可以设置两个或更多个,但对于您来说,一个就足够了。
输出
代码
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections,decorations.markings}
\tikzset{
mymark/.style={decoration={markings,
mark=at position 1cm with {\arrow[line width=1pt]{#1}},
mark=at position 5cm with {\arrow[line width=1pt]{#1}}}}
}
\begin{document}
\begin{tikzpicture}
\path[draw, mymark={>}, line width=0.4, postaction=decorate, name path=contour1]
plot[smooth] coordinates
{(1.3,0.1)(1.1,1.7)(-1.2,1.4)(-.9,0.1)} -- (1.3,0.1) -- cycle;
\path[draw, mymark={<},line width=0.4, postaction=decorate, name path=contour2]
plot[smooth] coordinates
{(1.3,-0.1)(1.1,-1.7)(-1.2,-1.4)(-.9,-0.1)} -- (1.3,-0.1) -- cycle;
\end{tikzpicture}
\end{document}