Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

I'm preparing some lecture notes and have some trouble creating an encircled arrow like the one in the picture.

What I'd like to do is to create an elliptic shape around an arrow defined in TikZ (like the one in the code example).

\draw[->] (0,0) -- (1,1);

enter image description here

Here's the full code for the picture:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{mhchem}
\usepackage{textgreek}

\usetikzlibrary{decorations,decorations.pathreplacing,decorations.pathmorphing}

\begin{document}

\begin{tikzpicture}
    \draw (-0.5,-1) node{+}
    (-0.5,5) node{-}
    (-0.5,5.5) node{Redoxpotential}
    (2,-3.7) node{Fotosystem II}
    (6,-2) node{Fotosystem I};
    \path (0.7,-0.7) node(1) {ljus}
    (2,-2) node[rectangle,draw](2) {P680}
    (2,3) node(3) {\ce{e-}}
    (3,2) node(4) {\ce{QH2}}
    (4,1) node(5) {Cyt b$_6$f}
    (3,0) node(6) {\ce{H+} lumen}
    (5,0) node(7) {Plastocyanin}
    (6,-1) node[rectangle,draw](8) {P700}
    (7.2,0.2) node(9) {ljus}
    (6,4) node(10) {\ce{e-}}
    (7.5,2.5) node(11) {\ce{e-}-redoxin (Fd)};
    \draw[decorate, decoration={snake},draw=red,->] (1) -- (2);
    \draw[->] (1.5,-2.74) to[out=60,in=180] (2,-2.24) to[out=0,in=120] (2.5,-2.74);
    \draw (1.3,-2.94) node[]{\ce{2H2O}} (2.98,-2.907)node[]{\ce{O2 + 4H+}};
    \draw[->] (2) -- (3);
    \draw[->] (3) -- node[midway,right]{\ce{e-}-transportkedja} (4);
    \draw[->] (4) -- (5);
    \draw[->] (5) -- (6);
    \draw[->] (5) -- (7);
    \draw[->] (7) -- (8);
    \draw[decorate, decoration={snake},draw=red,->] (9) -- (8);
    \draw[->] (8) -- (10);
    \draw[->] (10) -- node[midway,right]{\ce{e-}-transportkedja} (11);
    \draw[->] (11) -- (8.5,1.5);
    \draw[->] (8.15,0.95) node[below]{NADP} to[out=75,in=215] (8.5,1.5) to[out=35,in=190] (9.1,1.7) node[right]{NADPH};
    \draw (7.6,0) node[right]{\ce{2Fd + NADP -> 2Fd + NADPH}};
    \draw[dotted,->] (11) -- (5);
\end{tikzpicture}

\end{document}
share|improve this question

marked as duplicate by zeroth, Jake, hpesoj626, Thorsten, lockstep Mar 19 '13 at 8:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Could you provide some example code of what you've done so far? Thank's in advance! –  Thanos Mar 19 '13 at 7:18
    
@Thanos Here you go –  Hugo Mar 19 '13 at 7:25
    
    
Ah, I didn't see that... Well, here it is again. Should probably be closed as duplicate. –  zeroth Mar 19 '13 at 7:56

1 Answer 1

up vote 4 down vote accepted

You can realize this drawing by in line calculation of the elliptic shape.

That is, you need to calculate:

  1. The radius of the elliptic shape
  2. The angle at which it resides.
  3. The center of the elliptic shape

All of these can be performed using the calc library of TikZ.

Here is an example:

\begin{tikzpicture}
  \coordinate (a) at (0,0); % Save the end-coordinates of the arrow
  \coordinate (b) at (4,7);
  \draw[->] (a) -- (b);
                  % Calculate the vector from a to b:
  \draw let \p1 = ($(b)-(a)$),
                  % radius of the elliptic shape, along the arrow:
            \n1 = {veclen(\x1,\y1)/2},
                  % angle of rotation:
            \n2 = {atan(\y1/\x1)}
             % START DRAWING
            in ($(a)!.5!(b)$) circle[x radius=\n1,
                                     y radius=20pt,
                                     rotate=\n2];
\end{tikzpicture}

Notice that in \n1 = ... you can also add values so that you get an extent of the elliptic shape around the arrow.

Notice also that you can pretty much do whatever you want in this environment, by reusing the coordinates.

enter image description here

share|improve this answer

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