在平行线上放置平行线标记

在平行线上放置平行线标记

我尝试在两组平行线上添加 > 和 >>,但没有成功。

\documentclass{scrreprt}
\usepackage{tikz}

\begin{document}


\begin{tikzpicture}[scale=1,xscale=2]
  \coordinate (A) at (0,0);
  \coordinate (B) at (2,2.5);
  \coordinate (C) at (4,2.5);
  \coordinate (D) at (2,0);
  \draw[<->,thick,shorten >=-60pt,shorten <=-60pt] (A) -- (B)node[midway]{SINGLE};
  \draw[<->,thick,shorten >=-60pt,shorten <=-60pt] (C) -- (D)node[midway]{SINGLE};
  \draw[<->,thick,shorten >=-60pt,shorten <=-60pt] (A) -- (D)node[midway]{DOUBLE};
  \draw[<->,thick,shorten >=-60pt,shorten <=-60pt] (B) -- (C)node[midway]{DOUBLE};
\end{tikzpicture}

\end{document}

答案1

您可以使用装饰器来实现这一点。下面的代码定义了两个新的箭头类型->-->>-它们可以实现您想要的功能

在此处输入图片描述

大概是因为箭是装饰品所以才堆叠的。

以下是代码:

\documentclass{scrreprt}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzset{%
  ->-/.style={decoration={markings, mark=at position 0.5 with {\arrow{>}}},
              postaction={decorate}},
  ->>-/.style={decoration={markings, mark=at position 0.5 with {\arrow{>>}}},
               postaction={decorate}},
}

\begin{document}


\begin{tikzpicture}[scale=1,xscale=2]
  \coordinate (A) at (0,0);
  \coordinate (B) at (2,2.5);
  \coordinate (C) at (4,2.5);
  \coordinate (D) at (2,0);
  \draw[<->,thick,shorten >=-60pt,shorten <=-60pt,->-] (A) -- (B);
  \draw[<->,thick,shorten >=-60pt,shorten <=-60pt,->-] (D) -- (C);
  \draw[<->,thick,shorten >=-60pt,shorten <=-60pt,->>-] (A) -- (D);
  \draw[<->,thick,shorten >=-60pt,shorten <=-60pt,->>-] (B) -- (C);
\end{tikzpicture}

\end{document}

D请注意,我必须反转-行的代码C。或者,您可以使用-<- 以下方法:

\tikzset{%
  -<-/.style={decoration={markings, mark=at position 0.5 with {\arrow{<}}},
              postaction={decorate}},
}

答案2

只是一个补充,一个选择tikz 欧几里得,具有一些临时的标记语句,也可使用范围来获得所需标记的装饰。

结果:

在此处输入图片描述

梅威瑟:

\documentclass[tikz,border=20pt]{standalone}
\usepackage{tkz-euclide}
\usetikzlibrary{arrows.meta}
\usetkzobj{all}

\begin{document}
    \begin{tikzpicture}
    %Definindo os vertices
    %%The best way to define Axis is using polar notation:
    \tkzDefPoint(0,0){A} %The reference point
    \tkzDefShiftPoint[A](0:5){B}% POINT B 
    \tkzDefShiftPoint[A](40:4){D} %POIN D

    %%Find point C colinear at D from AB
    \tkzDefPointWith[colinear= at D](A,B) \tkzGetPoint{C} 

    %%Find point E colinear at C from DB
    \tkzDefPointWith[colinear= at C](D,B) \tkzGetPoint{E} 

    %Drawing modified style lines
    {%style only afects commands inside {}
        \tikzset{line style/.append style={<->},>={Stealth[scale=2.2,inset=0pt,angle'=20]}} 
            \tkzDrawLine[add=40pt and 40pt](A,B)
            \tkzDrawLine[add=40pt and 40pt](D,C)
            \tkzDrawLine[add=40pt and 40pt](A,D)
            \tkzDrawLine[add=40pt and 40pt](B,C)
    }
    \begin{scope}[decoration={markings,mark=at position .6 with {\arrow[scale=2]{>>}};}]
    \tkzDrawSegments[postaction={decorate},dashed](D,B C,E)
    \end{scope}


    %Drawing and label Points
    \tkzDrawPoints[color=blue,fill=blue,size=6pt](A,B,C,D)
    \tkzLabelPoints[color=blue,below=5pt,inner sep=0](A,B,C,D)

    %Mark Segments
    \tkzMarkSegments[mark=||](A,B D,C)
    \tkzMarkSegments[mark=|](B,C A,D)
    \end{tikzpicture}

\end{document}

相关内容