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.

I'm using tikz to represent an axe. The code is the following:

\documentclass[a4paper,oneside,12pt]{article}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{trees}
\usepackage{relsize}
\usepackage{longtable,geometry}
\usepackage[frenchb]{babel}
\usepackage{wrapfig}
\usepackage{graphicx}
\geometry{dvips,a4paper,margin=1in}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[babel]{csquotes}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{decorations.shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{decorations.fractals}
\usetikzlibrary{decorations.footprints}
\MakeAutoQuote{«}{»}
\pagestyle{headings}

\begin{document}
\begin{center}
\begin{tikzpicture}
\draw[thick,>=stealth,->] (0,0) node[below] {$-\infty$} --  (2.8,0) node[below]  
{$\frac{\mathlarger{-e}}{\mathlarger{(1-\theta)}}-f$} node {$\bullet$} -- (5.6,0)
node[below] {$\frac{\mathlarger{-v}}{\mathlarger{(1-\theta)}}-f$} node {$\bullet$} --
(8.4,0) node[below] {$\frac{-2f-e-\sqrt{e^2-\frac{4ev}{1-\theta)}}}{2}$} node 
{$\bullet$} -- (11.4,0) node[below] {$\frac{-2f-e+\sqrt{e^2-\frac{4ev}
{1-\theta)}}}{2}$} node {$\bullet$} -- (14.2,0) node[below] {$-f$} node{$\bullet$}-- 
(17,0) node[below] {$\omega(M)$} ;

\draw[color=black,decorate,decoration={brace, raise=0.8cm}]
(0,0) -- (5.57,0) node[above,pos=0.5] {E1};

\draw[color=black,decorate,decoration={brace, raise=0.8cm}]
(5.63,0) -- (8.37,0) node[above,pos=0.5] {E1, E2};

\draw[color=black,decorate,decoration={brace, raise=0.8cm}]
(8.43,0) -- (11.37,0) node[above,pos=0.5] {E1, E2, E3};

\draw[color=black,decorate,decoration={brace, raise=0.8cm}]
(11.43,0) -- (14.17,0) node[above,pos=0.5] {E1, E2};

\draw[color=black,decorate,decoration={brace, raise=0.8cm}]
(14.23,0) -- (16.7,0) node[above,pos=0.5] {E2};

\draw[color=red,decorate,decoration={brace, mirror, raise=1.5cm}]
(0,0) -- (2.77,0) node[below,pos=0.49] {E5};

\draw[color=red,decorate,decoration={brace, mirror, raise=1.5cm}]
(2.83,0) -- (17,0) node[below,pos=0.5] {E4};
\end{tikzpicture}
\end{center}
\end{document}

How can I move the text E4 and E5 for it to be closer to the red brace?

Thanks in advance, and sorry if the layout is not the right one.

share|improve this question
    
I don't quite get the question but can you try using below=1cm in the E4 and E5 nodes? –  percusse Apr 23 '12 at 10:38

2 Answers 2

The below key takes an optional distance argument. Setting below=1.6cm works quite well in this case.

Note that you don't need to load the xcolors package explicitly (this is done by tikz) or the decorations library (it's loaded by the specific decorations libraries), and you have a lot of packages in your code that aren't needed for this example.

\documentclass[a4paper,oneside,12pt]{article}
\usepackage{tikz}
\usepackage{relsize}
\usetikzlibrary{decorations.pathreplacing}
\pagestyle{headings}

\begin{document}
\begin{center}
\begin{tikzpicture}
\draw[thick,>=stealth,->] (0,0) node[below] {$-\infty$} --  (2.8,0) node[below]  
{$\frac{\mathlarger{-e}}{\mathlarger{(1-\theta)}}-f$} node {$\bullet$} -- (5.6,0) node[below] {$\frac{\mathlarger{-v}}{\mathlarger{(1-\theta)}}-f$} node {$\bullet$} -- (8.4,0) node[below] {$\frac{-2f-e-\sqrt{e^2-\frac{4ev}{1-\theta)}}}{2}$} node {$\bullet$} -- (11.4,0) node[below] {$\frac{-2f-e+\sqrt{e^2-\frac{4ev}{1-\theta)}}}{2}$} node {$\bullet$} -- (14.2,0) node[below] {$-f$} node{$\bullet$}-- (17,0) node[below] {$\omega(M)$} ;

\draw[color=black,decorate,decoration={brace, raise=0.8cm}]
(0,0) -- (5.57,0) node[above=0.8cm,pos=0.5] {E1};

\draw[color=black,decorate,decoration={brace, raise=0.8cm}]
(5.63,0) -- (8.37,0) node[above=0.8cm,pos=0.5] {E1, E2};

\draw[color=black,decorate,decoration={brace, raise=0.8cm}]
(8.43,0) -- (11.37,0) node[above=0.8cm,pos=0.5] {E1, E2, E3};

\draw[color=black,decorate,decoration={brace, raise=0.8cm}]
(11.43,0) -- (14.17,0) node[above=0.8cm,pos=0.5] {E1, E2};

\draw[color=black,decorate,decoration={brace, raise=0.8cm}]
(14.23,0) -- (16.7,0) node[above=0.8cm,pos=0.5] {E2};

\draw[color=red,decorate,decoration={brace, mirror, raise=1.5cm}]
(0,0) -- (2.77,0) node[below=1.6cm,pos=0.49] {E5};

\draw[color=red,decorate,decoration={brace, mirror, raise=1.5cm}]
(2.83,0) -- (17,0) node[below=1.6cm,pos=0.5] {E4};
\end{tikzpicture}
\end{center}
\end{document}
share|improve this answer
    
Thank you! I know for the package but this is just a part of my document. I also have trees, some other graphs and all my master dissertation...Anyway, thanks again for your help and advices! –  Juliette Apr 23 '12 at 10:58
    
@Juliette don't forget to upvote Jake's answer, and if it solved your problem, click the green check mark; this gives Jake 25 reputation points and is the best way to say thanks :) –  cmhughes Apr 23 '12 at 11:11

You can add a touch of style! (I took the code of Jake's fine answer)

remark : (a) -- node {x} (b); by default pos=.5 update : a lot of node use belowso I modify every node/.stylebut to adjust other nodes, I created ce/.style={anchor=center}. below is the same option than anchor=south.

\begin{tikzpicture}[bst/.style={color=black,decorate,decoration={brace, raise=0.8cm}},
                    rst/.style={color=red,decorate,decoration={brace,mirror, raise=1.5cm}},
                    eti/.style={above=0.8cm},
                    every node/.style=below,
                    ce/.style={anchor=center}] 

\draw[thick,>=stealth,->] (0,0) 
  node     {$-\infty$}   -- (2.8,0)  node {$\frac{\mathlarger{-e}}{\mathlarger{(1-\theta)}}-f$} 
  node[ce] {$\bullet$}   -- (5.6,0)  node {$\frac{\mathlarger{-v}}{\mathlarger{(1-\theta)}}-f$} 
  node[ce] {$\bullet$}   -- (8.4,0)  node {$\frac{-2f-e-\sqrt{e^2-\frac{4ev}{1-\theta)}}}{2}$}  
  node[ce] {$\bullet$}   -- (11.4,0) node {$\frac{-2f-e+\sqrt{e^2-\frac{4ev}{1-\theta)}}}{2}$}  
  node[ce] {$\bullet$}   -- (14.2,0) node {$-f$} 
  node[ce] {$\bullet$}   -- (17,0)   node {$\omega(M)$} ;

\draw[bst] (0,0)     -- node[eti]          {E1}         (5.57 ,0) ;
\draw[bst] (5.63,0)  -- node[eti]          {E1, E2}     (8.37 ,0) ;
\draw[bst] (8.43,0)  -- node[eti]          {E1, E2, E3} (11.37,0) ;
\draw[bst] (11.43,0) -- node[eti]          {E1, E2}     (14.17,0) ;
\draw[bst] (14.23,0) -- node[eti]          {E2}         (16.7 ,0) ;
\draw[rst] (0,0)     -- node[below=1.6cm]  {E5}         (2.77 ,0) ;
\draw[rst] (2.83,0)  -- node[below=1.6cm]  {E4}         (17   ,0) ;
\end{tikzpicture}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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