1

I drew the parallelogram below using the tkz-euclide by adapting J. Leon V's answer to the question Place parallel line markers on parallel lines.

parallelogram_with_red_arrows

I adapted the arrow style from user121799's answer to this question.

Since placing red arrows on the segments using J. Leon V's method produced red segments, I then drew black segments over the sides of the parallelogram, making the sides cut through the arrows. Is it possible to draw colored arrows on a black segment so that the black segment does not show through the arrows?

My code:

\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{arrows}
\usetkzobj{all}

\tikzset{%
>=latex, % option for nice arrows
inner sep=0pt,%
outer sep=2pt,%
mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
fill=black,circle}%
}

\begin{document}

\begin{tikzpicture}
\tkzDefPoint(0, 0){A}
\tkzDefPoint(2, 3){B}
\tkzDefPoint(8, 3){C}
\tkzDefPoint(6, 0){D}
%mark parallel segments AB and CD with single arrows
\begin{scope}[decoration={markings,mark=at position .55 with          {\arrow[scale=2]{>}};}]
\tkzDrawSegments[postaction={decorate},color=red](A,B D,C)
\end{scope}
%mark parallel segments BC and AD with double arrows
\begin{scope}[decoration={markings,mark=at position .55 with   {\arrow[scale=2]{>>}};}]
\tkzDrawSegments[postaction={decorate},color=red](B,C A,D)
\end{scope}
%draw segments again in black to cover red segments
\tkzDrawSegments(A,B B,C C,D D,A)
\end{tikzpicture}

\end{document}

2 Answers 2

3

Here is a way:

\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{arrows}
\usetkzobj{all}

\tikzset{%
>=latex, % option for nice arrows
inner sep=0pt,%
outer sep=2pt,%
mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
fill=black,circle}%
}

\begin{document}

\begin{tikzpicture}
\tkzDefPoint(0, 0){A}
\tkzDefPoint(2, 3){B}
\tkzDefPoint(8, 3){C}
\tkzDefPoint(6, 0){D}
%mark parallel segments AB and CD with single arrows
\begin{scope}[decoration={markings,mark=at position .55 with          {\arrow[scale=2,color=red]{>}};}]
\tkzDrawSegments[postaction={decorate},color=black](A,B D,C)
\end{scope}
%mark parallel segments BC and AD with double arrows
\begin{scope}[decoration={markings,mark=at position .55 with   {\arrow[scale=2,color=red]{>>}};}]
\tkzDrawSegments[postaction={decorate},color=black](B,C A,D)
\end{scope}
%%draw segments again in black to cover red segments
%\tkzDrawSegments(A,B B,C C,D D,A)
\end{tikzpicture}

\end{document}

Just removed (commented out) your last command and addeed color=red in your decoration but black in your draw command .

2
  • A simple fix. Thank you. Commented Sep 30, 2019 at 15:10
  • Welcome @N.F.Taussig ... Happy TeXing
    – koleygr
    Commented Oct 1, 2019 at 6:52
3

You can design your own mark (arrow) using pic. Then just put the marks after drawing paths. Also note that sloped is a path option, not pic option.

enter image description here

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}[meme/.pic={
\fill[red] (150:6pt) to[bend right=10] (0:3pt) to[bend right=10] (-150:6pt)--cycle;}]
\path
(0,0) coordinate (A)
(2,3) coordinate (B)
(8,3) coordinate (C)
(6,0) coordinate (D);

\draw[sloped] (A)
--(B) pic[pos=.5]{meme}
--(C) pic[pos=.46]{meme} pic[pos=.54]{meme}
--(D) pic[pos=.5]{meme}
--cycle pic[pos=.46]{meme} pic[pos=.54]{meme};
\end{tikzpicture}    
\end{document}
4
  • There is every node/.style , but it seems that there is no every pic/.style
    – Black Mild
    Commented Sep 30, 2019 at 18:44
  • 1
    There is an every pic style, try e.g. \draw[s/.style={sloped},every pic/.style={scale=2,transform shape}] .... It is, however, true that the pgf manual has a bug regarding this, i.e. the code example on p. 262 is inappropriate. However, the every pic key works and is clearly present in tikz.code.tex in \scope[every pic/.try]%, where it gets installed.
    – user194703
    Commented Sep 30, 2019 at 21:42
  • @Schrödinger'scat Yeah, every pic/.style works. However, in this case, sloped is an path option, not pic option. I have just adjusted my code as: \draw[sloped] (A) --(B) pic[pos=.5]{meme} --(C) pic[pos=.46]{meme} pic[pos=.54]{meme} --(D) pic[pos=.5]{meme} --cycle pic[pos=.46]{meme} pic[pos=.54]{meme};
    – Black Mild
    Commented Oct 1, 2019 at 15:17
  • These are the arrows used in the present day in mathematical text books because the books are produced using latex In the older text books the arrows are different.
    – Jon
    Commented Aug 10, 2023 at 8:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .