如何使用 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
有一个新的 chronology.sty 作者:Levi Wiseman 。 文档(pdf)说:
这是一些示例代码:
产生以下输出:
There is a new chronology.sty by Levi Wiseman. The documentation (pdf) says:
Here is some example code:
Which produces this output:
tikz 包似乎有你想要的。
我对 tikz 不太专业,但这确实提供了一个很好的时间表,如下所示:
The tikz package seems to have what you want.
I'm not too expert with tikz, but this does give a good timeline, which looks like:
另外,包 chronosys 提供了一个很好的解决方案。 以下是用户手册中的示例:
Also the package chronosys provides a nice solution. Here's an example from the user manual:
只是一个更新。
目前的 TiKZ 包将发布:
包 tikz 警告:蛇已被取代
装饰。 请使用装饰库而不是
输入行上的蛇库。 。 。
因此代码的相关部分必须更改为:
HTH
Just an update.
The present TiKZ package will issue:
Package tikz Warning: Snakes have been superseded by
decorations. Please use the decoration libraries instead of the
snakes library on input line. . .
So the pertaining part of code has to be changed to:
HTH
Tim Storer 编写了一个更灵活、更漂亮的
时间线.sty
(Internet Archive Wayback Machine 链接,原件已消失)。 此外,该线是水平的而不是垂直的。 例如:生成一个如下所示的时间线:
就我个人而言,我发现这是比其他答案更令人满意的解决方案。 但我也发现自己修改了代码,以使其更接近我认为的时间线应该是什么样子。 所以我认为没有明确的解决方案。
Tim Storer wrote a more flexible and nicer looking
timeline.sty
(Internet Archive Wayback Machine link, as original is gone). In addition, the line is horizontal rather than vertical. So for instance:produces a timeline that looks like this:
Personally, I find this a more pleasing solution than the other answers. But I also find myself modifying the code to get something closer to what I think a timeline should look like. So there's not definitive solution in my opinion.
首先,我更喜欢
tikz
引导解决方案,因为它给你更多的自由。 其次,我不会发布任何全新的内容。 这显然与 Zoe Gagnon 的回答相似,因为他指明了道路。我需要一年的时间表,并且花了我一些时间(真是令人惊讶!),所以我分享结果。 我希望你会喜欢它。
如您所见,它是针对投影仪演示文稿量身定制的(选择部分和缩放选项),但如果您确实想在演示文稿中测试它,那么您应该将
\newlength\yearposx
移到框架之外定义,因为否则您将收到错误消息,表明命令\yearposx
已定义(除非您从框架中删除选择部分和任何其他框架分割命令)。Firstly, I prefer
tikz
guided solution, because it gives you more freedom. Secondly, I'm not posting anything totally new. It is obviously similar to Zoe Gagnon's answer, because he showed the way.I needed some year timeline and it took me some time (what a surprise!) to do it, so I'm sharing the results. I hope you'll like it.
As you can see, it's tailored to beamer presentation (select part and also scale option), but if you really want to test it in a presentation, then you should move
\newlength\yearposx
outside of the frame definition, because otherwise you'll get error veritably stating that command\yearposx
is already defined (unless you remove the selection part and any other frame-splitting commands from your frame).有 timeline.sty 浮动大约。
语法比使用 tikz 更简单:
我使用 python 的 datetime.data.toordinal 将日期转换为包上下文中的“排序键”。
There is timeline.sty floating around.
The syntax is simpler than using tikz:
I've used python's datetime.data.toordinal to convert dates to 'sort keys' in the context of the package.
我一直在努力寻找一种正确的方法来创建时间线,我终于可以通过这次修改来做到这一点。 通常,在创建时间线时,问题是我无法添加文本来用较长的文本清楚地解释每个日期。 我修改并进一步利用了@Zoe Gagnon 的乳胶脚本。 请随意查看以下内容:
不幸的是,不允许使用较长的文本。 它看起来像这样:
I have been struggling to find a proper way to create a timeline, which I could finally do with this modification. Usually while creating a timeline the problem was that I could not add a text to explain each date clearly with a longer text. I modified and further utilized @Zoe Gagnon's latex script. Please feel free to see the following:
Longer texts are not allowed, unfortunately. It will look like this:
如果您正在寻找 UML 序列图,您可能会对 pkf-umlsd 感兴趣,它是基于 TiKZ 的。 可以在此处找到不错的演示。
If you are looking for UML sequence diagrams, you might be interested in pkf-umlsd, which is based on TiKZ. Nice demos can be found here.
找到创建时尚时间线的正确方法很困难,但凭借一点想象力和 TikZ 包,我创建了以下时间线。 我创建了两个 TikZ 图,可以根据个人喜好使用。 在每种情况下,一旦您了解发生了什么,代码就很简单(添加了额外的注释以提供帮助)。 PS One需要根据需求调整图表。 希望这会有所帮助!
看起来像:
It was a struggle to find a proper way to create a stylish timeline, but with a little bit of imagination and the TikZ package, I have created the following timeline. I have created two TikZ diagrams that can be used depending on the person's preference. In each case, the code is straightforward once you understand what is happening (additional comments were added to help). P.S. One needs to adjust the diagram depending on the requirements. Hope this will help!
Which looks likes: