我正在尝试重现答案这里关于如何创建垂直时间线?在 Beamer 中(不仅限于 OS X)。我安装了 TeX By MacTeX。我在 OSX 中安装了这些软件包xcolor
,colortbl
并且caption
因为测试代码 1 有效并且也通过了验证Tex Live 实用程序。
测试代码 1
作品:
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\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]
1933 & LCMV, aseptic meningitis. Epidemic St. Loius encephalitis. \\
1956 & Tacaribe virus. \\
\end{tabular}
\end{table}
\end{document}
测试代码2
不起作用:
\documentclass{beamer}
- - same as above - -
输出
Latex Error: ./test_timeline.tex:11 LaTeX Error: Option clash for package xcolor.
Latex Error: ./test_timeline.tex:45 Package xcolor Error: Undefined color `LightSteelBlue3'.
Latex Error: ./test_timeline.tex:46 Package xcolor Error: Undefined color `LightSteelBlue3'.
...
如何在 Beamer 中获取垂直时间线?
答案1
“问题”在于,beamer 已经加载了 xcolor,这[x11names]
会导致选项冲突。幸运的是,beamerbeamer
有一个内置选项。
\documentclass[xcolor=x11names,table]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\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{frame}
\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]
1933 & LCMV, aseptic meningitis. Epidemic St. Loius encephalitis. \\
1956 & Tacaribe virus. \\
\end{tabular}
\end{table}
\end{frame}
\end{document}
答案2
这个答案使用了\PassOptionsToPackage{x11names}{xcolor}
以下@Herbert的答案(LaTeX 错误:包 xcolor 的选项冲突)。字幕处于minipage
与垂直时间线对齐的环境中。
\PassOptionsToPackage{x11names}{xcolor}
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\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{frame}
\begin{table}
\renewcommand\arraystretch{1.4}\arrayrulecolor{LightSteelBlue3}
\captionsetup{singlelinecheck=false, font=blue, labelfont=sc, labelsep=quad}
\begin{minipage}{7cm}
\caption{Timeline}
\end{minipage}
\vskip -1.5ex
\begin{tabular}{@{\,}r <{\hskip 2pt} !{\foo} >{\raggedright\arraybackslash}p{5cm}}
\toprule
\addlinespace[1.5ex]
1933 & LCMV, aseptic meningitis. Epidemic St. Loius encephalitis. \\
1956 & Tacaribe virus. \\
\end{tabular}
\end{table}
\end{frame}
\end{document}