如何用 LaTeX 创建时间线? [英] How to create a timeline with LaTeX?

查看:44
本文介绍了如何用 LaTeX 创建时间线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在历史书籍中,您经常有时间线,其中事件和时期以正确的相对距离标记在一条线上.如何在 LaTeX 中创建类似的东西?

In history-books you often have timeline, where events and periods are marked on a line in the correct relative distance to each other. How is it possible to create something similar in LaTeX?

推荐答案

tikz 包好像有你想要什么.

The tikz package seems to have what you want.

documentclass{article}
usepackage{tikz}
usetikzlibrary{snakes}

egin{document}

  egin{tikzpicture}[snake=zigzag, line before snake = 5mm, line after snake = 5mm]
    % draw horizontal line   
    draw (0,0) -- (2,0);
    draw[snake] (2,0) -- (4,0);
    draw (4,0) -- (5,0);
    draw[snake] (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] {$ 1 $} node[above=3pt] {$ 10 $};
    draw (2,0) node[below=3pt] {$ 2 $} node[above=3pt] {$ 20 $};
    draw (3,0) node[below=3pt] {$  $} node[above=3pt] {$  $};
    draw (4,0) node[below=3pt] {$ 5 $} node[above=3pt] {$ 50 $};
    draw (5,0) node[below=3pt] {$ 6 $} node[above=3pt] {$ 60 $};
    draw (6,0) node[below=3pt] {$  $} node[above=3pt] {$  $};
    draw (7,0) node[below=3pt] {$ n $} node[above=3pt] {$ 10n $};
  end{tikzpicture}

end{document}

我对 tikz 不太熟悉,但这确实给出了一个很好的时间表,如下所示:

I'm not too expert with tikz, but this does give a good timeline, which looks like:

这篇关于如何用 LaTeX 创建时间线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆