1

Got this code from the website tried for hours to adopt it all I want to do is change the arrows in the middle of the parallelogram to the normal arrows seen in most mathematical text books >> but maybe a bit larger my MWE is below.

\documentclass{scrreprt}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzset{%
    ->-/.style={decoration={markings, mark=at position 1.5 with {\arrow{>}}},
        postaction={decorate}},
    ->>-/.style={decoration={markings, mark=at position 1.0 with {\arrow{>>}}},
        postaction={decorate}},
}  
\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);
    
    \node [left] at (0,0) {D};
    \node [left] at (2,3) {A};
    \node [right] at (8,3) {B};
    \node [right] at (6,0) {C};
    
    \draw [thick] (2,3) -- (6,0);
    
    
    
    \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
  • What are the normal arrows in most mathematical text books? PGF/TikZ comes with a bunch of arrow tips in the arrows.meta library which can be used in the ->- decoration in place of >. Then you also have to use -> instead of the meme pic (which just draws a Latex arrow tip). But change the position to 0.5. Aug 8, 2023 at 16:20
  • I believe you want something like Q253007 but with arrow tips instead of short dashes? Aug 8, 2023 at 16:43
  • Yes, that is exactly what I would like, and I tried to play with that diagram, too, but was unsuccessful in changing the dashes to arrows.
    – Jon
    Aug 9, 2023 at 1:01
  • @Qrrbrbirlbel you are right I didn't know that arrows in parallelograms are different in different text books. I was looking at a text books from the 1980s, not the present day. They have different arrows on them.
    – Jon
    Aug 9, 2023 at 2:32

2 Answers 2

2

I took inspiration from a quick Google search.

I prefer the arrow pic over using the decorations.markings library. The first line of its code shifts the drawing so that the middle of the whole construct is where we want it (otherwise the tips wouldn't be symmetric).

These pics are placed via an edge node style so that we don't have to write out each pic specification.

The example shows two ways to double such an arrow:

  1. Using >> in the ->>- style which just adds the second arrow tip right behind the first one.
  2. Using ->- which a > specification of a double arrow tip (because I want a seperation between those Bars).

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta, quotes}
\tikzset{
  reversed/.style={xscale=-1},
  pics/arrow/.style={/tikz/sloped, /tikz/allow upside down, code=%
    \pgfarrowtotallength{#1}\tikzset{xshift/.expanded=.5*\csname pgf@x\endcsname}%
    \pgfarrowdraw{#1}}, pics/arrow/.default=>}
\begin{document}
\tikz[
  line join=round,
  Arr/.tip={Straight Barb[angle'=60, scale=2]},
  ||/.tip={Bar[sep] . Bar},
  > = Arr,
  ->-/.style={edge node={pic[#1]{arrow}}},
  ->>-/.style={edge node={pic[#1]{arrow=>>}}},
] \draw[thick, draw=purple]
                       (0, 0) coordinate["$D$" left]  (D)
     to[->>-]          (2, 3) coordinate["$A$" left]  (A)
     to[->-]           (8, 3) coordinate["$B$" right] (B)
     to[->>-=reversed] (6, 0) coordinate["$C$" right] (C)
     to[->- =reversed] cycle
     coordinate["$E$"] (E) at (intersection of D--B and A--C)
     [behind path, every edge/.append style={black, thin}, arrows={[slant=.2]}]
     (A) edge[>=||, ->-=near start, ->-=near end] (C)
     (B) edge[>=|,  ->-=near start, ->-=near end] (D);
\end{document}

Output

enter image description here

1
  • I've just scanned and converted a pdf to png, and you've beat me to it. Yes, this is what I wanted. Although we're not supposed to post comments. I would especially like to thank you, and all the other posters, for helping me understand arrows and also mathematics books produced in the 1980s (with type) are different to today's maths books. I wouldn't want someone to make the same mistake as me.
    – Jon
    Aug 9, 2023 at 14:44
3

Update: The meme style from this answer is made to create a user-flexible arrow in a simple way.

Adapt to your question, just take a minor change to meme (you can put it in a \tikzset)

meme/.pic={ 
\draw (150:8pt) --(0,0)-- (-150:8pt);
}

enter image description here

\documentclass{scrreprt}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[meme/.pic={ 
\draw (150:8pt) --(0,0)-- (-150:8pt);
}]
\path
(0,0) coordinate (D) node[below left]{$D$} 
(2,3) coordinate (A) node[above left]{$A$}
(6,0) coordinate (C) node[below right]{$C$}
(A)+(C) coordinate (B) node[above right]{$B$};
        
\draw[gray] (A)--(C) (B)--(D);
        
\draw[thick] 
(A)--(B) pic[pos=.5,sloped,red]{meme}
(D)--(C) pic[pos=.5,sloped,red]{meme}
(D)--(A) pic[pos=.47,sloped,blue]{meme}
         pic[pos=.53,sloped,blue]{meme}
(C)--(B) pic[pos=.47,sloped,blue]{meme}
         pic[pos=.53,sloped,blue]{meme}
;
\end{tikzpicture} 
\end{document}

Do you see this simple and flexible?


Old: Note that a coordinate is a node without content. Maybe what you want is the Straight Barb arrow from the arrows.meta library (see more in the PGFmanual).

In Straight Barb[angle=30:8pt], the meanings of 30 and 8pt are tip angle and tip length.

enter image description here

\documentclass{scrreprt}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[>={Straight Barb[angle=30:8pt]}]
\path
(0,0) coordinate (D) node[below left]{$D$} 
(2,3) coordinate (A) node[above left]{$A$}
(6,0) coordinate (C) node[below right]{$C$}
(A)+(C) coordinate (B) node[above right]{$B$};
        
\draw[blue] (2,3) -- (6,0);

\draw[->] (A)--(B);
\draw[->] (D)--(C);
\draw[->] (D)--(A);
\draw[->] (C)--(B);
        
\end{tikzpicture} 
\end{document}
3
  • Thanks, but I would like one arrow in the middle of two sides of the parallelogram and two arrows in the middle of the other two sides of the parallelogram
    – Jon
    Aug 9, 2023 at 1:03
  • Please upload a hand drawing of what you want in your question (click to Edit button ....)
    – Black Mild
    Aug 9, 2023 at 1:23
  • 1
    Thank you I will do that later today,
    – Jon
    Aug 9, 2023 at 2:12

You must log in to answer this question.

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