5

As you know, I'm adding more arrows to the code in this answer (maybe tomorrow). At this point, I'd like to overwrite the arrows declarations so that one can simply write -latex instead of -latex new, but TikZ gives me an error because the arrow names have already been used. Is there a way to bypass this behaviour and redefine an arrow tip?

Example of code:

\documentclass[tikz, border=1pt]{standalone}
\usepackage{tikz}

\pgfarrowsdeclare{space}{space}
{
  \pgfutil@tempdima=0.88pt%
  \advance\pgfutil@tempdima by.3\pgflinewidth%
  \pgfarrowsleftextend{0pt}
  \pgfarrowsrightextend{\pgfutil@tempdima}
}
{}

\begin{document}
\begin{tikzpicture}
\draw [-space] (0,0) -- (1,0);
\end{tikzpicture}
\end{document}
Luigi
  • 6,325
  • 3
    I would define your arrows with unique names and then give the user the option of substituting them for the original names at the top level. – Andrew Stacey Nov 11 '12 at 20:13
  • @AndrewStacey I'm following your advice. – Luigi Nov 12 '12 at 10:41
  • I hope that this means you're packaging your arrows into a proper package. – Andrew Stacey Nov 12 '12 at 10:42
  • 1
    @AndrewStacey, I edited all the available arrow tips, except for almost 0d ones (like line caps) and implies, and I wrote to Till Tantau. Now I'm waiting for a reply. – Luigi Nov 12 '12 at 16:52

1 Answers1

4

Well, it's not recommended but you can bypass the already defined? test.

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

\makeatletter
\def\pgf@arrows@check@already#1#2#3{%
   {#3}%
}

\pgfarrowsdeclare{space}{space}
{
  \pgfutil@tempdima=0.88pt%
  \advance\pgfutil@tempdima by.3\pgflinewidth%
  \pgfarrowsleftextend{0pt}
  \pgfarrowsrightextend{\pgfutil@tempdima}
}
{}
\makeatother

\begin{document}
\begin{tikzpicture}
\draw [-space] (0,0) -- (1,0);
\end{tikzpicture}
\end{document}
Luigi
  • 6,325
percusse
  • 157,807
  • +1 Maybe this is the right way. I don't know if there are any collateral effects. I think I'll reactivate the "already defined" definition at the end of the code. Thanks – Luigi Nov 11 '12 at 19:21
  • do you think I should leave the code as is (i.e. with the latex new arrow)? – Luigi Nov 11 '12 at 19:29
  • @Luigi It seems that this is the only sanity check regarding the definition of the arrow so my humble opinion is that this is a risk that one can take but then again it's just me ;) – percusse Nov 11 '12 at 19:36