Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Latex 如何确定标记箭头指向曲线上装饰点切线的方向_Latex_Tikz - Fatal编程技术网

Latex 如何确定标记箭头指向曲线上装饰点切线的方向

Latex 如何确定标记箭头指向曲线上装饰点切线的方向,latex,tikz,Latex,Tikz,我需要用箭头的中心在曲线的中心来装饰曲线。在tikz中,这可以通过将pre-length的值设置为箭头的长度来实现,如下例所示 \draw[decoration={ pre length=8pt, markings, mark=at position 0.5 with {\arrow{Stealth[black,length=8pt]}}}, postaction={decorate}] (-0.5, 0.125) to [out=60, in=120] (0.5, 0.125); 但是,现在

我需要用箭头的中心在曲线的中心来装饰曲线。在
tikz
中,这可以通过将
pre-length
的值设置为箭头的长度来实现,如下例所示

\draw[decoration={ pre length=8pt, markings, mark=at position 0.5 with {\arrow{Stealth[black,length=8pt]}}}, postaction={decorate}] (-0.5, 0.125) to [out=60, in=120] (0.5, 0.125);
但是,现在箭头的方向是箭头尖端所在点的切线,这不是对称的,一点也不好

是否可以使箭头的方向与装饰点的切线相同(
pos=0.5
),同时将箭头的中心保持在相同的位置,使图片看起来对称?下面的图片是我需要的

这个怎么样

\draw[thick, ->] (-0.5, 0.125) to [out=90, in=180] (0, 0.5);
\draw[thick] (0, 0.5) to [out=0, in=90] (0.5, 0.125);
对我来说,将曲线分为两部分,并在第一条曲线的末端放置一个规则箭头是最好的主意。

受此启发,我对其进行了调整

\newcommand{\appendarrow}[3]{
\tikzset{
    middlearrow/.style args={#1}{
        decoration={
            markings,
            mark= at position 0.5 with
                {
                    \coordinate (exy1) at (#1/-6.0,0pt);
                    \coordinate (exy2) at (-0.5*#1,#1/3.0);  % 3.0 adjustable 
                    \coordinate (exy3) at (0.5*#1,0pt);
                    \coordinate (exy4) at (-0.5*#1,#1/-3.0); % 3.0 adjustable 
                },
        },
        postaction=decorate
    },
    middlearrow/.default= 3pt
}
\draw[middlearrow=#1] #3;
\fill[#2] (exy1) -- (exy2) -- (exy3) -- (exy4) -- cycle;
}
如果我们想用中间的箭头绘制路径,只需使用
\appendarrow{arrow size}{arrow color}{path}
。例如,
\appendarrow{6pt}{black}{(-0.5,0.125)to[out=60,in=120](0.5,0.125);}
给出了下面的图

谢谢你的建议!然而,这种方法的问题在于:第一,并非每个路径切割都能轻易地分成两部分;其次,箭头的中心不在路径的中心。我想我是经过努力才弄明白的。见下面的答案。