在 LaTeX 的时间轴中添加箭头

在 LaTeX 的时间轴中添加箭头

我正在尝试解决以下问题:我在 LaTex 中有一个显示流程过程的时间轴。该时间轴中两个点的顺序会随机变化。为了以图形方式显示这一点,我想在两个点上方添加一个类似于 \leftrightarrow 的双向箭头。所以我需要类似这里要求的东西:在 tikz 中添加下支撑,但用箭头代替了括号。我很感激任何帮助。

编辑:这是代码的一个最小示例。在节点 e 和 fi 上方,我想添加表示随机化的箭头。

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}

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

\foreach \x in {0,2,4,6,8,12,13}
  \draw (\x cm,3pt) -- (\x cm,-3pt);


\draw (0,0) node[below=3pt] (a) {$(i)$} node[above=3pt] {};
\draw (2,0) node[below=3pt] (b) {} node[above=3pt] {$(ii)$};
    \draw (4,0)  node[below=3pt]  {$(iii)$} node[above=3pt] (c) {};


\draw (6,0) node[below=3pt](d) {} node[above=3pt] {$(iv)$};
\draw (8,0) node[below=3pt](e) {$(v)$} node[above=3pt] {};
\draw (12,0) node[above=3pt] (f) {$(vi)$} node[below=3pt] {};
\end{tikzpicture}
\end{figure}
\end{document}

答案1

下面我展示一些可能性:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\draw (0,0) -- (13,0);
\foreach \x in {0,2,4,6,8,12,13}
  \draw (\x cm,3pt) -- (\x cm,-3pt);
\draw (0,0) node[below=3pt] (a) {$(i)$} node[above=3pt] {};
\draw (2,0) node[below=3pt] (b) {} node[above=3pt] {$(ii)$};
\draw (4,0)  node[below=3pt]  {$(iii)$} node[above=3pt] (c) {};
\draw (6,0) node[below=3pt](d) {} node[above=3pt] {$(iv)$};
\draw (8,0) node[below=3pt](e) {$(v)$} node[above=3pt] {};
\draw (12,0) node[above=3pt] (f) {$(vi)$} node[below=3pt] {};
\draw[latex-latex]
  (e.north) -- (f.north);
\draw[latex-latex,blue]
  (e.north) to[bend left] (f.north);
\draw[latex-latex,red]
  (e.north) to[out=60,in=150] (f.north);
\end{tikzpicture}\qquad
\begin{tikzpicture}
\draw (0,0) -- (13,0);
\foreach \x in {0,2,4,6,8,12,13}
  \draw (\x cm,3pt) -- (\x cm,-3pt);
\draw (0,0) node[below=3pt] (a) {$(i)$} node[above=3pt] {};
\draw (2,0) node[below=3pt] (b) {} node[above=3pt] {$(ii)$};
\draw (4,0)  node[below=3pt]  {$(iii)$} node[above=3pt] (c) {};
\draw (6,0) node[below=3pt](d) {} node[above=3pt] {$(iv)$};
\draw (8,0) node[below=3pt](e) {$(v)$} node[above=3pt] {};
\draw (12,0) node[above=3pt] (f) {$(vi)$} node[below=3pt] {};
\draw[latex-latex]
  (e.north|-f.north) -- (f.north);
\draw[latex-latex,blue]
  (e.north|-f.north) to[bend left] (f.north);
\draw[latex-latex,red]
  (e.north|-f.north) to[out=60,in=120] (f.north);
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容