2

I have three nodes and want to connect two nodes with an arrow that is bent like in my paint drawing. I also need to include some text above the arrow.

enter image description here

This is my stripped down code for generating the nodes:

\documentclass{standalone}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node[draw=none,fill=none, text height=1em] (1) {test1};
\node[draw=none,fill=none, text height=1em] (2) [right=.6cm of 1 ]{test2};
\node[draw=none,fill=none, text height=1em] (3) [right=.6cm of 2]{test3};
\end{tikzpicture}
\end{document}

In the past, I've connected nodes with a curve, like this:

\path[every node/.style={font=\sffamily\small}]
    (3)edge [bend angle=90] node[above left] {foo} (1);

Unfortunately I can't adapt this code to look like the picture above.

I guess I could insert "invisible" nodes to fake the corners of the arrow, but TikZ might have a simple option for my desired output, that I wasn't able to find?

6

This is a possible solution where the vertical height due to +(0,1) can be changed to suit one's need.

enter image description here

Code

\documentclass[border=10pt]{standalone}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}
\node[draw=none,fill=none, text height=1em] (1) {test1};
\node[draw=none,fill=none, text height=1em] (2) [right=.6cm of 1 ]{test2};
\node[draw=none,fill=none, text height=1em] (3) [right=.6cm of 2]{test3};
\draw (3.north) -- +(0,1)-| node[above right]{Text starts from there} (1);
\end{tikzpicture}
\end{document}
5
\usetikzlibrary{arrows,calc}
\usetikzlibrary{positioning}
\begin{tikzpicture}
\node[draw=none,fill=none, text height=1em] (1) {test1};
\node[draw=none,fill=none, text height=1em] (2) [right=.6cm of 1 ]{test2};
\node[draw=none,fill=none, text height=1em] (3) [right=.6cm of 2]{test3};
\draw[->, every node/.style={font=\sffamily\small}] 
   (3) -- ($(3)+(0,.5)$) -- ($(1)+(0,.5)$) node[above, pos=0.8] {some text} -- (1) ; 
\end{tikzpicture}

Result

2

For fun, here is a nontikz version.

\documentclass{article}
\usepackage{stackengine}
\usepackage{xcolor}
\newcommand\leftbentarrow[4][]{\setstackgap{L}{.3\baselineskip}%
  \setbox0=\hbox{#2}%
  \def\stackalignment{r}\stackon{#2}{\def\stackalignment{l}%
    \stackon[-.2pt]{\makebox[0pt]{$\downarrow$}}%
    {\trlap{\textcolor{cyan}{\sffamily#1}}\rule{.5\wd0}{.4pt}}}%
  \setbox0=\hbox{#3}%
  \setbox1=\hbox{$\downarrow$}%
  \def\stackalignment{c}\stackon[\Sstackgap+\dp1+\ht1-.2pt]{#3}{\rule{\wd0}{.4pt}}%
  \setbox0=\hbox{#4}%
  \def\stackalignment{l}\stackon{#4}{\def\stackalignment{r}%
    \stackon[-.2pt]{\makebox[0pt]{\rule{.4pt}{\ht1+\dp1}}}{\rule{.5\wd0}{.4pt}}}%
}
\usepackage{lipsum}
\parskip 1em
\begin{document}
\leftbentarrow[some text]{test1}{ test2 test2a }{test3}

\leftbentarrow[some text]{test1}{\makebox[1in]{test2}}{test3}
\end{document}

enter image description here

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.