7

The following code pasted from the PGF manual pag. 1025 does not compile on my end.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\pgfdeclarearrow{
name = foo,
parameters = { \the\pgfarrowlength },
setup code = {
% The different end values:
\pgfarrowssettipend{.25\pgfarrowlength}
\pgfarrowssetlineend{-.25\pgfarrowlength}
\pgfarrowssetvisualbackend{-.5\pgfarrowlength}
\pgfarrowssetbackend{-.75\pgfarrowlength}
% The hull
\pgfarrowshullpoint{.25\pgfarrowlength}{0pt}
\pgfarrowshullpoint{-.75\pgfarrowlength}{.5\pgfarrowlength}
\pgfarrowshullpoint{-.75\pgfarrowlength}{-.5\pgfarrowlength}
% Saves: Only the length:
\pgfarrowssavethe\pgfarrowlength
},
drawing code = {
\pgfpathmoveto{.25\pgfarrowlength}{0pt}
\pgfpathlineto{-.75\pgfarrowlength}{.5\pgfarrowlength}
\pgfpathlineto{-.5\pgfarrowlength}{0pt}
\pgfpathlineto{-.75\pgfarrowlength}{-.5\pgfarrowlength}
\pgfpathclose
\pgfusepathqfill
},
defaults = { length = 4cm }
}


\begin{document}

\tikz \draw [-foo] (0,0) -- (8,0);

\end{document}

What is wrong?

  • 2
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. I can confirm that the MWE above does not compile with an error about a missing number for \advance. – moewe Oct 13 '14 at 8:55
  • 1
    It seems to work if you \pgfpathmoveto{.25\pgfarrowlength}{0pt} by \pgfpathmoveto{\pgfpoint{.25\pgfarrowlength}{0pt}} and do the same for the lines containing pgfpathlineto. According to the doc, \pgfpathmoveto and \pgfpathmoveto now take a PGF-Coordinate and not x and y values. It seems that the example was not updated to reflect the (new ? - not sure) syntax of this command. You could notify the author so he can fix this small issue in the next release. – moewe Oct 13 '14 at 8:58
5

The drawing code is actually this:

\pgfpathmoveto{\pgfqpoint{.25\pgfarrowlength}{0pt}}
\pgfpathlineto{\pgfqpoint{-.75\pgfarrowlength}{.5\pgfarrowlength}}
\pgfpathlineto{\pgfqpoint{-.5\pgfarrowlength}{0pt}}
\pgfpathlineto{\pgfqpoint{-.75\pgfarrowlength}{-.5\pgfarrowlength}}
\pgfpathclose
\pgfusepathqfill

If you put that instead of the one you have, it works.

I checked the manual source. The used code is different from what you see in the PDF. Don't know why.

| improve this answer | |
  • Thanks. Where do I find the manual source code? – EdTeX Oct 13 '14 at 9:03
  • With TeX Live: texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-arrows.tex – Old Nick Oct 13 '14 at 9:06
  • 3
    It's a typo. What you have should have been stated instead. – percusse Oct 13 '14 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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