2

I am using package chronology. I try to create a chronology with 5 years duration. The event node is too big, how to reduce it without changing duration.

\documentclass{article}
\usepackage{chronology}
\begin{document}
\begin{chronology}[1]{2014}{2018}{\textwidth}
    \event{\decimaldate{1}{7}{2014}}{Hello}
    \event{\decimaldate{20}{1}{2018}}{NOW}
    \event{2017}{test}
  \end{chronology}
\end{document}

enter image description here

qin
  • 215

1 Answers1

2

You can experiment with the first and fifth (optional) argument to obtain the result that you wish. Please compare:

\documentclass{article}
\usepackage{chronology}
\begin{document}
\begin{chronology}[1]{2014}{2018}{\textwidth}
    \event{\decimaldate{1}{7}{2014}}{Hello}
    \event{\decimaldate{20}{1}{2018}}{NOW}
    \event{2017}{test}
  \end{chronology}

  \begin{chronology}[5]{2014}{2018}{\textwidth}[0.3\textwidth]
    \event{\decimaldate{1}{7}{2014}}{Hello}
    \event{\decimaldate{20}{1}{2018}}{NOW}
    \event{2017}{test}
  \end{chronology}

\DeclareDocumentCommand \event {o m m}{%
    \pgfmathsetlength\xstop{(#2-\theyearstart)*\unit}%
    \IfNoValueTF {#1} {%
        \ifflipped%
            \draw[chronevent]%
            (\xstop, 0) circle (.1\unit)% % was 0.2 -- PS
            node[flippedeventlabel] {#3};%
        \else%
            \draw[chronevent]%
            (\xstop, 0) circle (.1\unit)% % was 0.2  -- PS
            node[eventlabel] {#3};%
        \fi%
    }{%
        \pgfmathsetlength\xstart{(#1-\theyearstart)*\unit}%
        \ifflipped%
            \draw[chronevent,rounded corners=.2\unit]%
            (\xstart,-.2\unit) rectangle%
            node[flippedeventlabel] {#3} (\xstop,.2\unit);%
        \else%
            \draw[chronevent,rounded corners=.2\unit]%
            (\xstart,-.2\unit) rectangle%
            node[eventlabel] {#3} (\xstop,.2\unit);%
        \fi%
    }%
}

\begin{chronology}[1]{2014}{2018}{\textwidth}
    \event{\decimaldate{1}{7}{2014}}{Hello}
    \event{\decimaldate{20}{1}{2018}}{NOW}
    \event{2017}{test}
  \end{chronology}


\end{document}

enter image description here

Changes in the lines marked PS are only exemplary. You can set ticks and lines with rounded ends in a similar manner.