我想使用此解决方案中的代码控制垂直时间轴中日期的突出显示和分隔绘制垂直时间线,制作具有相同配置可能性的水平时间线,例如控制标签之间的距离,在多张幻灯片中显示相同的日期。
我已经测试过更改绘图,并且得到了一个水平箭头,但是标签和刻度没有沿着线很好地缩放:
\documentclass{beamer}
\setbeamercovered{transparent}
\setbeamertemplate{navigation symbols}{} % removes navigation symbols at the bottom left
\usepackage{tikz}
\usetikzlibrary{overlay-beamer-styles}
\usetikzlibrary{arrows.meta}
\tikzset{
highlight on/.style={alt={#1{fill=red!80!black,color=red!80!black}{fill=gray!30!white,color=gray!30!white}}},
}
\begin{document}
\begin{frame}[t]{Timeline}
\begin{columns}[b]
\begin{column}{0.15\textwidth}
\begin{tikzpicture}[scale=0.38,baseline={(0,-5.5)}] % baeline controla la altura del itemize
% \draw[line width=1mm,-latex,red!20] (0,0.5) -- +(0,-17);
\draw[line width=1mm,-latex,red!20] (0,0.5) -- +(17,0);
\foreach \Label/\Offset/\Overlay in {2000/0/1,2001/1/2,2002/2/3,2005/5/4,2008/8/5,2009/9/6,2012/12/6,2015/15/7} {
% el segundo num es el offset en años desde el primero
% el tercer num sirve para poner la fecha en el mismo overlay (slide)
\def\X{\Offset}
\draw[highlight on=<\Overlay>,-{Latex[length=8]}] (\X,-0.5) -- (\X,-0.1);
\node[highlight on=<\Overlay>,anchor=west,fill=white,inner sep=0pt] at (\X,0.7) {\Label};
}
\end{tikzpicture}
\end{column}
\begin{column}{0.8\textwidth}
\begin{itemize}
\item<1> November 2000: marmots start hibernating
\item<2> August 2001: marmots eat
\item<2> Semptember 2001: marmots eat
\item<3> July 2002: marmots eat
\item<4> May 2005: marmots awake from hibernation\
\item<4> November 2005: marmots start hibernating again
\item<5> May 2008: marmots drink honey liquor
\item<6> 2009, 2012: noisy, marmots can't fall asleep
\item<7> July 2015: marmots eat pineapple cake
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\end{document}
我希望标签以 45 度倾斜度显示在线上方。
此外,在时间轴的年份中,我希望从 1945 年开始,距离第二个日期 1973 年很远,将这些日期与其他日期放在同一条线上似乎并不容易。其余日期距离较近,它们可以在几帧中出现在线上。
答案1
要制作水平时间线,我们不需要列。
为了获得更长的时间线,我们改变了图片比例。
为了获得 45° 的标签倾斜度,我们使用
rotate=45
节点选项。
!
\documentclass{beamer}
\setbeamercovered{transparent}
\setbeamertemplate{navigation symbols}{} % removes navigation symbols at the bottom left
\usepackage{tikz}
\usetikzlibrary{overlay-beamer-styles}
\usetikzlibrary{arrows.meta}
\tikzset{
highlight on/.style={alt={#1{fill=red!80!black,color=red!80!black}{fill=gray!30!white,color=gray!30!white}}},
}
\begin{document}
\begin{frame}[t]{Timeline}
%\begin{columns}[b]
% \begin{column}{0.15\textwidth}
\begin{tikzpicture}[scale=0.6,
%baseline={(0,-5.5)}
] % baeline controla la altura del itemize
% \draw[line width=1mm,-latex,red!20] (0,0.5) -- +(0,-17);
\draw[line width=1mm,-latex,red!20] (-0.5,0.5) -- +(17,0);
\foreach \Label/\Offset/\Overlay in {2000/0/1,2001/1/2,2002/2/3,2005/5/4,2008/8/5,2009/9/6,2012/12/6,2015/15/7} {
% el segundo num es el offset en años desde el primero
% el tercer num sirve para poner la fecha en el mismo overlay (slide)
\def\X{\Offset}
\draw[highlight on=<\Overlay>,-{Latex[length=8]}] (\X,-0.5) -- (\X,-0.1);
\node[highlight on=<\Overlay>,anchor=south,fill=white,inner sep=0pt,rotate=45] at (\X,1.25) {\Label};
}
\end{tikzpicture}
\vfill
%\end{column}
%\begin{column}{0.8\textwidth}
\begin{itemize}
\item<1> November 2000: marmots start hibernating
\item<2> August 2001: marmots eat
\item<2> Semptember 2001: marmots eat
\item<3> July 2002: marmots eat
\item<4> May 2005: marmots awake from hibernation\
\item<4> November 2005: marmots start hibernating again
\item<5> May 2008: marmots drink honey liquor
\item<6> 2009, 2012: noisy, marmots can't fall asleep
\item<7> July 2015: marmots eat pineapple cake
\end{itemize}
%\end{column}
%\end{columns}
\end{frame}
\end{document}