Beamer 演示文稿中的时间线

Beamer 演示文稿中的时间线

我是一名工程专业的学生,​​我打算进一步了解 Beamer/LaTex。经过长时间的研究,我发现了一些有趣的图像,这些图像显示了我计划在工作中添加的最接近的样式。点击链接:http://tfischernet.files.wordpress.com/2010/08/history11.png

我已经尝试联系作者,但他没有回复我。有人能帮我解释一下如何实现这个时间表吗?

在此处输入图片描述

答案1

我只是把它拼凑在一起,因此它可以被显著地扩展,但它给出了三个宏:

\skipyears[]{}\showyear[]{}, 和\yearwidth{}

第一个宏指定颜色作为可选参数,并指定纸张距离来表示年份的跳过。第二个宏将颜色作为可选参数,并将一段文本(年份)设置在线条标记的顶部。最后一个宏定义年份标记的宽度。

如本例所示,我们可以\stackunder添加\showyear符号。

\documentclass{beamer}
\usepackage{stackengine}
\renewcommand\useanchorwidth{T}
\usepackage{xcolor}
\def\theyearwidth{1.5pt}
\newlength\yrsfboxrule
\yrsfboxrule .4\fboxrule
\newcommand\yearwidth[1]{\def\theyearwidth{#1}\ignorespaces}
\newcommand\skipyears[2][white]{%
  \fboxrule\yrsfboxrule%
  \fboxsep=-\yrsfboxrule%
  \fcolorbox{gray}{#1}{\strut\hspace{#2}}%
  \ignorespaces%
}
\newcommand\showyear[2][black]{%
  \fboxsep=0pt%
  \stackon{%
    \colorbox{#1}{\strut\hspace{\theyearwidth}}%
  }{\sffamily\small#2}%
  \ignorespaces%
}
\begin{document}
\begin{frame}
Here is some text about computing hardware
\vspace{0.5in}\par
{\centering
\skipyears[cyan]{.1in}
\showyear[red]{-3000}
\skipyears[cyan]{1in}
\showyear{0}
\skipyears{.7in}
\showyear{1400}
\skipyears[cyan!50]{.3in}
\showyear{1500}
\yearwidth{.8pt}
\skipyears[cyan!50]{.05in}
\showyear{}
\skipyears[cyan!50]{0.7in}
\stackunder{\showyear{1776}}{\scriptsize\itshape American Revolution}%
\yearwidth{1.5pt}
\skipyears[cyan!50]{1.1in}
\showyear{2010}\par}
\end{frame}
\end{document}

在此处输入图片描述


对于那些更注重报告而不是投影仪的任务,这里有一些上述内容的变体,有些人可能会觉得更有吸引力:

\documentclass{article}
\usepackage{stackengine}
\renewcommand\useanchorwidth{T}
\usepackage{xcolor}
\def\theyearwidth{1.5pt}
\def\mystrut{\rule{0ex}{1ex}}
\def\myyrstrut{\rule[-1ex]{0ex}{2ex}}
\newlength\yrsfboxrule
\yrsfboxrule .4\fboxrule
\newcommand\yearwidth[1]{\def\theyearwidth{#1}\ignorespaces}
\newcommand\skipyears[2][black]{%
  \fboxrule\yrsfboxrule%
  \fboxsep=-\yrsfboxrule%
  \fcolorbox{#1}{#1}{\mystrut\hspace{#2}}%
  \ignorespaces%
}
\newcommand\showyear[2][black]{%
  \fboxsep=0pt%
  \stackunder[2pt]{%
    \colorbox{#1}{\myyrstrut\hspace{\theyearwidth}}%
  }{\tiny#2}%
  \ignorespaces%
}
\begin{document}
Here is some text
\vspace{0.5in}\par
{\centering
\yearwidth{0.8pt}
\tclap{\tiny 0}%
\skipyears[gray]{1in}
\showyear{1200}
\skipyears{.7in}
\showyear{1400}
\skipyears[cyan!50]{.3in}
\showyear{1500}
\skipyears[gray]{.05in}
\skipyears[gray]{0.7in}
{\def\stackalignment{r}\showyear{1520}
\bllap[3.7ex]{\tiny Texte A}}%
\skipyears[gray]{0.04in}%
{\def\stackalignment{l}\showyear{1525}
\brlap[3.7ex]{\tiny Texte B}}%
\skipyears{1.1in}
\tllap{\tiny 2010}\par}
\end{document}

在此处输入图片描述

相关内容