5

For the following:

\documentclass{article}
\usepackage{chronosys}
\catcode`\@=11
\def\chron@selectmonth#1{\ifcase#1\or January\or February\or March\or April\or%
 May\or June\or July\or August\or September\or October\or November\or December\fi}

\begin{document}

    \startchronology[startyear=15,stopyear=16]

\chronoevent{15/03/15}{Assassination of Caesar} 

     \stopchronology 

\end{document}

Produces:

enter image description here

Is it at all possible to have the timeline event be in month day, year format, eg, March 15, 2015?

Also, I could not get this timeline to reflect 2015 to 2016. Instead I seem stuck with "15" on one end and "16" on the other.

When I attempted it using:

    \startchronology[startyear=2015,stopyear=2016]

the program reflected no dates on the chronology whatsoever.

The chronosys package documentation, for me, did not seem to help.

Thanks, if I am stuck with the date format(s) I presently have by virtue of the package itself, I would appreciate that information.

  • 1
    I have a quick look, and I think you'll probably have to modify some of the internals. From the quick look, I think it does the printing of the date at ~513 in chronosyschr.tex, but that code seems (unnecessarily) difficult... – JP-Ellis Feb 16 '16 at 3:12
  • Appreciate you informing me of that :) – A Feldman Feb 16 '16 at 3:26
  • I guess that answers the part about the date format of the events, as I have as much ability to modify the internals of the package as fly to the moon. Does anybody have an idea about the second part of the question, the dates on the timeline, which should be 2015 and 2016? – A Feldman Feb 16 '16 at 3:42
3

I will not comment on your first issue, as @JP-Ellis already answered that perfectly. But patching the code to change the date format is not that difficult, although the code of chronosys is a bit messy. @JP-Ellis already figured out the right file and line, so here is a patch to change the date format.

\documentclass{article}
\usepackage{chronosys}
\usepackage{etoolbox}

\makeatletter\catcode`\!=11
\def\chron@selectmonth#1{\ifcase#1\or January\or February\or March\or April\or%
 May\or June\or July\or August\or September\or October\or November\or December\fi}

\patchcmd{\dochronoevent}{%
\if!chreventdate\hbox to\z@{%
  \hss \if!chreventifcolorbox \expandafter\!chreventcolorbox\fi
  {\!chr@eventdatestyle{%
    \if!chreventspecifiedday %
      {\!chr@eventdatesstyle{\!chreventday}}\!chr@eventdatesseparation
    \fi
  {\!chr@eventdatesstyle{%
    \if!chreventspecifiedmonth 
      \if!chreventconversionmonth\expandafter \chron@selectmonth
      \fi 
      \!chreventmonth
    \fi
    }%
  }%
  \if!chreventspecifiedmonth\if!chreventyear \!chr@eventdatesseparation\fi\fi 
  \if!chreventyear{\!chr@eventdatesstyle{\!chreventyear}}\fi%
  }}%
  \hss
}%
\fi
}{%
\if!chreventdate\hbox to\z@{%
  \hss \if!chreventifcolorbox \expandafter\!chreventcolorbox\fi
  {\!chr@eventdatesstyle{%
    \if!chreventspecifiedmonth 
      \if!chreventconversionmonth\expandafter\chron@selectmonth
      \fi 
      \!chreventmonth\!chr@eventdatesseparation%
    \fi
    }%
  {\!chr@eventdatestyle{%
    \if!chreventspecifiedday%
      {\!chr@eventdatesstyle{\!chreventday}},%
    \fi%
  }%
  \if!chreventspecifiedmonth\if!chreventyear\!chr@eventdatesseparation\fi\fi 
  \if!chreventyear{\!chr@eventdatesstyle{\!chreventyear}}\fi%
  }}%
  \hss
}%
\fi
}{%
\message{Patching chronosys successful.}%
}{%
\message{Patching chronosys failed.}%
}
\makeatother


\begin{document}

\startchronology[startyear=2015,stopyear=2016]
\chronoevent{15/03/2015}{Assassination of Caesar} 
\stopchronology 

\end{document}

Output:

chronosys

3

As I mentioned in the comment above, modifying the date looks like it will be difficult since chronosys does not appear to offer any way to do it. As a result, the only way to do this would be to modify part of the package itself (from what I could tell, the printing of the date starts at around line 513 of chronosyschr.tex, though it looks unnecessarily complicated to me).

Now regarding the events not appearing, it seems to be simply because the package expects a full year, that is, it expects 15/03/2015 otherwise it registers the date as being year 15:

\documentclass{article}
\usepackage{chronosys}

\makeatletter
\def\chron@selectmonth#1{\ifcase#1\or January\or February\or March\or April\or%
  May\or June\or July\or August\or September\or October\or November\or December\fi}

\begin{document}
\startchronology[startyear=2010,stopyear=2016]
  \chronoevent{4/7/2012}{Discovery of the Higgs boson}
\stopchronology
\startchronology[startyear=10,stopyear=16]
  \chronoevent{19/8/14}{Augustus, the first Roman emperor, dies and is declared to be a god}
\stopchronology 
\end{document}

output

  • Much obliged for your correct answer! – A Feldman Feb 16 '16 at 4:06
2

Further information about chronos can be found in this answer.

Current version of chronos is available at:
https://tex.stackexchange.com/a/342699/ (2016-12-06)

For what it is worth, chronos now allows this to be a done rather more easily:

      date format={ B d, Y},

Each character in the format is either translated into an element of the date format or passed through as is. This includes punctuation and spaces. (Note that macros etc. won't work here because the macro will be broken down and 'translated' token-by-token.)

The format codes are mostly a subset of the format codes provided by GNU's date command, with a few extras not relevant to GNU.

  • a short weekday name e.g. Mon
  • A full weekday name e.g. Monday
  • b short month name e.g. Jan
  • B full month name e.g. January
  • d day of the month e.g. 23
  • E era e.g. BCE or CE
  • m month number e.g. 01
  • q minus if year is BCE
  • Q minus if year is BCE;
  • y last two digits of year e.g. 66
  • Y year e.g. 1066

Basically, this customises the code used to typeset dates for events. A slimmed down version of this format is also available to customise the appearance of year labels on the timeline itself. Era labels may alternatively be added at each end of the timeline to avoid the clutter of including CE or BCE with every year.

So the timeline can be typeset as follows:

\begin{tikzpicture}
  [
    chronos={%
      start date=2015-01-01,
      end date=2016-01-01,
      timeline height=2.5mm,
      timeline width=100mm,
      timeline line={shorten >=-10mm, -{Triangle Cap[length=10mm]}},
      timeline years=above,
      date format={ B d, Y},
    }
  ]
  \chronosevent{2015-03-15}{Assassination of Caesar}
\end{tikzpicture}

produces

timeline

There is no longer a year zero by default but this can be reinstated if required using year zero.

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.