TransWikia.com

Text on Left of Arrow in Flow Diagram

TeX - LaTeX Asked on May 1, 2021

I have a flow diagram where text appears on the right of the arrow. I want to shift to the left of the arrow, is that possible?

enter image description here

begin{center}

 begin{tikzpicture}[auto,
    node distance = 3mm and 2mm,
      start chain = A going below,
       arr/.style = {-Stealth},
every edge/.style = {draw, arr},
        BC/.style = {decorate,  % Brace Calligraphic
                     decoration={calligraphic brace, amplitude=2mm,
                                 raise=1mm, mirror},
                     very thick, pen colour={black}
                    },
       box/.style = {draw, rounded corners, fill=blue!20, align=center,
                     minimum height=5ex, text width=5.5em},
  decision/.style = {diamond, aspect=1.5, draw, fill=blue!20,
                    inner xsep=-3pt, minimum width=5.4em, align=center},
    ellip/.style = { ellipse, aspect=1.5,draw, fill=blue!20,
                    inner xsep=-3pt, text width=5.4em, align=center},
                        ]
% nodes in chain
    begin{scope}[nodes={on chain=A, join=by arr}]
node   [box]     {start};         % name=A-1
node   [box]       {end};

    end{scope}

 draw[arr] (A-1.south) -- node{This Text} (A-2.north);

end{tikzpicture}
    end{center}

One Answer

In order to make the text next to the downward pointing arrow appear left of the arrow instead of on the right, you can use swap:

From the pgf manual:

enter image description here

enter image description here

documentclass{article}
usepackage{tikz}
usetikzlibrary{chains, arrows.meta}
begin{document}

begin{center}

 begin{tikzpicture}[auto,
    node distance = 3mm and 2mm,
      start chain = A going below,
       arr/.style = {-Stealth},
every edge/.style = {draw, arr},
        BC/.style = {decorate,  % Brace Calligraphic
                     decoration={calligraphic brace, amplitude=2mm,
                                 raise=1mm, mirror},
                     very thick, pen colour={black}
                    },
       box/.style = {draw, rounded corners, fill=blue!20, align=center,
                     minimum height=5ex, text width=5.5em},
  decision/.style = {diamond, aspect=1.5, draw, fill=blue!20,
                    inner xsep=-3pt, minimum width=5.4em, align=center},
    ellip/.style = { ellipse, aspect=1.5,draw, fill=blue!20,
                    inner xsep=-3pt, text width=5.4em, align=center},
                        ]
% nodes in chain
    begin{scope}[nodes={on chain=A, join=by arr}]
node   [box]     {start};         % name=A-1
node   [box]       {end};

    end{scope}

 draw[arr, swap] (A-1.south) -- node{This Text} (A-2.north);

end{tikzpicture}
    end{center}


end{document}

Correct answer by leandriis on May 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP