Vous êtes sur la page 1sur 3

sign up log in tour help

_
TeX - LaTeX Stack Exchange is a Here's how it works:
question and answer site for users
of TeX, LaTeX, ConTeXt, and related
typesetting systems. Join them; it
only takes a minute:
The best answers are
Sign up Anybody can Anybody can voted up and rise to the
ask a question answer top

Add text and arrows in this tikz picture

I am trying to create a small scheme for the so called Goldbeter-Koshland loop. I'm almost done, but I have to include the text
$E_1$ above the arrow that goes from P to P* and a small arrow that goes from the base of the text to the middle of the arrow.
How can I do that? So far I have the following code:

\begin{figure}
\centering
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-2,0) {$P$};
\node[protein] (ps) at (2,0) {$P^*$}
edge [towards, bend left] (p)
edge [from,bend right] (p) ;
\end{tikzpicture}
\end{figure}

I would like the figure to look something like:

E_1
|
--->
P1 P2
<---
|
E_2

Thanks in advance!

{tikz-pgf}

asked Nov 2 '12 at 18:43


lucacerone
331 6 14

2 Answers

Add a nodes with names and then draw the arrows:

\documentclass[12pt]{article}
\usepackage{tikz}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-2,0) {$P$};
\node[protein] (ps) at (2,0) {$P^*$}
edge [towards, bend left] node[below=20pt,name=e2] {$E_2$} (p)
edge [from,bend right] node[above=20pt,name=e1] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-25pt);
\draw[->] (e2) -- +(0pt,25pt);
\end{tikzpicture}
\end{figure}

\end{document}

answered Nov 2 '12 at 18:53


Gonzalo Medina
356k 29 1144
1442

You can just add a node.

Notes:

You can adjust the position along the line by pos= option. I placed it at 0.5 which
is the same as midway . See Moving a label along the path for more details.
The above and below options are added so that the label is not on the line itself.

Code:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-2,0) {$P$};
\node[protein] (ps) at (2,0) {$P^*$}
edge [towards, bend left] node [pos=0.5, below] {$E_2$} (p)
edge [from, bend right] node [pos=0.5, above] {$E_1$} (p) ;
\end{tikzpicture}
\end{figure}
\end{document}

edited Apr 13 at 12:35 answered Nov 2 '12 at 18:49


Community ♦ Peter Grill
1 148k 19 378 681

    With auto and swap you don't have to manually position the nodes at the arrows. – Qrrbrbirlbel Nov 2
'12 at 18:52

    @Qrrbrbirlbel: I am not familiar with those options. Using auto I get both nodes below the lines. Using
auto, swap I get both labels above the lines. Using auto for the first one and auto, swap does yield
the desired result. Is that what you meant? – Peter Grill Nov 2 '12 at 18:56

    Yes, it is. Normally one would issue auto=[left|right] to the outer scope and use only swap where it's
needed. In this instance, I'd set auto and just use \path[bend left, towards] (ps) edge node {$E_2$}
(p) (p) edge node {$E_1$} (ps); … no need to set any manual positions. – Qrrbrbirlbel Nov 2 '12 at
19:02

Vous aimerez peut-être aussi