# Tikz: name path gets lost when using markings decoration

I am trying to draw an arrowhead inside a curved path named uu that is crossed by a vertical line named vert, and two nodes placed at the intersections of these two paths. Here is my minimal example:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections,decorations.markings}

\tikzset{->-/.style={decoration={
markings,
mark=at position #1 with {\arrow{>}}},
postaction={decorate}}
}

\begin{document}

\begin{tikzpicture}
\path[draw, name path=vert] (0,-1)--(0,1);
\path[draw, ->-=0.8, name path=uu] (-1,-0.7) to[out=0,in=-90] (0.3,0)
to[out=90,in=0] (-1,0.7);
\draw [name intersections={of=vert and uu}] (intersection-1)  node {o};
\draw [name intersections={of=vert and uu}] (intersection-2)  node {o};
\end{tikzpicture}

\end{document}


Compiling it produces the following error message:

! Package tikz Error: I do not know the path named uu'. Perhaps you misspelt it.


The ->-=0.8 option in the uu path somehow kills the name uu. How can I solve this problem?

• What document class and what latex distribution do you use? With standalone document class your code throws no errors in overleaf! Jul 22 '19 at 14:19
• article or standalone, this doesn't matter. One gets the error message Package tikz Error: I do not know the path named uu'. Perhaps you misspelt it. Jul 22 '19 at 14:37
• Your code works very well as is in overleaf. Which latex distribution do you use? maybe you need an update! Jul 22 '19 at 16:04
• @HafidBoukhoulda I'm not the OP, but I see the error with TL 2019. Jul 22 '19 at 16:12
• @HafidBoukhoulda I use miktex (the latest update) Jul 22 '19 at 16:17

I won't hazard an approximate explanation, but using code from Loop Space, you can perform the following steps separately:

1. define and name your uu path;

2. draw it, possibly applying decorations as a postaction.

This solves the problem here.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections,decorations.markings}

% Code from Loop Space: <https://tex.stackexchange.com/a/26386/73317>
\makeatletter
\tikzset{
use path for main/.code={%
\expandafter\pgfsyssoftpath@setcurrentpath\csname tikz@intersect@path@name@#1\endcsname
}%
},
use path for actions/.code={%
\expandafter\def\expandafter\tikz@preactions\expandafter{\tikz@preactions\expandafter\let\expandafter\tikz@actions@path\csname tikz@intersect@path@name@#1\endcsname}%
},
use path/.style={%
use path for main=#1,
use path for actions=#1,
}
}
\makeatother

\tikzset{->-/.style={decoration={
markings,
mark=at position #1 with {\arrow{>}}},
postaction={decorate}}
}

\begin{document}

\begin{tikzpicture}

\path[draw, name path=vert] (0,-1)--(0,1);

% First define and name the path
\path[name path=uu]
(-1,-0.7) to[out=0,in=-90] (0.3,0) to[out=90,in=0] (-1,0.7);
% Then draw it using the 'use path' style from Loop Space
\draw[use path=uu, ->-=0.8];

\draw [name intersections={of=vert and uu}] (intersection-1)  node {o};
\draw [name intersections={of=vert and uu}] (intersection-2)  node {o};

\end{tikzpicture}

\end{document}


• thanks a lot! It looks a bit more complicated than I hoped (knowing nothing about pgf and TeX in general) but it also looks powerful. Jul 22 '19 at 15:04
• The code provided in the OP works very fine in overleaf! Jul 22 '19 at 16:05

In a similar situation, I just discovered that replacing postaction with preaction does solve this "disappearing path" issue.

However, I am no Tikz expert, so I don't know if this solution is recommended.

And I don't have the same latex distribution as you, so I cannot check that this actually solves your problem.