4

MWE:

\documentclass[12pt]{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta, graphs, matrix, quotes}

\usepackage{fancyhdr}
\pagestyle{empty}

\begin{document}
  \begin{tikzpicture}
    \matrix[matrix of nodes, column sep= 2em] {
      |(n1)| node 1 & |(n2)| node 2 \\
      |(n3)| node 3 \\
    };
    \graph[use existing nodes]{
      n1 -> ["label"] n2;
      % n2.east -> ["label"] n3.east;
      n2.east -> [to path={-- ++(1em, 0)  |- (\tikztotarget)}] 
n3.east;
    };
  \end{tikzpicture}

  \begin{tikzpicture}
    \matrix[matrix of nodes, column sep= 2em] {
      |(n1)| node 1 & |(n2)| node 2 \\
      |(n3)| node 3 \\
    };
    \graph[use existing nodes]{
      n1 -> ["label"] n2;
      n2.east -> ["label"] n3.east;
      % n2.east -> [to path={-- ++(1em, 0)  |- (\tikztotarget)}] 
      % n3.east;
    };
  \end{tikzpicture}
\end{document}

Example of nodes

In the first example, I have shaped the edge. In the second one, I have labeled, but not shaped, that edge. I tried using to path and the quotes syntax together, but:

  • If I do it in that order, it has no effect (only shaped edge)
  • If I reverse the order of the options, the label appears, but the edge is straight

How can I do both things at the same time?

amyspark
  • 628

0 Answers0