1

I am using the following code to construct a timeline:

\usepackage{tikz}
\usetikzlibrary{snakes}

\begin{tikzpicture} % draw horizontal line
\draw (0,0) -- (2,0); \draw(2,0) -- (4,0); \draw (4,0) -- (5,0); \draw (5,0) -- (7,0);

    % draw vertical lines
    \foreach \x in {0,1,2,4,5,7}
      \draw (\x cm,3pt) -- (\x cm,-3pt);

    % draw nodes
   % \draw (0,0) node[below=3pt] {$ 0 $} node[above=3pt] {$   $};
    \draw (1,0) node[below=3pt] {$ 0 $} node[above=3pt] {$  $};
    \draw (2,0) node[below=3pt] {$ t-s $} node[above=3pt] {$  $};
    \draw (4,0) node[below=3pt] {$ t $} node[above=3pt] {$ A_t $};
    \draw (5,0) node[below=3pt] {$ t+r $} node[above=3pt] {$ R_t $};
    \draw (6,0) node[below=3pt] {$  $} node[above=3pt] {$  $};
    \draw (7,0) node[below=3pt] {$ ... $} node[above=3pt] {$  $};
  \end{tikzpicture}

enter image description here

I want to add a underbrace between t and t+r a "X" below the underbrace. For formulas that goes without any problems:

$\underbrace{(x + 2)^3}_\text{text 1}$

However, for the timeline that won't work. Any ideas how to do this?

Zarko
  • 296,517
amar96
  • 13

1 Answers1

2
  • Welcome to TeX.SE!
  • Please, always -- when it is possible -- provide MWE (Minimal Working Example), a small but complete document which we can copy to our computers and test it as it is. See, if the following is what you afer:
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                decorations.pathreplacing,
                    calligraphy,% had to be loaded after decorations.pathreplacing
                positioning}
\usepackage{amsmath}

\begin{document} \begin{tikzpicture}[ BC/.style = {% Brace Calligraphic decorate, decoration={calligraphic brace, #1,% for mirror raise=3pt, amplitude=6pt}, very thick, thick, pen colour={black} }, lbl/.style={inner xsep=0pt}
] % draw horizontal line \draw[-Straight Barb] (0,0) -- (7,0); % draw vertical lines \foreach \x/\i/\j in {1/t-s/, 3/t/A_t,4/t+r/R_t} \draw (\x,3pt) node [lbl,above] {$\j$} -- ++ (0,-6pt) node (n\x) [lbl,below] {$\i$}; % brace \draw[BC=mirror]
(n3.south west) -- node[below=9pt] {some text} (n4.south east); \end{tikzpicture} \end{document}

enter image description here

Zarko
  • 296,517