3

I would like to define a custom path style (egs. skip loop from http://www.texample.net/tikz/examples/diagram-chains/) and still be able to position a node at any position on the path (midway, near end, at start, pos=0.3, ect.). As soon as I use a customly defined style for the path, the node disappears. Please see the following minimal working example:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[%
    ,>=latex%
    ,skip loop/.style={to path={-- ++(0,#1) -| (\tikztotarget)}}%
    ]

    % bended path: node is visible
    \draw [<->] (0,0) to [bend left] node [near start,above] {x} (4,0);

    % custom path: node is invisible
    \draw [<->] (0,-1.5) to [skip loop=1] node [near start,above] {y} (4,-1.5);

\end{tikzpicture}
\end{document}

mwe_output

I would like to use the \draw command and avoid the \path command. Is there a possibility?

1 Answers1

3

Custom to paths require the \tikztonodes macro to place the collected nodes on the path. So it should read

skip loop/.style={to path={-- ++(0,#1) -| (\tikztotarget)\tikztonodes}}

to process the nodes.

percusse
  • 157,807