[Tex/LaTex] meta arrow tips

arrowstikz-pgf

Page 316 of the tikz-pfg manual describes meta arrow tips and says that usually we do not want to have the tip scaled the same way as the supporting line. Is there a way to keep this feature, ie, when using line width=5pt, the tip should be five times bigger than for line width=1pt?

Best Answer

The v2.10 pgfmanual discusses these on Page 609. It shows both the meta arrows and the resized arrows.

In the TeX code for the manual the arrow tips were coded using pgfarrowsdeclare. Based on this, I would assume that there is not an existing option to simply have the arrows resized based on the line width. So, if you want to use them you would need to include the code shown below for the bad latex and bad to arrow styles in your document. Then to select them instead of specifying the arrows as [-latex] or [-to] arrows, you would simply use [-bad latex] or [-bad to].

Below is a comparison. The red arrows are resized according to the line size, and the blue ones are the meta arrows that are not simply scaled. From the small and large line widths it is clear that the meta arrows produce better looking results:

enter image description here

Here is the code which is copied almost directly from pgfmanual-en-base-arrows.tex:

\documentclass{article}
\usepackage{tikz}
\usepackage{soul}% for highlighting output

\begin{document}

\pgfarrowsdeclare{bad latex}{bad latex}
{
  \pgfarrowsleftextend{-1\pgflinewidth}
  \pgfarrowsrightextend{9\pgflinewidth}
}
{
  \pgfpathmoveto{\pgfpoint{9\pgflinewidth}{0pt}}
  \pgfpathcurveto
  {\pgfpoint{6.3333\pgflinewidth}{.5\pgflinewidth}}
  {\pgfpoint{2\pgflinewidth}{2\pgflinewidth}}
  {\pgfpoint{-1\pgflinewidth}{3.75\pgflinewidth}}
  \pgfpathlineto{\pgfpoint{-1\pgflinewidth}{-3.75\pgflinewidth}}
  \pgfpathcurveto
  {\pgfpoint{2\pgflinewidth}{-2\pgflinewidth}}
  {\pgfpoint{6.3333\pgflinewidth}{-.5\pgflinewidth}}
  {\pgfpoint{9\pgflinewidth}{0pt}}
  \pgfusepathqfill
}

\pgfarrowsdeclare{bad to}{bad to}
{
  \pgfarrowsleftextend{-2\pgflinewidth}
  \pgfarrowsrightextend{\pgflinewidth}
}
{
  \pgfsetlinewidth{0.8\pgflinewidth}
  \pgfsetdash{}{0pt}
  \pgfsetroundcap
  \pgfsetroundjoin
  \pgfpathmoveto{\pgfpoint{-3\pgflinewidth}{4\pgflinewidth}}
  \pgfpathcurveto
  {\pgfpoint{-2.75\pgflinewidth}{2.5\pgflinewidth}}
  {\pgfpoint{0pt}{0.25\pgflinewidth}}
  {\pgfpoint{0.75\pgflinewidth}{0pt}}
  \pgfpathcurveto
  {\pgfpoint{0pt}{-0.25\pgflinewidth}}
  {\pgfpoint{-2.75\pgflinewidth}{-2.5\pgflinewidth}}
  {\pgfpoint{-3\pgflinewidth}{-4\pgflinewidth}}
  \pgfusepathqstroke
}

\newcommand*{\ArrowType}[1]{\hl{\textbf{-#1}}}%

\sethlcolor{lightgray}
These are the \emph{resized} \ArrowType{bad latex} and \ArrowType{bad to} arrows:

\medskip
\begin{tikzpicture}[draw=red,fill=red]
  \draw[-bad latex,line width=0.1pt] (0pt,0ex) -- +(3,0)  node[thin,right] {line width is 0.1pt};
  \draw[-bad latex,line width=0.4pt] (0pt,-2em) -- +(3,0) node[thin,right] {line width is 0.4pt};
  \draw[-bad latex,line width=1.2pt] (0pt,-4em) -- +(3,0) node[thin,right] {line width is 1.2pt};
  \draw[-bad latex,line width=5pt]   (0pt,-6em) -- +(3,0) node[thin,right] {line width is 5pt};

  \draw[-bad to,line width=0.1pt] (6cm,0ex) -- +(3,0)  node[thin,right] {line width is 0.1pt};
  \draw[-bad to,line width=0.4pt] (6cm,-2em) -- +(3,0) node[thin,right] {line width is 0.4pt};
  \draw[-bad to,line width=1.2pt] (6cm,-4em) -- +(3,0) node[thin,right] {line width is 1.2pt};
  \draw[-bad to,line width=5pt]   (6cm,-6em) -- +(3,0) node[thin,right] {line width is 5pt};
\end{tikzpicture}

\bigskip\bigskip
And the standard meta \ArrowType{latex} and \ArrowType{to} arrows:

\medskip
\begin{tikzpicture}[draw=blue,fill=blue]
  \draw[-latex,line width=0.1pt] (0pt,0ex) -- +(3,0)  node[thin,right] {line width is 0.1pt};
  \draw[-latex,line width=0.4pt] (0pt,-2em) -- +(3,0) node[thin,right] {line width is 0.4pt};
  \draw[-latex,line width=1.2pt] (0pt,-4em) -- +(3,0) node[thin,right] {line width is 1.2pt};
  \draw[-latex,line width=5pt]   (0pt,-6em) -- +(3,0) node[thin,right] {line width is 5pt};

  \draw[-to,line width=0.1pt] (6cm,0ex) -- +(3,0)  node[thin,right] {line width is 0.1pt};
  \draw[-to,line width=0.4pt] (6cm,-2em) -- +(3,0) node[thin,right] {line width is 0.4pt};
  \draw[-to,line width=1.2pt] (6cm,-4em) -- +(3,0) node[thin,right] {line width is 1.2pt};
  \draw[-to,line width=5pt]   (6cm,-6em) -- +(3,0) node[thin,right] {line width is 5pt};
\end{tikzpicture}

\end{document}