文章出處

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}替換即可做到無表標號的效果。


文章列表




Avast logo

Avast 防毒軟體已檢查此封電子郵件的病毒。
www.avast.com


全站熱搜
創作者介紹
創作者 大師兄 的頭像
大師兄

IT工程師數位筆記本

大師兄 發表在 痞客邦 留言(0) 人氣()