0

This is my code

\documentclass[10pt]{beamer}

\usetheme[progressbar=frametitle]{metropolis}
\usepackage{appendixnumberbeamer}
\usepackage{chronology}
\begin{frame}{Timeline}
\begin{center}
\begin{chronology}[10]{1810}{2020}{63ex}[\textwidth]
\event{\decimaldate{}{}{1812}}{\small Beginnings of Gerrymandering}
\event{\decimaldate{26}{3}{1962}}{\small Baker v. Carr}
\event{\decimaldate{15}{12}{1964}}{\small Reynold v. Sims}
\event{\decimaldate{2}{10}{1985}}{\small Bandermer v. Davis}
\event{\decimaldate{}{}{1991}}{\small Third Criterion}
\event{\decimaldate{}{}{2004}}{\small Vieth v. Jubelirer}
\event{\decimaldate{31}{12}{2006}}{\small LULAC v. Perry}
\event{\decimaldate{}{}{2015}}{\small Efficiency Gap}
\event{\decimaldate{}{}{2018}}{\small Gill v. Whitford}
\end{chronology}
\end{center}
\end{frame}
\end{document}

Since the events go from 1812-2018, the timeline get so small you cant see them on my frame. I want there to be a break in between the first two events. Does anyone know how to do this?

3
  • Hello and welcome to TeX.SX. Could you provide a MWE - minimal working example? This begins with \documentclass and includes the packages you use. That way we can compile your code and see what we can do.
    – nox
    Jul 5, 2018 at 23:17
  • \documentclass[10pt]{beamer}
    – Eleanor
    Jul 5, 2018 at 23:19
  • You can use the 'edit' link at the bottom left of your question to edit your post and make the snipped compilable.
    – cfr
    Jul 5, 2018 at 23:20

1 Answer 1

1

After having a lot of fun (this package is !#$&), adjusting the very internals by copying and improving the code, you can use the code below. This is far from perfect, e.g. the label from long events aren't shifted, spacing is not optimal etc. But at least something you can work with. You could still add sub-ticks and do more fancy stuff. But in general I would recommend to use another package. This is not general enough, well documented enough, ...

\documentclass[10pt]{beamer}

\usetheme[progressbar=frametitle]{metropolis}
\usepackage{appendixnumberbeamer}
\usepackage{chronology}

\newlength{\myunit}
\makeatletter%
\newif\ifchronology@star%
\renewenvironment{chronology}{%
    \@ifstar{\chronology@startrue\chronology@i*}{\chronology@starfalse\chronology@i*}%
}{%
\end{tikzpicture}%
\end{lrbox}%
\usebox{\timelinebox}
}%
\def\chronology@i*{%
\@ifnextchar[{\chronology@ii*}{\chronology@ii*[{5}]}%
}%
\def\chronology@ii*[#1]#2#3#4#5{%
\newif\ifflipped%
\ifchronology@star%
\flippedtrue%
\else%
\flippedfalse%
\fi%
\setcounter{step}{#1}%
\setcounter{yearstart}{#2}\setcounter{yearstop}{#3}%
\setcounter{deltayears}{\theyearstop-\theyearstart}%
\setlength{\timelinewidth}{#4}%
\setlength{\myunit}{#5}%
\pgfmathsetcounter{stepstart}{\theyearstart-mod(\theyearstart,\thestep)}%
\pgfmathsetcounter{stepstop}{\theyearstop-mod(\theyearstop,\thestep)}%
\addtocounter{step}{\thestepstart}%
\begin{lrbox}{\timelinebox}%
\begin{tikzpicture}[baseline={(current bounding box.north)}]%,x=\timelinewidth,y=\p@]%
\draw [|->] (0,0) -- (\timelinewidth, 0);%
%\foreach \x in {1,...,\thedeltayears}%
%\draw[xshift=\x/\thedeltayears*\timelinewidth] (0,-.5\myunit) -- (0,.5\myunit);%
\addtocounter{deltayears}{1}%
\foreach \x in {\thestepstart,\thestep,...,\thestepstop}{%
    \pgfmathsetlength\xstop{(\x-\theyearstart)/\thedeltayears*\timelinewidth}%
    \draw[xshift=\xstop] (0,-\myunit) -- (0,\myunit);%
    \ifflipped%
    \node[chrontickslabel] at (\xstop,0) [above=\myunit] {\x};%
    \else%
    \node[chrontickslabel] at (\xstop,0) [below=\myunit] {\x};%
    \fi%
}%
}%
\makeatother%

\RenewDocumentCommand{\event}{o m m}{%
    \pgfmathsetlength\xstop{(#2-\theyearstart)/\thedeltayears*\timelinewidth}%
    \IfNoValueTF {#1} {%
        \ifflipped%
        \draw[chronevent]%
        (\xstop, 0) circle (.7\myunit);%
        \draw[chronevent]
        (\xstop,-.5\myunit+2pt) node[flippedeventlabel] {#3};%
        \else%
        \draw[chronevent]%
        (\xstop, 0) circle (.7\myunit);%
        \draw[chronevent]
        (\xstop,.5\myunit-2pt) node[eventlabel] {#3} ;%
        \fi%
    }{%
        \pgfmathsetlength\xstart{(#1-\theyearstart)/\thedeltayears*\timelinewidth}%
        \ifflipped%
        \draw[chronevent,rounded corners=.7\myunit]%
        (\xstart,-.7\myunit) rectangle%
        node[flippedeventlabel] {#3} (\xstop,.7\myunit) [below=\myunit];%
        \else%
        \draw[chronevent,rounded corners=.7\myunit]%
        (\xstart,-.7\myunit) rectangle%
        node[eventlabel] {#3} (\xstop,.7\myunit);%
        \fi%
    }%
}


\begin{document}
\begin{frame}{Timeline}
\vspace*{-5ex}
\begin{chronology}[50]{1800}{2020}{.9\linewidth}{1ex}
    \event{\decimaldate{}{}{1812}}{\small Beginnings of Gerrymandering}
    \event[\decimaldate{}{}{1960}]{\decimaldate{}{}{2020}}{}
\end{chronology}
\par
\begin{chronology}[10]{1960}{2020}{.9\linewidth}{1ex}
    \event{\decimaldate{26}{3}{1962}}{\small Baker v. Carr}
    \event{\decimaldate{15}{12}{1964}}{\small Reynold v. Sims}
    \event{\decimaldate{2}{10}{1985}}{\small Bandermer v. Davis}
    \event{\decimaldate{}{}{1991}}{\small Third Criterion}
    \event{\decimaldate{}{}{2004}}{\small Vieth v. Jubelirer}
    \event{\decimaldate{31}{12}{2006}}{\small LULAC v. Perry}
    \event{\decimaldate{}{}{2015}}{\small Efficiency Gap}
    \event{\decimaldate{}{}{2018}}{\small Gill v. Whitford}
\end{chronology}
\end{frame}
\end{document}

result

2
  • What would you recommend? Thanks!
    – Eleanor
    Jul 6, 2018 at 3:02
  • I don't know any such package and would have to search myself, so up to you, sorry I can't help here. Maybe it might be best to write a small script yourself, there are heaps of sources on that in the internet. Search for e.g. latex create figure timeline or something. Or be happy having finished this timeline and forget about it =P
    – nox
    Jul 6, 2018 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.