3

I've got two nodes connected by a path, the path is lettered using one node above and another one below. The lower one consists of three lines.

Right now the lower node doesn't look well, because although everything should be aligned, the first line starts different than the second and that's why the alignment looks bad. I would like to have both 't's and the dots above each other while ignoring that the '/' is not aligned. This is the code I use:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
    \begin{tikzpicture}
    \node(initial) {state 1};
    \node[right=6cm of initial](final) {state 2};
    \draw[-latex] (initial) to node[above]{triggering action [condition]} 
    node [below, align=left] {/ triggered action 1;\\triggered action 2;\\\dots} (final);
    \end{tikzpicture}
\end{document}

I've already tried the following, but it didn't work:

node [below] {/ \flushleft{triggered action 1;\\triggered action 2;\\\dots}} (final);

How can I align the lines correctly? Problem

  • 1
    Alternatively, you could use a tabular in the lower node. – John Kormylo Mar 31 '16 at 1:15
3

Like this?

left lapping

This uses a non-TikZ solution for the crucial change:

\documentclass[tikz,multi,border=10pt]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
  \node(initial) {state 1};
  \node[right=6cm of initial](final) {state 2};
  \draw[-latex] (initial) to node[above]{triggering action [condition]}
  node [below, align=left] {\llap{/ }triggered action 1;\\triggered action 2;\\\dots} (final);
\end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.