1

I have the following code to create a timeline with events labelled. In the second figure, between the events $(\tau_1+\frac{x_1}{K_1},x_2)$, I would like to place a curly bracket below, saying $\pi_1=...$ and below $(\tau_2,\tau)$ I would love to place another curly bracket with a different labelling.

In my code, when I run, the bracket turns out to be ugly and not the usual stylish one. I have tried changing the amplitude but to no avail.

\usepackage{tikz}
\usetikzlibrary{snakes, arrows, automata, positioning, calc, decorations.pathreplacing}

\begin{figure}
\quad\quad\quad\quad
\begin{tikzpicture}
\draw (0.5,0) -- (7,0);
\draw[xshift=0.45 cm, thick] (5pt,5pt) -- (5pt,-5pt)node[above=0.3cm,fill=white] {0};
\draw[xshift=1 cm, thick] (5pt,5pt) -- (5pt,-5pt) node[above=0.3cm,fill=white] {$\tau_1$};
\draw[xshift=2.5 cm, thick] (5pt,5pt) -- (5pt,-5pt) node[above=0.3cm,fill=white] {$\tau_2$};
\draw[xshift=3.5 cm, thick] (5pt,5pt) -- (5pt,-5pt) node[above=0.3cm,fill=white] {$\tau_1+\frac{x_1}{K_1}$};
\draw[xshift=6.5cm, thick] (5pt,5pt) -- (5pt,-5pt) node[above=0.3cm,fill=white] {$\tau$};
\end{tikzpicture}
\quad\quad\quad\quad
\begin{tikzpicture}
\draw (0.5,0) -- (7,0);
\draw[xshift=0.45 cm, thick] (5pt,5pt) -- (5pt,-5pt)     node[above=0.3cm,fill=white] {0};
\draw[xshift=1 cm, thick] (5pt,5pt) -- (5pt,-5pt) node[above=0.3cm,fill=white] {$\tau_1$};
\draw[xshift=2.5 cm, thick] (5pt,5pt) -- (5pt,-5pt) node[above=0.3cm,fill=white] {$\tau_1+\frac{x_1}{K_1}$};

\draw[xshift=3.5 cm, thick] (5pt,5pt) -- (5pt,-5pt) node[above=0.3cm,fill=white] {$\tau_2$};

\draw [decorate,decoration={brace,amplitude=-10pt},xshift=0pt,yshift=-1pt, mirror]
(3.5,-0.5) -- (6.5,-0.5) node [black,midway, yshift=-0.6cm] {\footnotesize $\pi_i=1+q(\pi_1-1)$};

\draw[xshift=6.5 cm, thick] (5pt,5pt) -- (5pt,-5pt) node[above=0.3cm,fill=white] {$\tau$};
\end{tikzpicture}

\end{figure}

enter image description here

  • there is this raise key ;) – percusse Feb 1 '16 at 11:56
1

mirror is an option for decoration={}. Also, do not use a negative amplitude:

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing,calc}

\begin{document}
\begin{tikzpicture}
\coordinate (A) at (0.45,0);
\coordinate (B) at (1,0);
\coordinate (C) at (2.5,0);
\coordinate (D) at (3.5,0);
\coordinate (E) at (6.5,0);

\draw (0,0) -- (7,0);

\draw[thick] ($(A)+(0,5pt)$) node[above] {$0$} -- ($(A)-(0,5pt)$);
\draw[thick] ($(B)+(0,5pt)$) node[above] {$\tau_1$} -- ($(B)-(0,5pt)$);
\draw[thick] ($(C)+(0,5pt)$) node[above] {$\tau_1+\frac{x_1}{K_1}$} -- ($(C)-(0,5pt)$);
\draw[thick] ($(D)+(0,5pt)$) node[above] {$\tau_2$} -- ($(D)-(0,5pt)$);
\draw[thick] ($(E)+(0,5pt)$) node[above] {$\tau$} -- ($(E)-(0,5pt)$);

\draw[decorate,decoration={brace,amplitude=5pt,mirror,raise=3mm}] (C) -- (D) node [black,midway,yshift=-7mm] {\footnotesize $\pi_i=1+q(\pi_1-1)$};
\end{tikzpicture}
\end{document}

enter image description here

3

See, if you liked the following:

\documentclass[border=3mm,
               tikz,
               preview
               ]{standalone}
\usetikzlibrary{decorations.pathreplacing
                }

    \begin{document}
\begin{tikzpicture}
\draw (0,0) -- (7,0);
    \foreach \i/\j in {0.45/0,1/$\tau_1$,2.5/$\tau_2$,3.5/$\tau_1+\frac{x_1}{K_1}$,6.5/$\tau$}
\draw (\i,-5pt) -- + (0,10pt) node[above] {\j};
\end{tikzpicture}

\begin{tikzpicture}[
decoration={brace,amplitude=10pt,raise=8pt,mirror}
                    ]
\draw (0,0) -- (7,0);
    \foreach \i/\j in {0.45/0,1/$\tau_1$,2.5/$\tau_2$,3.5/$\tau_1+\frac{x_1}{K_1}$,6.5/$\tau$}
\draw (\i,-5pt) -- + (0,10pt) node[above] {\j};

\draw[decorate]
(3.5,0) -- node[below=15pt] {\footnotesize $\pi_i=1+q(\pi_1-1)$} ++ (3,0) ;
\end{tikzpicture}
    \end{document}

As you can see, I slightly reorganize your code, and make it quit shorter ...

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.