alt text

Wie kann ich erreichen, dass die Pfeilspitze nicht durchgehend gezeichnet wird.

Ziel: Solche Pfeile erstellen:

alt text

BTW: Es muss nicht die Pfeilspitze Latex sein, bloß bei Triangle[] erzeugte es unschöne Proportionen.

Öffne in Overleaf
\documentclass[a4paper, landscape]{scrartcl}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}
%\usetikzlibrary{shapes.arrows}

\pagestyle{empty}
\begin{document}

\def\m{2pt}
\begin{tikzpicture}[
overlay, transform shape, remember picture, shift={(current page.center)},
%
Pfeil/.style={
line width=\m, double distance=1.5*\m,
arrows = {-Latex[length=0pt 3 0, fill=white]},
line cap=rect,
}
]

\def\L{2}
\coordinate[label=A] (A) at (-\L,-\L);
\coordinate[label=B] (B) at (\L,-\L);
\coordinate[label=C] (C) at (\L,\L);
\coordinate[label=D] (D) at (-\L,\L);

%\draw[] (A) rectangle (C);

\draw [Pfeil] (A) -- (C);

\end{tikzpicture}

gefragt 02 Jul '18, 19:22

cis's gravatar image

cis
9.5k75452491
Akzeptiert-Rate: 29%

bearbeitet 03 Jul '18, 01:17

Da vermutlich eher die zweitere Alternative, weil sich draw besser zwischen Koordinaten eignet. Mmmh, mal verstehen, was er da gemacht hat.

(02 Jul '18, 20:24) cis

Im von @saputello verlinkten Beispiel geht es durch Nachzeichnen der Pfeile mit der InnerWhite-Option.

Ganzes Beispiel:

alt text

Öffne in Overleaf
\documentclass[a4paper, landscape]{scrartcl}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}
%\usetikzlibrary{shapes.arrows}

\pagestyle{empty}
\begin{document}

\def\L{8 cm}
\def\m{2mm}
\begin{tikzpicture}[
overlay, transform shape, remember picture, shift={(current page.center)},
%
every node/.style={
draw, circle, fill=black,
font=\sffamily\bfseries\Huge,
text=white, 
outer sep=2*\m,
},
Pfeil/.style={
line width=0.5\m, 
double distance=1.5*\m,
arrows = {-Latex[length=0pt 3 0, fill=white]},
line cap=rect,
%shorten >=5mm,
},
InnerWhite/.style={white,
line width=0.15*\m, 
shorten >= 11.3/2*\m, 
double distance=1.2*\m,
}
]

\coordinate[label=A] (A) at (-\L,-\L);
\coordinate[label=B] (B) at (\L,-\L);
\coordinate[label=C] (C) at (\L,\L);
\coordinate[label=D] (D) at (-\L,\L);
\coordinate[label=M] (M) at (-\L,0);
\coordinate[label=N] (N) at (\L,0);
% Rechteck
%\draw[] (A) rectangle (C); 
% 12
\draw [Pfeil] (C) node[above right]{1} -- (A) ;
    \draw [InnerWhite] (C)  -- (A) ;
\draw [Pfeil,] ([xshift=-6*\m]A) node[below left]{2} -- ([xshift=-6*\m]C);
    \draw [InnerWhite] ([xshift=-6*\m]A) -- ([xshift=-6*\m]C);
% 3 4
\draw [Pfeil] (B) node[below right]{3} -- (D) ;
    \draw [InnerWhite] (B)  -- (D) ;
\draw [Pfeil,] ([xshift=-6*\m]D) node[above left]{4} -- ([xshift=-6*\m]B);
    \draw [InnerWhite] ([xshift=-6*\m]D) -- ([xshift=-6*\m]B);
% 6 7 
\draw [Pfeil] ([yshift=-3*\m]M) node[left]{6} -- ([yshift=-3*\m]N);
    \draw [InnerWhite] ([yshift=-3*\m]M) -- ([yshift=-3*\m]N);
\draw [Pfeil] ([yshift=3*\m]N) node[right]{7} -- ([yshift=3*\m]M);
    \draw [InnerWhite] ([yshift=3*\m]N)  -- ([yshift=3*\m]M);
% 5 
\node[xshift=-3*\m]{5};

\end{tikzpicture}

\end{document}
Permanenter link

beantwortet 02 Jul '18, 20:48

cis's gravatar image

cis
9.5k75452491
Akzeptiert-Rate: 29%

bearbeitet 02 Jul '18, 21:00

Hier ist noch eine Alternative von https://tex.stackexchange.com/a/432143/121799.

Öffne in Overleaf
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations,decorations.text} %  decorations.text just 4 fun
\pgfkeys{/tikz/.cd,
    outlined arrow width/.store in=\OutlinedArrowWidth,
    outlined arrow width=10pt,
    outlined arrow step/.store in=\OutlinedArrowStep,
    outlined arrow step=1pt,
    outlined arrow length/.store in=\OutlinedArrowLength,
    outlined arrow length=5pt,
}

\pgfdeclaredecoration{outlined arrow}{initial}
{% initial arrow butt
\state{initial}[width=\OutlinedArrowStep,next state=cont] {
    \pgfmoveto{\pgfpoint{\OutlinedArrowStep}{\OutlinedArrowWidth/2}}
    \pgfpathlineto{\pgfpoint{0.3\pgflinewidth}{\OutlinedArrowWidth/2}}
    \pgfpathlineto{\pgfpoint{0.3\pgflinewidth}{-\OutlinedArrowWidth/2}}
    \pgfpathlineto{\pgfpoint{1pt}{-\OutlinedArrowWidth/2}}
    \pgfcoordinate{lastup}{\pgfpoint{1pt}{\OutlinedArrowWidth/2}}
    \pgfcoordinate{lastdown}{\pgfpoint{1pt}{-\OutlinedArrowWidth/2}}
    \xdef\marmotarrowstart{0}
  }
  \state{cont}[width=\OutlinedArrowStep]{
    \ifdim\pgfdecoratedremainingdistance>\OutlinedArrowLength% continue the outlined path
     \pgfmoveto{\pgfpointanchor{lastup}{center}}
     \pgfpathlineto{\pgfpoint{\OutlinedArrowStep}{\OutlinedArrowWidth/2}}
     \pgfcoordinate{lastup}{\pgfpoint{\OutlinedArrowStep}{\OutlinedArrowWidth/2}}
     \pgfmoveto{\pgfpointanchor{lastdown}{center}}
     \pgfpathlineto{\pgfpoint{\OutlinedArrowStep}{-\OutlinedArrowWidth/2}}
     \pgfcoordinate{lastdown}{\pgfpoint{\OutlinedArrowStep}{-\OutlinedArrowWidth/2}}
    \else
     \ifnum\marmotarrowstart=0% draw the arrow head
     \pgfmoveto{\pgfpointadd{\pgfpointanchor{lastup}{center}}{\pgfpoint{-0.5\pgflinewidth}{0}}}
     \pgflineto{\pgfpoint{-0.5\pgflinewidth}{\OutlinedArrowWidth}}
     \pgflineto{\pgfpointadd{\pgfpointdecoratedpathlast}{\pgfpoint{-0.5\pgflinewidth}{0}}}
     \pgflineto{\pgfpoint{-0.5\pgflinewidth}{-\OutlinedArrowWidth}}
     \pgflineto{\pgfpointadd{\pgfpointanchor{lastdown}{center}}{\pgfpoint{-0.5\pgflinewidth}{0}}}
     \xdef\marmotarrowstart{1}
     \else
     \fi
    \fi%
  }
  \state{final}[width=5pt]
  { % perhaps unnecessary but doesn't hurt either
    \pgfmoveto{\pgfpointdecoratedpathlast}
  }
}
\begin{document}

\begin{tikzpicture}[decoration=outlined arrow,font=\sffamily]
\pgfmathsetmacro{\L}{2}
\coordinate[label=A] (A) at (-\L,-\L);
\coordinate[label=B] (B) at (\L,-\L);
\coordinate[label=C] (C) at (\L,\L);
\coordinate[label=D] (D) at (-\L,\L);
  \draw[decorate,blue,opacity=0.5] (A) to (C);
\begin{scope}[xshift=5cm]
\coordinate[label=A] (A) at (-\L,-\L);
\coordinate[label=B] (B) at (\L,-\L);
\coordinate[label=C] (C) at (\L,\L);
\coordinate[label=D] (D) at (-\L,\L);
  \draw[decorate,outlined arrow length=15pt] (A.east) to[out=0,in=-180] (C.west);
  \fill[decoration={text along path, text={~here is some text inside an arrow},
  raise=-2.5pt},decorate]
  (A.east) to[out=0,in=-180] (C.west);
\end{scope}
\end{tikzpicture}  
\end{document}

alt text

Eine andere Möglichkeit ist, shapes.arrows zu verwenden, siehe den Kommentar von cis und https://tex.stackexchange.com/a/432147/121799. Pro: etwas kürzer und einfacher zu modifizieren, z.B. Füllen der Pfeile. Contra: keine gekrümmten Pfeile.

Öffne in Overleaf
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.arrows}
\pgfkeys{/tikz/.cd,
    fat arrow width/.store in=\FatArrowWidth,
    fat arrow width=2pt,
}

\newcommand\importantstuff[3][]{ % https://tex.stackexchange.com/a/40855/121799
    \node[black!15!white,scale=2] at ([xshift=0.5mm,yshift=-0.5mm]#2) 
    {\sffamily\textbf{#3}};
    \node[#1,scale=2] (#3) at (#2) {\sffamily\textbf{#3}};
}
\begin{document}

\begin{tikzpicture}[
  fat arrow/.style={
    every to/.style={
      to path={
        let \p1 = ($(\tikztotarget)-(\tikztostart)$),
            \n1 = {veclen(\x1,\y1)},
            \n2 = {mod(scalar(atan2(\y1,\x1))+360, 360)} % calculate angle in range [0,360)
        in
        -- (\tikztotarget)
        node[draw, 
             inner xsep=0pt,inner ysep=\FatArrowWidth, % use inner ysep to set width
             minimum height={\n1-\pgflinewidth},
             single arrow,
             single arrow head extend=1.5mm,
             rotate=\n2, % not shape border rotate, because that for some reason didn't work
             anchor=tip,#1
             ]
          {} \tikztonodes}
  }}]
  \importantstuff[yellow]{60:2}{1}
  \importantstuff[yellow]{240:2}{2}
  \importantstuff[yellow]{300:2}{3}
  \importantstuff[yellow]{120:2}{4}
  \importantstuff[yellow]{180:2}{6}
  \importantstuff[yellow]{0:2}{7}
  \path[fat arrow={fill=white}] (127:1.7) to (293:1.5);
  \path[fat arrow={fill=white}] (307:1.7) to (113:1.5);
  \path[fat arrow={fill=white}] (233:1.7) to (67:1.5);
  \path[fat arrow={fill=white}] (53:1.7) to (247:1.5);
  \path[fat arrow={fill=white}] (7:1.7) to (173:1.5);
  \path[fat arrow={fill=white}] (187:1.7) to (-7:1.5);
  \importantstuff[yellow]{0:0}{5}
\end{tikzpicture}
\end{document}

alt text

Permanenter link

beantwortet 02 Jul '18, 22:35

Community's gravatar image

Community
21
Akzeptiert-Rate: 56%

bearbeitet 03 Jul '18, 05:09

Gel%C3%B6scht's gravatar image

Gelöscht
(ausgesetzt)

Das Ergebnis sieht gut aus, aber scheint mir reichlich kompliziert umgesetzt. Ich dachte anfangs, man könne ggf. den single aurrow (ein node-Pfeil, kein Pfad-Pfeil!) aus \usetikzlibrary{shapes.arrows} (nicht ~.meta) verwenden, etwa mit path picture. Aber das klappte irgendwie nicht. Wäre ggf. die einfachste Lösung.

(03 Jul '18, 00:33) cis

@cis Über kompliziert oder nicht möchte ich hier nicht streiten, aber das mit den shapes geht natürlich schon, siehe https://tex.stackexchange.com/a/432147/121799. Der Grund warum ich das nicht 100% mag, ist dass man damit keine gekrümmten Pfeile hinkriegt. (Aber meine Lösung geht auch schief, wenn die Pfeile stark gekrümmt sind...)

(03 Jul '18, 02:46) Community
Deine Antwort
Vorschau umschalten

Folgen dieser Frage

Per E-Mail:

Wenn sie sich anmelden, kommen Sie für alle Updates hier in Frage

Per RSS:

Antworten

Antworten und Kommentare

Markdown-Grundlagen

  • *kursiv* oder _kursiv_
  • **Fett** oder __Fett__
  • Link:[Text](http://url.com/ "Titel")
  • Bild?![alt Text](/path/img.jpg "Titel")
  • nummerierte Liste: 1. Foo 2. Bar
  • zum Hinzufügen ein Zeilenumbruchs fügen Sie einfach zwei Leerzeichen an die Stelle an der die neue Linie sein soll.
  • grundlegende HTML-Tags werden ebenfalls unterstützt

Frage-Themen:

×728
×6

gestellte Frage: 02 Jul '18, 19:22

Frage wurde gesehen: 7,737 Mal

zuletzt geändert: 03 Jul '18, 05:09