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

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.

| improve this answer | |
  • Change the first argument can change the node size, but this will make years in chronology unreadable. – qin Dec 24 '17 at 9:40
  • Change the fifth argument can only change the font size. – qin Dec 24 '17 at 9:41
  • @qin So please see a new version, with changing TikZ definition (only for the circle, not the rounde line). – Przemysław Scherwentke Dec 24 '17 at 10:01
  • Are you missing some definitions / declarations from your sample code? I cannot get your \DeclareDocumentCommand \event code to work. – Philip Atz Mar 30 at 13:39

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.