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?

2
  • You are missing \tikztonodes in your custom to path as the last item
    – percusse
    Apr 12, 2018 at 12:31
  • simple as that. thank you. if you type an answer I will marked it as the right one. Apr 12, 2018 at 14:12

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .