时间线下的 Underbrace

时间线下的 Underbrace

我正在使用以下代码来构建时间线:

\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}

在此处输入图片描述

我想在 t 和 t+ra 之间添加一个下括号,下括号下方为“X”。对于没有任何问题的公式:

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

但是,对于时间线来说,这行不通。有什么想法可以做到这一点吗?

答案1

  • 欢迎来到 TeX.SE!
  • 请尽可能提供 MWE(最小工作示例),这是一个小而完整的文档,我们可以将其复制到我们的计算机并按原样进行测试。看看以下内容是否是您想要的:
\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}

在此处输入图片描述

相关内容