Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
Which version of the pgfmanual are you refering? –  Azoun Sep 25 '11 at 16:29
    
v1.18: maybe an old one. –  pluton Sep 25 '11 at 16:31
2  
pgmanual v2.10 you are refering to pag.609 –  Azoun Sep 25 '11 at 16:34
    
If you want to produce exactly the same results as in the section of the manual you referred to, you may want to have a look at the code with which these were created: It is available in the file pgfmanual-en-base-arrows.tex. Look at the definitions of \pgfarrowsdeclare{bad latex} and \pgfarrowsdeclare{bad to}. –  diabonas Sep 25 '11 at 16:43
    
What can be done if I want to add parameters to arrows tip? –  Azoun Sep 25 '11 at 16:48
add comment

1 Answer

up vote 10 down vote accepted

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.