# Date label text overlapping in chronosys

I'm attempting (with huge help from Hafid Boukhoulda who helped here) to utilise chronosys to construct a number of timelines, mostly on BC date ranges. Most data has been fixed-points, so not a problem, but some are events dated only to date ranges. I come across a problem when date ranges are close together:

\documentclass{article}
\usepackage{chronosys}

\newcommand{\mychronodatestyle}[1]{

\pgfmathparse{equal(sign(#1),-1)? int(abs(#1)):#1 }
\pgfmathresult
\pgfmathparse{equal(sign(#1),-1)? "BC":}
~\pgfmathresult
}

\catcode\!=11
\def\eventyear{\!chreventyear}
\catcode\!=12

\newcommand{\myeventdatestyle}[1]{
\pgfmathparse{equal(sign(\eventyear),-1)? int(abs(\eventyear)):"#1"}
\pgfmathresult
\pgfmathparse{equal(sign(\eventyear),-1)? "BC":}
~\pgfmathresult
}

\begin{document}

\startchronology
[startyear=-800,stopyear=-14, arrow=false, height=0.2em, dateselevation=10pt,
datesstyle=\mychronodatestyle
]
\chronoevent[datestyle=\myeventdatestyle ]
{12/-753}{Rome's foundation}

\chronoperiode[datesstyle=\mychronodatestyle,dateselevation=2pt]{-350}{-320}{important event}
\stopchronology

\end{document}


Your datestyle was inadequate for the narrow date band provided. So I created an alternate (vertical) date style (named \mychronovdatestyle, note the v) for such narrowly spaced events.

I also added a number of % chars at line end, to suppress stray spaces from getting introduced into the labels.

\documentclass{article}
\usepackage{chronosys}

\newcommand{\mychronodatestyle}[1]{%
\pgfmathparse{equal(sign(#1),-1)? int(abs(#1)):#1 }%
\pgfmathresult%
\pgfmathparse{equal(sign(#1),-1)? "BC":}%
~\pgfmathresult%
}

\newcommand{\mychronovdatestyle}[1]{%
\pgfmathparse{equal(sign(#1),-1)? int(abs(#1)):#1 }%
\edef\tmp{\pgfmathresult}%
\pgfmathparse{equal(sign(#1),-1)? "BC":}%
\kern-1.5pt\rotatebox[origin=left]{90}{--- \tmp~\pgfmathresult}%
}

\catcode\!=11
\def\eventyear{\!chreventyear}
\catcode\!=12

\newcommand{\myeventdatestyle}[1]{%
\pgfmathparse{equal(sign(\eventyear),-1)? int(abs(\eventyear)):"#1"}%
\pgfmathresult%
\pgfmathparse{equal(sign(\eventyear),-1)? "BC":}%
~\pgfmathresult%
}
\begin{document}
\startchronology
[startyear=-800,stopyear=-14, arrow=false, height=0.2em, dateselevation=10pt,
datesstyle=\mychronodatestyle
]
\chronoevent[datestyle=\myeventdatestyle ]
{12/-753}{Rome's foundation}

\chronoperiode[color=red,datesstyle=\mychronovdatestyle,dateselevation=-7pt]
{-350}{-320}{important event}
\stopchronology

\end{document}


SUPPLEMENT

The OP asks if the vertical dates could be placed below the line, at the expense of omitting the label.

I took no effort to make it pretty, but just minimized the modifications necessary from the above MWE:

1. removed "important event" text, leaving argument blank.

2. changed the dateselevation from -7pt to -10pt.

3. changed the \rotatebox angle from 90 to -90.

4. changed the label pre-kern from -1.5pt to 1.5pt.

The new MWE:

\documentclass{article}
\usepackage{chronosys}

\newcommand{\mychronodatestyle}[1]{%
\pgfmathparse{equal(sign(#1),-1)? int(abs(#1)):#1 }%
\pgfmathresult%
\pgfmathparse{equal(sign(#1),-1)? "BC":}%
~\pgfmathresult%
}

\newcommand{\mychronovdatestyle}[1]{%
\pgfmathparse{equal(sign(#1),-1)? int(abs(#1)):#1 }%
\edef\tmp{\pgfmathresult}%
\pgfmathparse{equal(sign(#1),-1)? "BC":}%
\kern1.5pt\rotatebox[origin=left]{-90}{--- \tmp~\pgfmathresult}%
}

\catcode\!=11
\def\eventyear{\!chreventyear}
\catcode\!=12

\newcommand{\myeventdatestyle}[1]{%
\pgfmathparse{equal(sign(\eventyear),-1)? int(abs(\eventyear)):"#1"}%
\pgfmathresult%
\pgfmathparse{equal(sign(\eventyear),-1)? "BC":}%
~\pgfmathresult%
}
\begin{document}
\startchronology
[startyear=-800,stopyear=-14, arrow=false, height=0.2em, dateselevation=10pt,
datesstyle=\mychronodatestyle
]
\chronoevent[datestyle=\myeventdatestyle ]
{12/-753}{Rome's foundation}

\chronoperiode[color=red,datesstyle=\mychronovdatestyle,dateselevation=-10pt]
{-350}{-320}{}
\stopchronology

\end{document}


• @StevenBSegletes Perfect! Would it be possible to have the dash and date text at underneath though, to match the single-date points? Apr 4 '19 at 16:01
• @alice19 That would be harder, but maybe it could be done...what about "important event" which would then interfere? Apr 4 '19 at 16:15
• @StevenBSegletes Sorry, despite my mwe, that text is not needed for my purposes. It can be omitted. Apr 4 '19 at 16:16
• @StevenBSegletes let me know if it isn't possible - either way i'll accept your answer in a bit. Thanks for your help! Apr 6 '19 at 16:13
• @alice19 Done!! Apr 6 '19 at 20:45