[Latex]生成Vertical Timeline

Vertical TimeLine

用Latex生成一个竖直的VerticalTimeline的想法来源于今天翻看王老师的教师寄语,有感于学院走过的操作系统实验的艰辛之路,遂产生了写一个“小操作系统实验大事记”的想法。
一开始是打算用横版的TimeLine,但是后来在何某涛的建议下选择了竖版的TimeLine,记录经验供以后参考。
此文主要内容出自:http://tex.stackexchange.com/questions/196794/how-can-you-create-a-vertical-timeline
(感谢StackOverFlow的众多平凡而又伟大的专家为程序员们做出的无私奉献)

\documentclass[a4paper, twoside, 11pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[TS1,T1]{fontenc}
\usepackage{fourier, heuristica}
\usepackage{array, booktabs}
\usepackage{graphicx}
\usepackage[x11names]{xcolor}
\usepackage{colortbl}
\usepackage{caption}
\DeclareCaptionFont{blue}{\color{LightSteelBlue3}}

\newcommand{\foo}{\color{LightSteelBlue3}\makebox[0pt]{\textbullet}\hskip-0.5pt\vrule width 1pt\hspace{\labelsep}}

\begin{document}

\begin{table}
\renewcommand\arraystretch{1.4}\arrayrulecolor{LightSteelBlue3}
\captionsetup{singlelinecheck=false, font=blue, labelfont=sc, labelsep=quad}
\caption{Timeline}\vskip -1.5ex
\begin{tabular}{@{\,}r <{\hskip 2pt} !{\foo} >{\raggedright\arraybackslash}p{5cm}}
\toprule
\addlinespace[1.5ex]
1947 & AT and T Bell Labs develop the idea of cellular phones\\
1968 & Xerox Palo Alto Research Centre envisage the 'Dynabook\\
1971 & Busicom 'Handy-LE' Calculator\\
1973 & First mobile handset invented by Martin Cooper\\
1978 & Parker Bros. Merlin Computer Toy\\
1981 & Osborne 1 Portable Computer\\
1982 & Grid Compass 1100 Clamshell Laptop\\
1983 & TRS-80 Model 100 Portable PC\\
1984 & Psion Organiser Handheld Computer\\
1991 & Psion Series 3 Minicomputer\\
\end{tabular}
\end{table}
\end{document} 

这是我最后敲定的一个latex模版,它样子还是非常漂亮的。它是基于table改造而成的,我又将它略微改造,加进了我们的《小操作系统实验指导书》里。
效果图如下:

略微改过的TimeLine

首先把以下部分加入导言区

\usepackage[utf8]{inputenc}
\usepackage[TS1,T1]{fontenc}
\usepackage{array, booktabs}
\usepackage{graphicx}
\usepackage[x11names]{xcolor}
\usepackage{colortbl}
\usepackage{caption}
\definecolor{baseD}{HTML}{7CAFC2}
%baseD是一个很柔和的蓝色,你可以在相关github主页找到base16色的图样。
\newcommand{\foo}{\color{baseD}\makebox[0pt]{\textbullet}\hskip-0.5pt\vrule width 1pt\hspace{\labelsep}}

把这些加入导言区后(如果你正常安装了texlive-full的话一般是不会提示需要安装额外的sty文件),想在某个地方插入这个“大事记”表的话就直接插入如下代码即可

\begin{table}
\centering
%大事表居中显示
\renewcommand\arraystretch{1.4}\arrayrulecolor{baseD}
\captionsetup{singlelinecheck=false, labelfont=sc, labelsep=quad}
\caption{Timeline}\vskip -1.5ex
%vskip是标题到下面的表格的距离
\begin{tabular}{@{\,}r <{\hskip 2pt} !{\foo} >{\raggedright\arraybackslash}p{5cm}}
%5cm这个参数是指表的总的宽度,如果想做得大一点就把5cm调整放大一点。
\toprule
\addlinespace[1.5ex]
%这个是表格的行距
1947 & AT and T Bell Labs develop the idea of cellular phones\\
1968 & Xerox Palo Alto Research Centre envisage the 'Dynabook\\
1971 & Busicom 'Handy-LE' Calculator\\
%加入的格式为 年份 & 事件 \\(用来换行)
\end{tabular}
\end{table}

后来发现这样的表会带上 Table x.x Timeline的标签,我比较讨厌Table的标签,所以把\caption{Timeline}使用\caption*{Timeline}替换即可做到无表标号的效果。

posted @ 2015-09-27 19:21  SivilTaram  阅读(2108)  评论(0编辑  收藏  举报