% \iffalse meta-comment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% chronos.dtx
% Additions and changes Copyright (C) 2024-2026 Clea F. Rees.
% Code from skeleton.dtx Copyright (C) 2015-2024 Scott Pakin (see below).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%   https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008-05-04 or later.
%
% This work has the LPPL maintenance status 'muaintained'.
%
% The Current Maintainer of this work is Clea F. Rees.
%
% This work consists of all files listed in manifest.txt.
%
% The file chronos.dtx is a derived work under the terms of the
% LPPL. It is based on version 2.4 of skeleton.dtx which is part of
% dtxtut by Scott Pakin. A copy of dtxtut, including the
% unmodified version of skeleton.dtx is available from
% https://www.ctan.org/pkg/dtxtut and released under the LPPL.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \fi
%
%^^A preamble <<<
% \iffalse
%<*driver>
\RequirePackage{svn-prov}
% ref. ateb Max Chernoff: https://tex.stackexchange.com/a/723294/
\def\MakePrivateLetters{\makeatletter\ExplSyntaxOn\endlinechar13}
\ExplSyntaxOff
\ProvidesFileSVN{$Id: chronos-code.dtx 11797 2026-03-21 16:01:38Z cfrees $}[v0.9.4 \revinfo][\filebase DTX: Customisable TikZ-based timelines]
\DefineFileInfoSVN[chronoscode]
\let\chronoscodeversion\fileversion
\let\chronoscodebase\filebase
\let\chronoscodeinfo\fileinfo
\let\chronoscodedate\filedate
\let\chronoscodefilename\filename
\documentclass[11pt,british]{ltxdoc}
% l3doc loads fancyvrb
% fancyvrb overwrites svn-prov's macros without warning
% restore \fileversion \filerev in case we're using l3doc
%^^A \GetFileInfoSVN{chronos}
%^^A \title{\filebase}
%^^A \author{Clea F. Rees\thanks{%
%^^A     Bug tracker:
%^^A     \href{https://codeberg.org/cfr/REPO/issues}{\url{codeberg.org/cfr/REPO/issues}}
%^^A     \textbar{} Code:
%^^A     \href{https://codeberg.org/cfr/REPO}{\url{codeberg.org/cfr/REPO}}
%^^A     \textbar{} Mirror:
%^^A     \href{https://github.com/cfr42/REPO}{\url{github.com/cfr42/REPO}}% 
%^^A }}
%^^A \date{\fileversion~\filedate}
\expandafter\newif\csname ifchronoscodetoo\endcsname
\chronoscodetoofalse
%^^A >>> preamble
\begin{document}
%^^A \let\MakePrivateLetters\MyMakePrivateLetters
\DocInput{\chronoscodefilename}
\end{document}
%</driver>
% \fi
%^^A dogfen côd (cyflwyno) <<<
% \changes{v0.9.1}{2025-03-05}{Minimal code documentation.
%   \lpack{docstrip} implementation.}
% \changes{v0.9}{2025-02-27}{First \ctan{} release.}
% ^^A lua will replace v0.0 and 0000/00/00 when tagging
% \ifchronoscodetoo
%   \ProvidesFileSVN{$Id: chronos-code.dtx 11797 2026-03-21 16:01:38Z cfrees $}[v0.9.4 \revinfo]
%   \DefineFileInfoSVN[chronoscode]
%   \GetFileInfoSVN{chronoscode}
%   \let\chronoscodeversion\fileversion
%   \let\chronoscoderev\filerev
%   \let\chronoscodebase\filebase
%   \let\chronoscodeinfo\fileinfo
%   \let\chronoscodedate\filedate
%   \let\chronoscodefilename\filename
% \fi
% \title{\lpack{\chronosfilebase} code\thanks{%
%     This is file \texttt{\chronoscodefilename}.%
%   }%
% }
% \author{Clea F. Rees\thanks{%
%     Bug tracker:
%     \href{https://codeberg.org/cfr/chronos/issues}{\url{codeberg.org/cfr/chronos/issues}}
%     \textbar{} Code:
%     \href{https://codeberg.org/cfr/chronos}{\url{codeberg.org/cfr/chronos}}
%     \textbar{} Mirror:
%     \href{https://github.com/cfr42/chronos}{\url{github.com/cfr42/chronos}}%
%   }%
% }
%^^A \date{\chronoscodedate}%
% \date{\chronoscodeversion\ (\textsc{svn} \chronoscoderev)}%
% \maketitle
% \addtocontents{part}{Implementation}
% 
% \setlength{\parindent}{0pt}
% \setlength{\parskip}{0.5em}
% 
% \begin{abstract}
%   \noindent\lpack{\chronosfilebase} implementation.
% \end{abstract}
%
% Note that part of this code was originally developed with no intention it should be published.
% Much of this code is not written in English and much of the original user interface is similarly non-English.
% Where this is the case, the code now supports English aliases of the original macros and keys.
% However, although I have tried to provide translations of all useful comments, no doubt I have missed some.
% I have also tried to provide some English indication regarding the purpose of commands and keys whose use is ‘obvious’ only if the name is understood.
% These additions are currently very sparsely scattered, however, and you should probably complain by filing a bug if you are actually interested in what it is supposed to do\footnote{%
%   I've been told the main reason to document my code is for future-me.
%   I do not expect future me to require English translations \dots.
%   If you are not me, it would therefore be useful to let me know.%
% }.
% 
% \restoregeometry
% \setlength\tewadjust{\marginparwidth+\marginparsep-\paperwidth+\textwidth+\oddsidemargin+1in}%
% \pagestyle{fancy}%
% \thispagestyle{fancyplain}%
% \fancyheadoffset[lh]{\tewadjust}%
%^^A doctools redefn of macrocode is singularly ineffective:
%^^A the environment just ends up undefined 
%^^A so fallback to restored l3p's 
%^^A note that it causes problems with links to restore this in 
%^^A BEGINdocument
%^^A and the redefn of environment just prints the name ...
% \let\macrocode\chronosdocmacrocode
% \let\endmacrocode\endchronosdocmacrocode
% \let\environment\chronosdocenvironment
% \let\endenvironment\endchronosdocenvironment
% \let\OrigMakePrivateLetters\MakePrivateLetters
%^^A \let\MakePrivateLetters\MyMakePrivateLetters
% \ExplSyntaxOn
% \cs_new:Npn \__chronosdoc_mpl: {
%   \char_set_catcode_letter:N \@\char_set_catcode_letter:N \_\char_set_catcode_letter:N \:
% }
% \cs_set_eq:NN \MakePrivateLetters \__chronosdoc_mpl:
% \ExplSyntaxOff
%^^A >>> dogfen côd (cyflwyno) 
% \iffalse
%<*sty>
% \fi
% \section[chronos]{\lpack{chronos}}\label{sec:cod-pkg}%^^A <<< (pkg)
% \LaTeXe{} package.
%    \begin{macrocode}
\RequirePackage{svn-prov}
\ProvidesPackageSVN[chronos.sty]{$Id: chronos-code.dtx 11797 2026-03-21 16:01:38Z cfrees $}[v0.9.4 \revinfo]
\DefineFileInfoSVN[chronos]
%    \end{macrocode}
% \iffalse
% ^^A Paid â defnyddio \GetFileInfoSVN*/\GetFileInfoSVN{} yn y fan hon!!
% \fi
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2021-11-15]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    \end{macrocode}
% copied verbatim, excepting format from Joseph Wright's \path{siunitx.sty} under LPPL
%    \begin{macrocode}
\@ifundefined{ExplLoaderFileDate}{%
  \RequirePackage{expl3}%
}{}
%    \end{macrocode}
% almost verbatim from \path{siunitx.sty}
%    \begin{macrocode}
\@ifl@t@r\ExplLoaderFileDate{2022-02-24}{%
}{%
  \PackageError{chronos}{Support package expl3 too old}
  {%
    You need to update your installation of the bundles 'l3kernel' and
    'l3packages'.\MessageBreak
    Loading~chronos~will~abort!%
  }%
  \endinput
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ExplSyntaxOn
\newif\ifchronos@enwaulliwsyml
%    \end{macrocode}
% \begin{key}{simple colour names,simple color names,no simple colour names,no simple color names}%^^A <<<
%   Only a single option really.
%    \begin{macrocode}
\keys_define:nn { chronos } %^^A <<<
{
  enwau~lliw~syml .legacy_if_set:n = chronos@enwaulliwsyml,
  enwau~lliw~syml .default:n = true,
  enwau~lliw~syml .initial:n = true,
  enwau~lliw~syml .usage:n = general,
  simple~colour~names .legacy_if_set:n = chronos@enwaulliwsyml,
  simple~colour~names .default:n = true,
  simple~colour~names .usage:n = general,
  simple~color~names .legacy_if_set:n = chronos@enwaulliwsyml,
  simple~color~names .default:n = true,
  simple~color~names .usage:n = general,
  dim~enwau~lliw~syml .legacy_if_set_inverse:n = chronos@enwaulliwsyml,
  dim~enwau~lliw~syml .default:n = true,
  dim~enwau~lliw~syml .usage:n = general,
  no~simple~colour~names .legacy_if_set_inverse:n = chronos@enwaulliwsyml,
  no~simple~colour~names .default:n = true,
  no~simple~colour~names .usage:n = general,
  no~simple~color~names .legacy_if_set_inverse:n = chronos@enwaulliwsyml,
  no~simple~color~names .default:n = true,
  no~simple~color~names .usage:n = general,
} %^^A >>>
%    \end{macrocode}
% \end{key}%^^A >>>
% \begin{macro}{\IfFormatAtLeastTF}%^^A <<<
% Joseph Wright: from \path{siunitx.sty} ; \url{https://chat.stackexchange.com/transcript/message/64327823#64327823}
%    \begin{macrocode}
\providecommand \IfFormatAtLeastTF { \@ifl@t@r \fmtversion }
%    \end{macrocode}
% \end{macro}%^^A >>>
%    \begin{macrocode}
\IfFormatAtLeastTF { 2022-06-01 }
{
  \ProcessKeyOptions [ chronos ] 
}{
  \RequirePackage { l3keys2e }
  \ProcessKeysOptions { chronos }
}
%    \end{macrocode}
%^^A if we require 2022-02-24 expl3 above what is this for?
%^^A is it even possible to use that expl3 with somehow an older format?
%^^A (wasn't expl3 in the format by then?)
%    \begin{macrocode}
\IfFormatAtLeastTF { 2020-10-01 }{
}{
  \RequirePackage { xparse }
  \providecommand \ExpandArgs [1]
  { \cs_if_exist_use:c { exp_args:N #1 } }
}
\ExplSyntaxOff
\RequirePackage{xcolor}
%    \end{macrocode}
% A mae fixedpointarithmetic eisiau fp - fixedpointarithmetic needs fp
%    \begin{macrocode}
\RequirePackage{tikz,etoolbox,pgfcalendar,calc,fp}% rwyt ti *eisiau* calc!
\usetikzlibrary{arrows.meta,calc,positioning,fixedpointarithmetic,decorations.%
  text,fit,shadows}
\IfFileExists{tikzlibrarycfrforeground.code.tex}{%
  \usetikzlibrary{cfrforeground}%
}{%
  \usetikzlibrary{backgrounds}%
}
%    \end{macrocode}
%^^A BEGIN expl3 <<<
%    \begin{macrocode}
\ExplSyntaxOn
%    \end{macrocode}
%^^A BEGIN booleans
%    \begin{macrocode}
\bool_new:N \l__chronos_byw_troi_bool
\bool_new:N \l__chronos_digwyddiad_troi_bool
\bool_new:N \l__chronos_parhad_troi_bool
\bool_new:N \l__chronos_theori_troi_bool
\bool_new:N \l__chronos_gwybodaeth_troi_bool
\bool_new:N \l__chronos_troi_bool
%    \end{macrocode}
%^^A END booleans
%^^A BEGIN clists
%    \begin{macrocode}
\clist_new:N \g__chronos_lliwiau_uchod_clist
\clist_new:N \g__chronos_lliwiau_isod_clist
\clist_new:N \g__chronos_lliwiau_byw_uchod_clist
\clist_new:N \g__chronos_lliwiau_byw_isod_clist
\clist_new:N \g__chronos_lliwiau_parhad_uchod_clist
\clist_new:N \g__chronos_lliwiau_parhad_isod_clist
\clist_new:N \g__chronos_lliwiau_digwyddiad_uchod_clist
\clist_new:N \g__chronos_lliwiau_digwyddiad_isod_clist
\clist_new:N \g__chronos_lliwiau_theori_uchod_clist
\clist_new:N \g__chronos_lliwiau_theori_isod_clist
\clist_new:N \g__chronos_lliwiau_uchod_rhag_clist
\clist_new:N \g__chronos_lliwiau_isod_rhag_clist
\clist_new:N \g__chronos_lliwiau_byw_uchod_rhag_clist
\clist_new:N \g__chronos_lliwiau_byw_isod_rhag_clist
\clist_new:N \g__chronos_lliwiau_parhad_uchod_rhag_clist
\clist_new:N \g__chronos_lliwiau_parhad_isod_rhag_clist
\clist_new:N \g__chronos_lliwiau_digwyddiad_uchod_rhag_clist
\clist_new:N \g__chronos_lliwiau_digwyddiad_isod_rhag_clist
\clist_new:N \g__chronos_lliwiau_theori_uchod_rhag_clist
\clist_new:N \g__chronos_lliwiau_theori_isod_rhag_clist
\clist_new:N \l__chronos_llythrennau_bach_clist
\clist_set:Nn \l__chronos_llythrennau_bach_clist 
{ 
  a, an, and, as, but, for, if, in, is, of, on, the 
}
\clist_new:N \l__chronos_dyddiadau_coords_clist
\clist_new:N \l__chronos_subheadings_clist
\clist_new:N \g__chronos_century_subheadings_clist
\clist_new:N \l__chronos_headings_clist
\clist_new:N \l__chronos_tmpa_clist
\clist_new:N \g__chronos_tmpa_clist
\clist_new:N \l__chronos_tmpb_clist
\clist_new:N \l__chronos_tmpc_clist
%    \end{macrocode}
%^^A END clists
%^^A BEGIN integers
%    \begin{macrocode}
\int_gzero_new:N \g__chronos_int
\int_new:N \l__chronos_tmpa_int
\int_new:N \l__chronos_tmpb_int
%    \end{macrocode}
%^^A END integers
%^^A BEGIN prop
%    \begin{macrocode}
\prop_new:N \l__chronos_byw_prop
\prop_new:N \l__chronos_digwyddiad_prop
\prop_new:N \l__chronos_gwybodaeth_prop
\prop_new:N \l__chronos_parhad_prop
\prop_new:N \l__chronos_theori_prop
%    \end{macrocode}
%^^A \prop_new:N \l__chronos_cylchtheori_prop
%    \begin{macrocode}
\prop_new:N \l__chronos_rhagosedig_prop
\prop_new:N \l__chronos_prop
\prop_new:N \l__chronos_tmpa_prop
%    \end{macrocode}
%^^A END prop
%^^A BEGIN regexes
%    \begin{macrocode}
\regex_const:Nn \c__chronos_enw_regex { [^A-Za-z0-9\s\-] }
\regex_const:Nn \c__chronos_enw_priflythren_cyntaf_regex { (^[^A-Za-z]*)([a-z]) }
\regex_const:Nn \c__chronos_enw_diogelu_regex 
{ 
  ([\s\-\c{\\}][[:punct:]]*) ([^\s\-\c{\\}]*) (\b|\c{\\}) 
} % \s unrhyw space character \b word boundary
%    \end{macrocode}
%^^A \regex_const:Nn \c__chronos_pure_year_regex { ^ [\+\-]? \d+ \z }% \z = \Z = $ ($ yn newid popeth i maths yn ôl Kile!)
%    \begin{macrocode}
\regex_const:Nn \c__chronos_curly_bracket { [ \{ \} ] }
\regex_const:Nn \c__chronos_initial_minus { ^\- }
%    \end{macrocode}
%^^A END regexes
%^^A BEGIN seq
%    \begin{macrocode}
\seq_new:N \l__chronos_gosod_seq
\seq_new:N \l__chronos_tmpa_seq
%    \end{macrocode}
%^^A END seq
%^^A BEGIN token lists
%    \begin{macrocode}
\tl_new:N \l__chronos_lliw_tl
\tl_new:N \l__chronos_date_tl
\tl_new:N \l__chronos_dateformat_tl
\tl_new:N \l__chronos_year_tl
\tl_new:N \l__chronos_yearformat_tl
\tl_new:N \l__chronos_minoryearformat_tl
\tl_new:N \l__chronos_tikzname_tl
\tl_set:Nn \l__chronos_dateformat_tl { !d/!m/!Y }
\tl_set:Nn \l__chronos_yearformat_tl { !Y }
\tl_set:Nn \l__chronos_minoryearformat_tl { !c }
\tl_new:N \l__chronos_tmpa_tl
\tl_new:N \l__chronos_tmpb_tl
\tl_new:N \l__chronos_tmpc_tl
\tl_new:N \l__chronos_tmpd_tl
%    \end{macrocode}
%^^A END token lists
% \begin{colkey}{foreground,background,timeline foreground,timeline background,timeline border outer,timeline border inner,timeline border middle,life,period,event,theory,info}
%   Colour keys handled by \lpack{l3keys}.
%    \begin{macrocode}
\keys_define:nn { chronos / lliwiau }%^^A <<<
{
  foreground .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@prifliw}{#1}},
  foreground .groups:n = {core},
  background .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@prifliw@cefndir}{#1}},
  background .groups:n = {core},
  timeline ~ foreground .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@lliw@llinell}{#1} 
  },
  timeline ~ foreground .groups:n = {core ~ derivative},
  timeline ~ background .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@lliw@cefndir@llinell}{#1}},
  timeline ~ background .groups:n = {core ~ derivative},
  timeline ~ border ~ outer  .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@borderouter}{#1}},
  timeline ~ border ~ outer .groups:n = {core ~ border},
  timeline ~ border ~ inner  .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@borderinner}{#1}},
  timeline ~ border ~ inner .groups:n = {core ~ border},
  timeline ~ border ~ middle  .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@bordermiddle}{#1}},
  timeline ~ border ~ middle .groups:n = {core ~ border},
  life / default .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@byw@lliw@rhagosodedig}{#1}},
  event / default .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@digwyddiad@lliw@rhagosodedig}{#1}},
  period / default .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@parhad@lliw@rhagosodedig}{#1}},
  theory / default .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@theori@lliw@rhagosodedig}{#1}},
  info / default .code:n = {\__chronos_color_set_from_existing:nn 
    {chronos@gwybodaeth@lliw@rhagosodedig}{#1}},
%    \end{macrocode}
% \end{colkey}
% \begin{collistkey}{default above,default below,life above,life below,event above,event below,period above,period below,theory above,theory below}
%   Colour list keys handled by \lpack{l3keys}.
%    \begin{macrocode}
  default ~ above .clist_gset:N = \g__chronos_lliwiau_uchod_clist,
  default ~ below .clist_gset:N = \g__chronos_lliwiau_isod_clist,
  life /  above .clist_gset:N = \g__chronos_lliwiau_byw_uchod_clist,
  life / below .clist_gset:N = \g__chronos_lliwiau_byw_isod_clist,
  event / above .clist_gset:N = \g__chronos_lliwiau_digwyddiad_uchod_clist,
  event / below .clist_gset:N = \g__chronos_lliwiau_digwyddiad_isod_clist,
  period / above .clist_gset:N = \g__chronos_lliwiau_parhad_uchod_clist,
  period / below .clist_gset:N = \g__chronos_lliwiau_parhad_isod_clist,
  theory / above .clist_gset:N = \g__chronos_lliwiau_theori_uchod_clist,
  theory / below .clist_gset:N = \g__chronos_lliwiau_theori_isod_clist,
}%^^A >>>
%    \end{macrocode}
% \end{collistkey}
%^^A BEGIN functions <<<
%^^A BEGIN functions : dyddiadau <<<
% YY yn lle YYYY
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \__chronos_year_shorten:n #1
{
  \int_set:Nn \l__chronos_tmpa_int { \tl_count:n { #1 } }
  \int_compare:nTF
  {
    \l__chronos_tmpa_int < 3
  }
  {
    #1
  }
  {
    \int_compare:nTF
    {
      \l__chronos_tmpa_int < 4
    }
    {
      \__chronos_year_shorten_aux:w 0 #1 \q_stop
    }
    {
      \__chronos_year_shorten_aux:w #1 \q_stop % expl3 manuaal, 46
    }
  }
}
\cs_new_protected_nopar:Npn \__chronos_year_shorten_aux:w #1 #2 #3 #4 \q_stop
{
  #3 #4
}
\cs_generate_variant:Nn \__chronos_year_shorten:n { V , v , e }
\cs_new_protected_nopar:Npn \__chronos_year_semi_shorten:n #1
{
%    \end{macrocode}
%^^A   \int_set:Nn \l__chronos_tmpb_int { \int_abs:n {#1} }
%^^A   \tl_set:Nx \l__chronos_tmpc_tl { \int_to_arabic:n { \l__chronos_tmpb_int } }
%    \begin{macrocode}
  \int_set:Nn \l__chronos_tmpa_int { \tl_count:n { #1 } }
  \int_compare:nTF
  {
    \l__chronos_tmpa_int < 4
  }
  {
    #1
  }
  {
%    \end{macrocode}
% \lpack{expl3} manual, 46 (w/\verb|q_stop|?) ; \S\,5.7 Unbraced     
%    \begin{macrocode}
    \__chronos_year_semi_shorten_aux:w #1 \q_stop 
%    \end{macrocode}
%^^A     \exp_last_unbraced:NV \__chronos_year_semi_shorten_aux:w \l__chronos_tmpc_tl \q_stop % expl3 manual, 46 (w/q_stop?) ; \S\,5.7 Unbraced Expansion: osgoi \exp_after:wN ble sy'n bosibl (\exp_args:N* yn well 'na \exp_last_unbraced:N*? wn i ddim sut i ddefnyddio hynny beth bynnag)
%^^A     \exp_after:wN \__chronos_year_semi_shorten_aux:w \l__chronos_tmpc_tl \q_stop % expl3 manuaal, 46
%    \begin{macrocode}
  }
}
\cs_new_protected_nopar:Npn \__chronos_year_semi_shorten_aux:w #1 #2 #3 #4 \q_stop
{
  #2 #3 #4
}
\cs_generate_variant:Nn \__chronos_year_semi_shorten:n { V , v , e }
\cs_generate_variant:Nn \int_abs:n { v }
\cs_generate_variant:Nn \tl_replace_all:Nnn { Nne }
%    \end{macrocode}
% dangos dyddiadau \textbar{} show dates
% 
% ateb Joseph Wright: \url{http://tex.stackexchange.com/a/327642/} ; PD/CCO at \url{https://tex.stackexchange.com/users/73/joseph-wright}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \__chronos_show_date:n #1
{% 
  \tl_set_eq:NN \l__chronos_date_tl \l__chronos_dateformat_tl
  \tl_replace_all:Nne \l__chronos_date_tl { !a }
    { \pgfcalendarweekdayshortname{\thechronos@weekday} }
  \tl_replace_all:Nne \l__chronos_date_tl { !A }
    { \pgfcalendarweekdayname{\thechronos@weekday} }
  \tl_replace_all:Nne \l__chronos_date_tl { !b }
    { \pgfcalendarmonthshortname{\csname chronos@#1month\endcsname} }
  \tl_replace_all:Nne \l__chronos_date_tl { !B }
    { \pgfcalendarmonthname{\csname chronos@#1month\endcsname} }
  \tl_replace_all:Nne \l__chronos_date_tl { !c }
    { \__chronos_year_semi_shorten:e { \int_abs:v { chronos@#1year } } }
  \tl_replace_all:Nne \l__chronos_date_tl { !d }
    { \csname chronos@#1day\endcsname }
  \tl_replace_all:Nne \l__chronos_date_tl { !E }
    { \__chronos_dateformat_era:v { chronos@#1year } }
  \tl_replace_all:Nne \l__chronos_date_tl { !m }
    { \csname chronos@#1month\endcsname }
  \tl_replace_all:Nne \l__chronos_date_tl { !q }
    { \__chronos_dateformat_sign:v { chronos@#1year } }
  \tl_replace_all:Nne \l__chronos_date_tl { !Q }
    { \__chronos_dateformat_signs:v { chronos@#1year } }
  \tl_replace_all:Nne \l__chronos_date_tl { !y }
    { \__chronos_year_shorten:e { \int_abs:v { chronos@#1year } } }
  \tl_replace_all:Nne \l__chronos_date_tl { !Y }
    { \int_abs:v { chronos@#1year } }
  \l__chronos_date_tl
}
\cs_new_protected_nopar:Npn \__chronos_show_year:n #1
{% ateb Joseph Wright: \url{http://tex.stackexchange.com/a/327642/} ; PD/CCO at \url{https://tex.stackexchange.com/users/73/joseph-wright}
  \tl_set_eq:NN \l__chronos_year_tl \l__chronos_yearformat_tl
  \tl_replace_all:Nne \l__chronos_year_tl { !c }
    { \__chronos_year_semi_shorten:e { \int_abs:n { #1 } } }
  \tl_replace_all:Nne \l__chronos_year_tl { !E }
    { \__chronos_dateformat_era:n { #1 } }
  \tl_replace_all:Nne \l__chronos_year_tl { !q }
    { \__chronos_dateformat_sign:n { #1 } }
  \tl_replace_all:Nne \l__chronos_year_tl { !Q }
    { \__chronos_dateformat_signs:n { #1 } }
  \tl_replace_all:Nne \l__chronos_year_tl { !y }
    { \__chronos_year_shorten:e { \int_abs:n { #1 } } }
  \tl_replace_all:Nne \l__chronos_year_tl { !Y }
    { \int_abs:n { #1 } }
  \l__chronos_year_tl
}
\cs_new_protected_nopar:Npn \__chronos_dateformat_sign:n #1
{
  \int_compare:nT { #1 < 0 } { - }
}
\cs_generate_variant:Nn \__chronos_dateformat_sign:n { v }
\cs_new_protected_nopar:Npn \__chronos_dateformat_signs:n #1
{
  \int_compare:nTF
  { #1 < 0 } { - }
  {
    \int_compare:nT { #1 > 0 }
    {
      +
    }
  }
}
\cs_generate_variant:Nn \__chronos_dateformat_signs:n { v }
\cs_new_protected_nopar:Npn \__chronos_dateformat_era:n #1
{
  \int_compare:nTF
  { #1 < 0 } { \chronos@yearbce }
  {
    \int_compare:nT { #1 > 0 }
    {
      \chronos@yearce
    }
  }
}
\cs_generate_variant:Nn \__chronos_dateformat_era:n { v }
\cs_new_protected_nopar:Npn \__chronos_set_dateformat:n #1
{
  \tl_set:Nn \l__chronos_dateformat_tl { #1 }
  \tl_replace_all:Nnn \l__chronos_dateformat_tl { ~ } { \c_space_token }
}
\cs_generate_variant:Nn \__chronos_set_dateformat:n { v }
\cs_new_protected_nopar:Npn \__chronos_set_yearformat:n #1
{
  \tl_set:Nn \l__chronos_yearformat_tl { #1 }
  \tl_replace_all:Nnn \l__chronos_yearformat_tl { ~ } { \c_space_token }
}
\cs_generate_variant:Nn \__chronos_set_yearformat:n { V }
\cs_new_protected_nopar:Npn \__chronos_set_minoryearformat:n #1
{
  \tl_set:Nn \l__chronos_minoryearformat_tl { #1 }
  \tl_replace_all:Nnn \l__chronos_minoryearformat_tl { ~ } { \c_space_token }
}
\cs_generate_variant:Nn \__chronos_set_minoryearformat:n { V }
\cs_generate_variant:Nn \regex_match:NnTF { NVTF }
\cs_new_protected_nopar:Nn \__chronos_set_date_aux:n 
{
  \tl_set:Ne \l__chronos_tmpc_tl { #1 }
  \regex_replace_all:NnN \c__chronos_curly_bracket {} \l__chronos_tmpc_tl
  \regex_match:NVTF \c__chronos_initial_minus \l__chronos_tmpc_tl 
  {
    \exp_last_unbraced:NV \__chronos_set_date_aux_bce:w \l__chronos_tmpc_tl \q_stop 
  }{ 
    \exp_last_unbraced:NV \__chronos_set_date_aux_ce:w \l__chronos_tmpc_tl \q_stop
  }
}
\cs_new_protected_nopar:Nn \__chronos_set_date:nnnn 
{
    \pgfcalendardatetojulian{{#1}-#2-#3}{\c@chronos@date}%
    \setcounter{chronos@#4date}{\thechronos@date}%
    \legacy_if:nF { chronos@yearzero }
    {
      \int_compare:nNnT { 0 } < { #1 }
      {
        \addtocounter{chronos@#4date}{-366}%
      }
    }
    \expandafter\def\csname chronos@#4year\endcsname{#1}%
    \expandafter\def\csname chronos@#4month\endcsname{#2}%
    \expandafter\def\csname chronos@#4day\endcsname{#3}%
}
\cs_new_protected_nopar:Npn \__chronos_set_date_aux_bce:w -#1 - #2 -  #3 - #4 @#5 \q_stop
{
  \__chronos_set_date:nnnn {-#1} {#2} {#3} {#5}
}
\cs_new_protected_nopar:Npn \__chronos_set_date_aux_ce:w #1 - #2 - #3 - #4 @#5 \q_stop
{
    \__chronos_set_date:nnnn {#1} {#2} {#3} {#5}
}
%    \end{macrocode}
%^^A END functions : dyddiadau >>>
%^^A BEGIN functions : lliwiau <<<
%    \begin{macrocode}
\cs_new_protected_nopar:Nn \__chronos_troilliwiau:nn
{
  \clist_if_empty:cTF { g__chronos_lliwiau_#1_#2_clist }
  {
    \clist_gpop:cN { g__chronos_lliwiau_#2_clist } \l__chronos_lliw_tl
    \clist_gput_right:cV { g__chronos_lliwiau_#2_clist } \l__chronos_lliw_tl
  }{
    \clist_gpop:cN { g__chronos_lliwiau_#1_#2_clist } \l__chronos_lliw_tl
    \clist_gput_right:cV { g__chronos_lliwiau_#1_#2_clist } \l__chronos_lliw_tl
  }
}
\cs_new_nopar:Nn \__chronos_color_set_from_existing:nn { \colorlet {#1} {#2} }
%    \end{macrocode}
%^^A \cs_new_protected_nopar:Nn \__chronos_darparu_lliw:nn
%^^A {
%^^A   \color_if_exist:nF { #1 } { \color_set_eq:nn { #1 } { #2 } }
%^^A }
%^^A \cs_generate_variant:Nn \__chronos_darparu_lliw:nn { Vn }
%^^A END functions : lliwiau >>>
%^^A BEGIN functions : enwau <<<
%    \begin{macrocode}
\cs_new_protected_nopar:Nn \__chronos_creu_tikzname:n
{
  \int_compare:nTF { \tl_count:n { #1 } < 2 }
%    \end{macrocode}
% expand unwaith os llai na 2 token yn \#1 (gallu defnyddio pgffor loops i greu digwyddiadau etc.)
%
% expand once if fewer than 2 tokens in \#1 (can use \lpack{pgffor} loops to create events etc.)
%    \begin{macrocode}
  {
    \tl_set:No \l__chronos_tikzname_tl { #1 }
%    \end{macrocode}
% fel arall, peidio i ddiogelu macros fformatio (e.e. \cs{emph}{} etc.)
%
% otherwise, don't protect formatting macros (e.g.~\cs{emph}{} etc.)
%
% (what did I mean by this?)
%    \begin{macrocode}
  }{
    \tl_set:Nn \l__chronos_tikzname_tl { #1 }
  }
  \regex_replace_all:NnN \c__chronos_enw_regex { } \l__chronos_tikzname_tl
}
\cs_new_protected_nopar:Nn \__chronos_enw_priflythrennu_eraill:n
{
  \clist_if_in:NnTF \l__chronos_llythrennau_bach_clist { #1 } { #1 } 
  { 
    \str_uppercase:n #1 
  }
}
\cs_new_protected_nopar:Nn \__chronos_enw_priflythrennu:n
{
  \tl_set:Nn \l__chronos_tmpc_tl { #1 }
  \legacy_if:nF {chronos@felymae}
  {
    \regex_replace_all:NnN \c__chronos_enw_diogelu_regex 
    { 
      \1 \c{__chronos_enw_priflythrennu_eraill:n} \cB{ \2 \cE} \3 
    } \l__chronos_tmpc_tl
    \regex_replace_all:NnN \c__chronos_enw_priflythren_cyntaf_regex 
    { 
      \1 \c{str_uppercase:n}\2 
    } \l__chronos_tmpc_tl
  }
  \l__chronos_tmpc_tl
}
\cs_generate_variant:Nn \__chronos_enw_priflythrennu:n { V,o }
%    \end{macrocode}
%^^A END functions : enwau >>>
%^^A BEGIN functions: containment 
% functions: containment
%    \begin{macrocode}
\cs_new_protected_nopar:Nn \__chronos_at_begin: %^^A <<< functions: containment
{
  \cs_set_eq:NN \chronosset \@@chronosset
  \pgfsetlayers{\chronos@layers}% cadw newidiadau tu mewn i'r grwp
  \chronos@baselineskip=\baselineskip
  \cs_if_free:NT \chronosbaselineskip 
  { 
    \cs_new_eq:NN \chronosbaselineskip \chronos@baselineskip 
  }
  \int_gincr:N \g__chronos_int
} %^^A >>>  functions: containment
%    \end{macrocode}
%^^A BEGIN functions: pgf keys <<<
% \lpack{pgfkeys}
%^^A BEGIN functions: pgf keys (prop)
%    \begin{macrocode}
\cs_new_protected_nopar:Nn \__chronos_cadw_nodweddion:nnn
{% #1: tag #2 key #3 key-value list
  \prop_put:cnn { l__chronos_#1_prop } { #2 } { {#3} }
}
\cs_new_protected_nopar:Nn \__chronos_cadw_nodweddion_rhag:nn
{% #1: tag #2 key #3 key-value list
  \prop_put:Nnn \l__chronos_prop  { #1 } { {#2} }
}
\cs_generate_variant:Nn \prop_put_from_keyval:Nn { cV }
\cs_new_protected_nopar:Nn \__chronos_cadw_nodweddion_rhestr:nnn
{
  \clist_map_inline:nn { #1 }
  {
    \prop_put:cnn { l__chronos_##1_prop } { #2 } { {#3} } 
  }
}
\cs_new_protected_nopar:Nn \__chronos_ychwanegu_nodweddion:nnn
{ % roedd y problem yn #3 yn eisoes!
  \prop_get:cnNTF { l__chronos_#1_prop } { #2 } \l__chronos_tmpc_tl
   {
     \tl_set:Nn \l__chronos_tmpd_tl { #3 }
     \regex_replace_all:nnN { \\ } { \\\\ } \l__chronos_tmpd_tl
     \regex_replace_once:nnN { \}\z } { , \u{l__chronos_tmpd_tl} \} } \l__chronos_tmpc_tl
     \prop_put:cnV { l__chronos_#1_prop } { #2 } \l__chronos_tmpc_tl
   }{
     \prop_put:cnn { l__chronos_#1_prop } { #2 } { {#3} } 
   }
}
\cs_new_protected_nopar:Nn \__chronos_ychwanegu_nodweddion_rhestr:nnn
{ % ##  #1 rhestr o prop lists; #2 property; #3 value
  \clist_map_inline:nn { #1 }
  {
    \prop_get:cnNTF { l__chronos_##1_prop } { #2 } \l__chronos_tmpc_tl
    {
      \tl_set:Nn \l__chronos_tmpd_tl { #3 }
      \regex_replace_all:nnN { \\ } { \\\\ } \l__chronos_tmpd_tl
      \regex_replace_once:nnN { \}\z } { , \u{l__chronos_tmpd_tl} \} } \l__chronos_tmpc_tl
      \prop_put:cnV { l__chronos_##1_prop } { #2 } \l__chronos_tmpc_tl
    }{
      \prop_put:cnn { l__chronos_##1_prop } { #2 }  { {#3} } 
    }
  }
}
\cs_new_protected_nopar:Nn \__chronos_ychwanegu_nodweddion_rhestr_pre:nnn
{ % ##  #1 rhestr o prop lists; #2 property; #3 value
  \clist_map_inline:nn { #1 }
  {
    \prop_get:cnNTF { l__chronos_##1_prop } { #2 } \l__chronos_tmpc_tl
    {
      \tl_set:Nn \l__chronos_tmpd_tl { #3 }
      \regex_replace_all:nnN { \\ } { \\\\ } \l__chronos_tmpd_tl
      \regex_replace_once:nnN { ^\{ } { \{ \u{l__chronos_tmpd_tl} , } \l__chronos_tmpc_tl
      \prop_put:cnV { l__chronos_##1_prop } { #2 } \l__chronos_tmpc_tl
    }{
      \prop_put:cnn { l__chronos_##1_prop } { #2 }  { {#3} } 
    }
  }
}
\cs_new_protected_nopar:Nn \__chronos_ychwanegu_nodweddion_rhag:nn
{
  \prop_get:cnNTF { l__chronos_prop } { #1 } \l__chronos_tmpc_tl
  {
    \tl_set:Nn \l__chronos_tmpd_tl { #2 }
    \regex_replace_all:nnN { \\ } { \\\\ } \l__chronos_tmpd_tl
%    \end{macrocode}
%^^A     \regex_replace_all:nnN { ( \cP ) } { \1\1 } \l__chronos_tmpd_tl
%    \begin{macrocode}
    \regex_replace_once:nnN { \}\z } { , \u{l__chronos_tmpd_tl} \} } \l__chronos_tmpc_tl
    \prop_put:NnV \l__chronos_prop { #1 } \l__chronos_tmpc_tl
  }{
    \prop_put:Nnn \l__chronos_prop  { #1 } { {#2} } 
  }
}
\cs_new_protected_nopar:Nn \__chronos_ychwanegu_nodweddion_rhag_pre:nn
{
  \prop_get:cnNTF { l__chronos_prop } { #1 } \l__chronos_tmpc_tl
  {
    \tl_set:Nn \l__chronos_tmpd_tl { #2 }
    \regex_replace_all:nnN { \\ } { \\\\ } \l__chronos_tmpd_tl
    \regex_replace_once:nnN { ^\{ } { \{ \u{l__chronos_tmpd_tl} , } \l__chronos_tmpc_tl
    \prop_put:NnV \l__chronos_prop { #1 } \l__chronos_tmpc_tl
  }{
    \prop_put:Nnn \l__chronos_prop  { #1 } { {#2} } 
  }
}
\cs_generate_variant:Nn \prop_concat:NNN { NNc }
\cs_new_protected_nopar:Nn \__chronos_gosod_nodweddion:n
{
%    \end{macrocode}
% cadw status \textbar{} save status
%    \begin{macrocode}
  \prop_set_eq:NN \l__chronos_rhagosedig_prop \l__chronos_prop
  \prop_concat:NNc \l__chronos_tmpa_prop \l__chronos_prop { l__chronos_#1_prop }
  \prop_set_eq:NN \l__chronos_prop \l__chronos_tmpa_prop
  \prop_map_function:NN \l__chronos_prop \__chronos_tikzset:nn
}
\cs_generate_variant:Nn \__chronos_gosod_nodweddion:n { V }
\cs_new_protected_nopar:Nn \__chronos_ailosod_nodweddion:
{
  \prop_set_eq:NN \l__chronos_prop \l__chronos_rhagosedig_prop
  \prop_map_function:NN \l__chronos_prop \__chronos_tikzset:nn
}
\cs_new_protected_nopar:Nn \__chronos_dangos_nodweddion:n
{
  \str_case:nnF { #1 }
  {
    { life } { \prop_show:N \l__chronos_byw_prop }
    { event } { \prop_show:N \l__chronos_digwyddiad_prop }
    { period } { \prop_show:N \l__chronos_parhad_prop }
    { theory } { \prop_show:N \l__chronos_theori_prop }
    { info } { \prop_show:N \l__chronos_gwybodaeth_prop }
  }{
    \prop_show:c { l__chronos_#1_prop }
  }
}
\cs_new_protected_nopar:Nn \__chronos_dangos_nodweddion_rhag:
{
  \prop_show:N \l__chronos_prop 
}
\cs_new_protected_nopar:Nn \__chronos_tikzset:nn
{% \pgfqkeys{#1}{#2} = \pgfkeys{#1/.cd}{#2} ond yn gyflymach (Skillman a t 977)
  \pgfqkeys {/chronos} { #1/.style = #2 }
}
%    \end{macrocode}
%^^A END functions: pgf keys (prop)
%^^A BEGIN functions: pgf keys (lliwiau)
%    \begin{macrocode}
\cs_new_protected_nopar:Nn \__chronos_lliwiau_cadw_rhag:
{
  \clist_map_inline:nn { byw, digwyddiad, parhad, theori }
  {
    \clist_map_inline:nn { isod, uchod }
    {
      \clist_gset_eq:cc { g__chronos_lliwiau_##1_####1_rhag_clist } 
      { 
        g__chronos_lliwiau_##1_####1_clist 
      }
    }
  }
  \clist_gset_eq:NN \g__chronos_lliwiau_isod_rhag_clist \g__chronos_lliwiau_isod_clist
  \clist_gset_eq:NN \g__chronos_lliwiau_uchod_rhag_clist \g__chronos_lliwiau_uchod_clist
}
\cs_new_protected_nopar:Nn \__chronos_lliwiau_clirio:
{
  \clist_map_inline:nn { byw, digwyddiad, parhad, theori }
  {
    \clist_map_inline:nn { isod, uchod }
    {
      \clist_gset_eq:cc { g__chronos_lliwiau_##1_####1_clist }
      { 
        g__chronos_lliwiau_##1_####1_rhag_clist 
      }
    }
  }
  \clist_gset_eq:NN \g__chronos_lliwiau_isod_clist \g__chronos_lliwiau_isod_rhag_clist
  \clist_gset_eq:NN \g__chronos_lliwiau_uchod_clist \g__chronos_lliwiau_uchod_rhag_clist
}
%    \end{macrocode}
%^^A END functions: pgf keys (lliwiau)
%^^A BEGIN functions: pgf keys (headings)
%    \begin{macrocode}
\cs_new_protected_nopar:Nn \__chronos_at_end:
{
  \clist_if_empty:NF \l__chronos_headings_clist
  {
    \clist_remove_duplicates:N \l__chronos_headings_clist
    \clist_map_inline:Nn \l__chronos_headings_clist
    {
      \foreach \i/\j/\k in {##1} {%
        \testunteitl[/chronos/@amseraumawr]{\i}{\j}{\k}(chronos ~ main ~ headings)}%^^A paid â defnyddio ';' neu dim byd yma
      \legacy_if:nT { chronos@placeholders}
      {
        \scoped[on ~ chronos ~ foreground ~ layer]
        {
          \foreach \i/\j/\k in {##1} {\draw [/chronos/placeholder ~ lines] %
            (chronos ~ main ~ headings -| \j) edge ~ node {\j} %
            (chronos ~ bottom -| \j) (chronos ~ main ~ headings -| \k) %
            edge ~ node {\k} (chronos ~ bottom -| \k);}
        }
      }
    }
  }
  \clist_if_empty:NF \l__chronos_subheadings_clist
  {
    \clist_remove_duplicates:N \l__chronos_subheadings_clist
    \clist_map_inline:Nn \l__chronos_subheadings_clist
    {
      \foreach \i/\j/\k/\m in {##1} {\testunteitl[/chronos/@amserau]{\i}{\j}{\k}(\m)}%^^A paid â defnyddio ';' neu dim byd yn y fan hon
    }
  }
  \clist_if_empty:NF \g__chronos_century_subheadings_clist
  {
    \clist_remove_duplicates:N \g__chronos_century_subheadings_clist
    \clist_map_inline:Nn \g__chronos_century_subheadings_clist
    {
      \seq_set_split:Nnn \l__chronos_tmpa_seq { / } { ##1 }
      \seq_get_left:NN \l__chronos_tmpa_seq \l__chronos_tmpc_tl
      \seq_get_right:NN \l__chronos_tmpa_seq \l__chronos_tmpd_tl
      \int_set:Nn \l__chronos_tmpb_int { 100 * \l__chronos_tmpc_tl }
      \int_set:Nn \l__chronos_tmpa_int { \l__chronos_tmpb_int - 100 }
      \testunteitl[/chronos/@amserau]{\l__chronos_tmpc_tl\l__chronos_tmpd_tl}%
      [\l__chronos_tmpc_tl\textsuperscript{\l__chronos_tmpd_tl}c.]%
      {chronos ~ year ~ \int_to_arabic:n {\l__chronos_tmpa_int}}%
      {chronos ~ year ~ \int_to_arabic:n {\l__chronos_tmpb_int}}%
      (chronos ~ lower ~ subheadings)% paid â defnyddio ';' neu dim byd yn y fan hon
    }
  }
}
%    \end{macrocode}
%^^A END functions: pgf keys (headings)
%^^A BEGIN functions: pgf keys (keys)
% \verb|\__chronos_kex|\meta{whatever} functions just produce groups of pgf keys for the plain/prime/plus triple, standard/every, cy/en and combinations thereof
%
% tldr: reduce clutter/typing and facilitate changes/fixes (hopefully)
%    \begin{macrocode}
\cs_new_protected_nopar:Nn \__chronos_kexpander:nnnn
{ % #1 enw (brif enw) | name (primary name) ; 
  % #2 llwybr/prop tag | path/prop tag ; 
  % #3 rhag | default (' or +) ; 
  % #4 tags
  \pgfqkeys{/chronos} {
    #1'/.code={
      \pgfqkeys{/chronos}{#2/.style={##1}}
      \__chronos_cadw_nodweddion_rhag:nn { #2 } { ##1 }
    },
    #1+/.code={
      \pgfqkeys{/chronos}{#2/.append ~ style={##1}}
      \__chronos_ychwanegu_nodweddion_rhag:nn { #2 } { ##1 }
    },
    #1/.forward ~ to=/chronos/#1#3,
    every ~ #1'/.code={
      \pgfqkeys{/chronos}{#2/.style/.expand ~ once={##1}}
      \__chronos_cadw_nodweddion_rhestr:nnn { #4 } { #2 } { ##1 }
      \__chronos_cadw_nodweddion_rhag:nn { #2 } { ##1 }
    },
    every ~ #1+/.code={
      \pgfqkeys{/chronos}{#2/.append ~ style/.expand ~ once={##1}}
      \__chronos_ychwanegu_nodweddion_rhestr:nnn { #4 } { #2 } { ##1 }
      \__chronos_ychwanegu_nodweddion_rhag:nn { #2 } { ##1 }
    },
    every ~ #1/.forward ~ to=/chronos/every ~ #1#3,
  }
}
\cs_new_protected_nopar:Nn \__chronos_kexpander:nnnnn
{ % #1 enw | name ; 
  % #2 enw saesneg | english name ; 
  % #3 llwybr/prop tag | path/property tag ; 
  % #4 rhag | default (' or +) ; 
  % #5 tags
  \__chronos_kexpander:nnnn { #1 } { #3 } { #4 } { #5 }
  \pgfqkeys{/chronos} {
    #2'/.forward ~ to=/chronos/#1',
    #2+/.forward ~ to=/chronos/#1+,
    #2/.forward ~ to=/chronos/#1,
    every ~ #2'/.forward ~ to=/chronos/every ~ #1',
    every ~ #2+/.forward ~ to=/chronos/every ~ #1+,
    every ~ #2/.forward ~ to=/chronos/every ~ #1,
  }
}
\cs_new_protected_nopar:Nn \__chronos_kexpandtotags:nnn
{ % #1 enw | name ;
  % #2 enw saesneg | english name ;
  % #3 rhag | default (' or +)
  \pgfqkeys{/chronos} {
    every ~ #1'/.code={
      \__chronos_cadw_nodweddion:nnn {#1}{@tag}{##1}
    },
    every ~ #1+/.code={
      \__chronos_ychwanegu_nodweddion:nnn {#1}{@tag}{##1}
    },
    every ~ #1/.forward ~ to=/chronos/every ~ #1#3,
    every ~ #2'/.forward ~ to=/chronos/every ~ #1',
    every ~ #2+/.forward ~ to=/chronos/every ~ #1+,
    every ~ #2/.forward ~ to=/chronos/every ~ #1,
  }
}
\cs_new_protected_nopar:Nn \__chronos_kextripler:nnnn
{ % #1 enw | name ; 
  % #2 llwybr/prop tag | path/prop tag ; 
  % #3 rhag | default ; 
  % #4 math e.e. style neu code | type e.g. style or code
  \pgfqkeys{/chronos} {
    #2/.#4={},
    #1+/.code={
      \pgfqkeys{/chronos}{#2/.append ~ #4={##1}}
    },
    #1'/.code={%
      \pgfqkeys{/chronos}{#2/.#4={##1}}
    },
    #1/.forward ~ to=/chronos/#1#3,
  }
}
\cs_new_protected_nopar:Nn \__chronos_kexforwardtriple:nn
{%
  \pgfqkeys{/chronos} {
    #2'/.forward ~ to=/chronos/#1',
    #2+/.forward ~ to=/chronos/#1+,
    #2/.forward ~ to=/chronos/#1,
  }
}
\cs_new_protected_nopar:Nn \__chronos_kextripler:nnnnn
{ % #1 enw | name ;
  % #2 enw saesneg | english name ;
  % #3 llwybr/prop tag | path/property tag ;
  % #4 rhag | default ;
  % #5 math e.e. style neu code | type e.g. style or code
  \__chronos_kextripler:nnnn { #1 } { #3 } { #4 } { #5 }
  \__chronos_kexforwardtriple:nn { #1 } { #2 }
}
\cs_new_protected_nopar:Nn \__chronos_kexforwarder:nn
{ % #1 llwybr/enw | path/name ;
  % #2 rhestr allweddau newydd | list of new keys
  \clist_map_inline:nn { #2 }
  {
    \pgfqkeys{/chronos} { ##1/.forward ~ to=/chronos/#1 }
  }
}
\cs_new_protected_nopar:Nn \__chronos_kexforwarder:nnn
{ % #1 llwybr | path ;
  % #2 enw | name ;
  % #3 rhestr allweddau newydd ar yr un llwybr | list of new keys on the same path
  \clist_map_inline:nn { #3 }
  {
    \pgfqkeys{/chronos/#1} { ##1/.forward ~ to=/chronos/#1/#2 }
  }
}
\cs_new_protected_nopar:Nn \__chronos_kexkeymaker:nnn
{
  \clist_map_inline:nn { byw, digwyddiad, parhad, theori, gwybodaeth, prif }
  {
    \pgfqkeys{/chronos/##1} { #1/.#2={#3} }
  }
}
%    \end{macrocode}
%^^A END functions: pgf keys (keys)
%^^A END functions: pgf keys >>>
%    \begin{macrocode}
\cs_generate_variant:Nn \legacy_if:nTF { oTF }
%    \end{macrocode}
% Joseph Wright: \url{https://chat.stackexchange.com/transcript/message/65523217#65523217}
%    \begin{macrocode}
\cs_new_eq:NN \__chronos_keys_set_exclude_groups:nnn \keys_set_exclude_groups:nnn
\cs_if_exist:NF \__chronos_keys_set_exclude_groups:nnn
{
  \cs_new_eq:NN \__chronos_keys_set_exclude_groups:nnn \keys_set_filter:nnn
}
%    \end{macrocode}
%^^A END functions >>>
%^^A BEGIN macros y paced <<<
% **mewnol hefyd!** \textbar{} **internal also!**
%    \begin{macrocode}
\newcommand* \chronos@tikzprefix { \int_to_arabic:n { \g__chronos_int } }
\cs_new_eq:NN \chronos@env@begin \__chronos_at_begin:
\cs_new_eq:NN \chronos@setdateformat \__chronos_set_dateformat:n
\cs_new_eq:NN \chronos@setyearformat \__chronos_set_yearformat:n
\cs_new_eq:NN \chronos@setminoryearformat \__chronos_set_minoryearformat:n 
%    \end{macrocode}
% for pgf/tikz convenience
% \changes{v0.9.3}{2025-07-15}{Remove unused internal macro \cs{chronos@showdate}, variants of internal macros \cs{chronos@showdate@cs}, \cs{chronos@showyear}.}
%    \begin{macrocode}
\protected\def\chronos@showdate@cs[#1]#2
{
  \group_begin:
    \__chronos_set_dateformat:v { #1 }
    \pgfcalendarjuliantoweekday{\csname thechronos@#2date\endcsname}{\c@chronos@weekday}%
    \__chronos_show_date:n { #2 }
  \group_end:
}
\protected\def\chronos@showyear[#1]#2
{
  \group_begin:
    \tl_set:No \l__chronos_tmpc_tl { #1 }
    \tl_if_empty:NF \l__chronos_tmpc_tl
    {
      \__chronos_set_yearformat:V \l__chronos_tmpc_tl
    }
    \__chronos_show_year:n { #2 }
  \group_end:
}
%    \end{macrocode}
% \changes{v0.9.3}{2025-07-18}{Use \cs{def}\ internal macros \cs{chronos@troilliwiau@isod}, \cs{chronos@troilliwiau@uchod}, \cs{chronos@lliwiau@isod}, \cs{chronos@lliwiau@uchod}\ and change usage in code accordingly.}
%^^A ateb: https://tex.stackexchange.com/a/748026/
%    \begin{macrocode}
\def\chronos@minoryearformat{\l__chronos_minoryearformat_tl}
\protected\def\chronos@troilliwiau@uchod#1{
  \__chronos_troilliwiau:nn { #1 } { uchod }
  \expandafter\def\csname chronos@#1@lliw\endcsname{\l__chronos_lliw_tl}
}
\protected\def\chronos@troilliwiau@isod#1{
  \__chronos_troilliwiau:nn { #1 } { isod }
  \expandafter\def\csname chronos@#1@lliw\endcsname{\l__chronos_lliw_tl}
}
\protected\def \chronos@lliwiau@uchod@tag#1#2{
  \tl_set:Nn \l__chronos_tmpc_tl { _#1 } 
  \clist_gset:cn { g__chronos_lliwiau \l__chronos_tmpc_tl _uchod_clist } { #2 }
}
\protected\def \chronos@lliwiau@uchod#1{
  \tl_clear:N \l__chronos_tmpc_tl
  \clist_gset:cn { g__chronos_lliwiau \l__chronos_tmpc_tl _uchod_clist } { #1 }
}
\protected\def \chronos@lliwiau@isod@tag#1#2{
  \tl_set:Nn \l__chronos_tmpc_tl { _#1 } 
  \clist_gset:cn { g__chronos_lliwiau \l__chronos_tmpc_tl _isod_clist } { #2 }
}
\protected\def \chronos@lliwiau@isod#1{
  \tl_clear:N \l__chronos_tmpc_tl
  \clist_gset:cn { g__chronos_lliwiau \l__chronos_tmpc_tl _isod_clist } { #1 }
}
\cs_new_eq:NN \chronos@lliwiau@clear \__chronos_lliwiau_clirio:
\cs_new_eq:NN \chronos@lliwiau@cadw@rhag \__chronos_lliwiau_cadw_rhag:
%    \end{macrocode}
%^^A enwau
%    \begin{macrocode}
\newcommand* \chronos@creu@tikzname [2] {% m m
  \__chronos_creu_tikzname:n { #2 }
  \expandafter\let\csname chronos@#1@tikzname\endcsname \l__chronos_tikzname_tl
}
\cs_new_eq:NN \chronos@enw@priflythrennu \__chronos_enw_priflythrennu:V 
\cs_new_eq:NN \chronos@testunteitl@priflythrennu \__chronos_enw_priflythrennu:n 
\cs_new_eq:NN \chronos@cadw@nodweddion@rhag \__chronos_cadw_nodweddion_rhag:nn 
\cs_new_eq:NN \chronos@cadw@nodweddion  \__chronos_cadw_nodweddion:nnn
\cs_new_eq:NN \chronos@ychwanegu@nodweddion \__chronos_ychwanegu_nodweddion:nnn 
%    \end{macrocode}
% \changes{v0.9.3}{2025-07-15}{Remove unused variants of internal macro \cs{chronos@ychwanegu@nodweddion@rhestr}, unused internal macro \cs{chronos@cadw@nodweddion@rhestr}.}
%    \begin{macrocode}
\cs_new_eq:NN \chronos@ychwanegu@nodweddion@rhestr \__chronos_ychwanegu_nodweddion_rhestr_pre:nnn
%    \end{macrocode}
%    \begin{macrocode}
\cs_new_eq:NN \chronos@ychwanegu@nodweddion@rhag \__chronos_ychwanegu_nodweddion_rhag:nn 
\cs_new_eq:NN \chronos@gosod@nodweddion \__chronos_gosod_nodweddion:n 
\cs_new_eq:NN \chronos@gosod@nodweddion@var \__chronos_gosod_nodweddion:V 
\cs_new_eq:NN \chronos@ailosod@nodweddion \__chronos_ailosod_nodweddion: 
\cs_new_eq:NN \chronos@dangos@nodweddion \__chronos_dangos_nodweddion:n 
\cs_new_eq:NN \chronos@dangos@nodweddion@rhag \__chronos_dangos_nodweddion_rhag: 
\newcommand* \chronos@ychwanegu@gosod [1] 
{
  \legacy_if:nF { chronos@preset } { 
    \clist_map_inline:nn { #1 }
    {
      \seq_put_right:Nn \l__chronos_gosod_seq {##1}
    }
  } 
}%
\newcommand* \chronos@dangos@gosod 
{ 
  \seq_show:N \l__chronos_gosod_seq
}
\newcommand* \chronos@if@gosodTF [3] 
{ 
  \seq_if_in:NnTF \l__chronos_gosod_seq { #1 } { #2 } { #3 } 
}
%    \end{macrocode}
% \begin{macro}{\chronos@if@gosodF}
%   Conditionalise on property installation.
%   \changes{v0.9.3}{2025-07-18}{Switch to \cs{def}.}
%    \begin{macrocode}
\def\chronos@if@gosodF#1#2 
{
  \chronos@presettrue 
  \seq_if_in:NnF \l__chronos_gosod_seq { #1 } { #2 } 
  \chronos@presetfalse
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\chronosdangoslliwiau}
%   Becomes \cs{chronosshowcolours}.
% \changes{v0.9.3}{2025-07-15}{Eliminate unused internal macros \cs{chronos@dangos@lliwiau}\ and \cs{chronos@dangos@lliwiau@rhag}.}
%    \begin{macrocode}
\NewDocumentCommand \chronosdangoslliwiau { 
  s O { byw, digwyddiad, parhad, theori } D () { isod, uchod }  
} {
  \clist_set:Nn \l__chronos_tmpb_clist { #2 }
  \clist_set:Nn \l__chronos_tmpc_clist { #3 }
  \clist_map_inline:Nn \l__chronos_tmpb_clist
  {
    \clist_map_inline:Nn \l__chronos_tmpc_clist
    {
      \clist_show:c { g__chronos_lliwiau_##1_####1_clist }
    }
  }
  \IfBooleanT { #1 }
  {
    \clist_map_inline:Nn \l__chronos_tmpc_clist
    {
      \clist_show:c {g__chronos_lliwiau_##1_clist}
    }
  }
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\chronosdangoslliwiaurhag}
%   For showing default colours.
%    \begin{macrocode}
\NewDocumentCommand \chronosdangoslliwiaurhag 
{ 
  s O { byw, digwyddiad, parhad, theori } D () { isod, uchod }  
} {
  \clist_set:Nn \l__chronos_tmpb_clist { #2 }
  \clist_set:Nn \l__chronos_tmpc_clist { #3 }
  \clist_map_inline:Nn \l__chronos_tmpb_clist
  {
    \clist_map_inline:Nn \l__chronos_tmpc_clist
    {
      \clist_show:c { g__chronos_lliwiau_##1_####1_rhag_clist }
    }
  }
  \IfBooleanT { #1 }
  {
    \clist_map_inline:Nn \l__chronos_tmpc_clist
    {
      \clist_show:c {g__chronos_lliwiau_##1_rhag_clist}
    }
  }
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\chronos@dangos@fformatiaudyddiadau,\chronosdangosfformatiaudyddiadau}
%   Macros for showing date formats.
%    \begin{macrocode}
\newcommand* \chronos@dangos@fformatiaudyddiadau{%
  \clist_map_inline:nn 
  { \l__chronos_dateformat_tl, \l__chronos_yearformat_tl, \l__chronos_minoryearformat_tl}
  { \tl_show:N ##1 }
}
\cs_new_eq:NN \chronosdangosfformatiaudyddiadau \chronos@dangos@fformatiaudyddiadau
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\chronos@to@clist,\chronos@to@clist@append,\chronos@global@to@clist,\chronos@globall@to@clist@append,\chronos@global@to@clist@star@append,\chronos@global@clear@to@clist,\chronos@from@clist,\chronos@global@from@clist,\chronos@global@eq@clist,\chronos@dangos@clist}
%   Wrappers for \lpack{l3clist} functions.
%   \changes{v0.9.3}{2025-07-15}{Eliminate \lpack{xparse} macros for internal commands. (According to \TeX{} SE chat this is The Right Thing To Do).}
%    \begin{macrocode}
\protected\def\chronos@to@clist#1#2{%^^A m m }
  \clist_set:co { l__chronos_#1_clist } { #2 }
}
\protected\def\chronos@to@clist@append#1#2{%^^A t {+} m m }
  \clist_put_right:co { l__chronos_#1_clist } { #2 }
}
\protected\def\chronos@global@to@clist#1#2{%^^A m m 
  \clist_gset:co { g__chronos_#1_clist } { #2 }
}
\protected\def\chronos@global@to@clist@append#1#2{%^^A t {+} m m 
  \clist_gput_right:co { g__chronos_#1_clist } { #2 }
}
\protected\def\chronos@global@to@clist@star@append#1#2{%^^A s t {+} m m 
  \clist_gput_right:ce { g__chronos_#1_clist } { #2 }
}
\def\chronos@global@clear@to@clist#1{% m
    \clist_gclear:c { g__chronos_#1_clist }
}
\def\chronos@from@clist#1#2{% m m
  \clist_remove_duplicates:c { l__chronos_#1_clist }
  \clist_if_empty:cTF { l__chronos_#1_clist }
  {
    \expandafter\let#2\@empty
  }{
    \expandafter\let\expandafter#2\csname l__chronos_#1_clist\endcsname
  }
}
\def\chronos@global@from@clist#1{
  \clist_use:cn { g__chronos_#1_clist } { , }
}
\def\chronos@global@eq@clist#1#2{
  \clist_gset_eq:cc { g__chronos_#1_clist } { g__chronos_#2_clist }
}
\def\chronos@dangos@clist#1{ \clist_show:c { #1_clist } }
%    \end{macrocode}
% \end{macro}
%   Internal 2e wrappers for internal functions.
%    \begin{macrocode}
\cs_new_eq:NN \chronos@at@end  \__chronos_at_end:  
\cs_new_eq:NN \chronos@set@date@aux \__chronos_set_date_aux:n
\cs_new_eq:NN \chronos@set@date \__chronos_set_date:nnnn  % blwyddyn; mis; dydd; tag for macro
%    \end{macrocode}
%    \begin{macrocode}
\cs_new_eq:NN \chronos@legacy@if \legacy_if:oTF 
%    \end{macrocode}
%    \begin{macrocode}
\def\chronos@legacy@if@set#1#2{\cs:w #1#2\cs_end:}
\def\chronos@datetojulian@extractyear #1-#2-#3 {#1}
\protected\def\chronos@dangoslliw#1{
  \extractcolorspec{#1}{\chronos@temp@lliw}%
}
%    \end{macrocode}
% \begin{macro}{\chronosshowcolour}
%   Public interface with options.
%   \changes{v0.9.3}{2025-07-16}{Use \lpack{xparse} interface directly for \cs{chronosshowcolour}.}
%    \begin{macrocode}
\NewDocumentCommand \chronosshowcolour
  { s O {\chronos@temp@lliw} m }
  {\extractcolorspec{#3}{#2}\IfBooleanT{#1}{\show#2}}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\cs_new_eq:NN \chronos@keymaker \__chronos_kexkeymaker:nnn
%    \end{macrocode}
%^^A END macros y paced >>>
%^^A BEGIN yn lle etoolbox <<<
% \begin{macro}{\IfFreeTF,\IfFreeT,\IfFreeF}
%   2e document-level wrappers for \lpack{expl3} alternatives to \lpack{etoolbox} macros.
% 
% yn lle \cs{ifundef} o etoolbox - instead of \cs{ifundef} from \lpack{etoolbox}
%    \begin{macrocode}
\cs_if_exist:NTF \IfFreeTF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfFreeTF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfFreeTF \cs_if_free:NTF }
\cs_if_exist:NTF \IfFreeT {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfFreeT.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfFreeT \cs_if_free:NT }
\cs_if_exist:NTF \IfFreeF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfFreeF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfFreeF \cs_if_free:NF }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\IfExistTF,\IfExistT,\IfExistF}
% yn lle \cs{ifdef} o etoolbox - in place of \cs{ifdef} from \lpack{etoolbox}
%    \begin{macrocode}
\cs_if_exist:NTF \IfExistTF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfExistTF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfExistTF \cs_if_exist:NTF }
\cs_if_exist:NTF \IfExistT {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfExistT.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfExistT \cs_if_exist:NT }
\cs_if_exist:NTF \IfExistF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfExistF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfExistF \cs_if_exist:NF }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\IfCSFreeTF,\IfCSFreeT,\IfCSFreeF}
% yn lle \cs{ifcsundef} o etoolbox - instead of \cs{ifcsundef}
%    \begin{macrocode}
\cs_if_exist:NTF \IfCSFreeTF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSFreeTF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfCSFreeTF \cs_if_free:cTF }
\cs_if_exist:NTF \IfCSFreeT {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSFreeT.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfCSFreeT \cs_if_free:cT }
\cs_if_exist:NTF \IfCSFreeF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSFreeF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfCSFreeF \cs_if_free:cF }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\IfCSExistTF,\IfCSExistT,\IfCSExistF}
% yn lle \cs{ifcsdef} o etoolbox - instead of \cs{ifcsdef}
%    \begin{macrocode}
\cs_if_exist:NTF \IfCSExistTF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSExistTF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfCSExistTF \cs_if_exist:cTF }
\cs_if_exist:NTF \IfCSExistT {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSExistT.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfCSExistT \cs_if_exist:cT }
\cs_if_exist:NTF \IfCSExistF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSExistF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfCSExistF \cs_if_exist:cF }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Undefine}
% yn lle \cs{undef} o etoolbox - instead of \cs{undef}
%    \begin{macrocode}
\cs_if_exist:NTF \Undefine {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\Undefine.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \Undefine \cs_undefine:N }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\CSletCS}
% yn lle \cs{csletcs} o etoolbox - instead of \cs{csletcs}
%    \begin{macrocode}
\cs_if_exist:NTF \CSletCS {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\CSletCS.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \CSletCS \cs_set_eq:cc }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\CSlet}
% yn lle \cs{cslet} o etoolbox - instead of \cs{cslet}
%    \begin{macrocode}
\cs_if_exist:NTF \CSlet {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\CSlet.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \CSlet \cs_set_eq:cN }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\IfBooleanExprTF,\IfBooleanExprT,\IfBooleanExprF}
% yn lle \cs{ifboolexpr} o etoolbox (ish) - instead of \cs{ifboolexpr}
%    \begin{macrocode}
\cs_if_exist:NTF \IfBooleanExprTF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfBooleanExprTF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfBooleanExprTF \bool_if:nTF }
\cs_if_exist:NTF \IfBooleanExprT {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfBooleanExprT.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfBooleanExprT \bool_if:nT }
\cs_if_exist:NTF \IfBooleanExprF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfBooleanExprF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfBooleanExprF \bool_if:nF }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\LegacyBoolean}
% yn lle \texttt{bool} o etoolbox (ish) - instead of \texttt{bool} from \lpack{etoolbox}
%    \begin{macrocode}
\cs_if_exist:NTF \LegacyBoolean {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\LegacyBoolean.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \LegacyBoolean \legacy_if_p:n }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\CSFreeBoolean}
% yn lle \texttt{test} o etoolbox (ish) - instead of \texttt{test} from \lpack{etoolbox}
%    \begin{macrocode}
\cs_if_exist:NTF \CSFreeBoolean {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\CSFreeBoolean.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \CSFreeBoolean \cs_if_free_p:N }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\IntCompareBoolean,\IfIntCompareTF,\IfIntCompareT,\IfIntCompareF}
% yn lle \cs{ifnumcomp} o etoolbox (ish) - instead of \cs{ifnumcomp} from \lpack{etoolbox}
%    \begin{macrocode}
\cs_if_exist:NTF \IntCompareBoolean {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IntCompareBoolean.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IntCompareBoolean \int_compare_p:nNn }
\cs_if_exist:NTF \IfIntCompareTF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfIntCompareTF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfIntCompareTF \int_compare:nTF }
\cs_if_exist:NTF \IfIntCompareT {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfIntCompareT.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfIntCompareT \int_compare:nT }
\cs_if_exist:NTF \IfIntCompareF {\PackageWarning{chronos}{
  Refusing ~ to ~ overwrite ~ existing ~ \protect\IfIntCompareF.
   ~ This ~ may ~ not ~ work} 
} { \cs_new_eq:NN  \IfIntCompareF \int_compare:nF }
%    \end{macrocode}
% \end{macro}
%^^A END yn lle etoolbox >>>
%^^A BEGIN macros y paced cyhoeddus \textbar{} public package macros <<<
% \begin{macro}{\chronosnewcolourscheme,\chronosnewcolorscheme}
%    \begin{macrocode}
\NewDocumentCommand \chronosnewcolourscheme { O {rhagosedig} m m }
{
  \group_begin:
    \cs_new_nopar:cn { __chronos_lliwiau_#2 : }
    {
      \cs:w chronos@lliwiau@#1 \cs_end:
      \keys_set_groups:nnn { chronos / lliwiau } { core } { #3 }
      \__chronos_color_set_from_existing:nn { chronos@lliw@cefndir@llinell }
        { chronos@prifliw }
      \__chronos_color_set_from_existing:nn { chronos@lliw@llinell }
        { chronos@prifliw@cefndir }
      \keys_set_groups:nnn { chronos / lliwiau } { core ~ derivative } { #3 }
      \__chronos_color_set_from_existing:nn { chronos@borderinner }
        { chronos@lliw@cefndir@llinell }
      \__chronos_color_set_from_existing:nn { chronos@borderouter }
        { chronos@prifliw@cefndir }
      \__chronos_color_set_from_existing:nn { chronos@bordermiddle }
        { chronos@borderinner!50!chronos@borderouter }
      \keys_set_groups:nnn { chronos / lliwiau } { core ~ border } { #3 }
      \__chronos_color_set_from_existing:nn { chronos@byw@lliw@rhagosodedig }
        { chronos@prifliw } 
      \__chronos_color_set_from_existing:nn { chronos@digwyddiad@lliw@rhagosodedig }
        { chronos@prifliw } 
      \__chronos_color_set_from_existing:nn { chronos@parhad@lliw@rhagosodedig }
        { chronos@prifliw } 
      \__chronos_color_set_from_existing:nn { chronos@theori@lliw@rhagosodedig }
        { chronos@prifliw } 
      \__chronos_color_set_from_existing:nn { chronos@gwybodaeth@lliw@rhagosodedig }
        { chronos@prifliw } 
%    \end{macrocode}
%^^A    % oedd \keys_set_filter:nnn
%    \begin{macrocode}
      \__chronos_keys_set_exclude_groups:nnn { chronos / lliwiau }
        { core, core ~ derivative, core ~ border } { #3 }
      \@ifpackageloaded{memoize}
      {
        \mmzset { csname ~ meaning ~ to ~ context={ __chronos_lliwiau_#2 : } }
      }{}
    }
    \cs_new_eq:cc  { chronos@lliwiau@#2 } { __chronos_lliwiau_#2 : }
  \group_end:
}
\cs_new_eq:NN \chronosnewcolorscheme \chronosnewcolourscheme
%    \end{macrocode}
% \end{macro}
%^^A END macros y paced cyhoeddus | public package macros >>>
%    \begin{macrocode}
\ExplSyntaxOff
%    \end{macrocode}
%^^A END expl3 >>>
%^^A BEGIN hydoedd 2e <<<
%^^A \newlength{\chronos@amser@dechraulength}
%^^A \newlength{\chronos@amser@diweddlength}
%    \begin{macrocode}
\newlength{\chronos@diwedd@diwedd}
\newlength{\chronos@dechrau@dechrau}
\newlength{\chronos@byw@border}
\newlength{\chronos@parhad@border}
\newlength{\chronos@digwyddiad@border}
\newlength{\chronos@byw@border@inv}
\newlength{\chronos@parhad@border@inv}
\newlength{\chronos@digwyddiad@border@inv}
%    \end{macrocode}
%^^A \newlength{\chronos@width}
%    \begin{macrocode}
\newlength{\chronos@templgtha}
\newlength{\chronos@templgthb}
\newlength{\chronos@templgthc}
%    \end{macrocode}
%^^A END hydoedd 2e >>>
%^^A BEGIN dimens <<<
%    \begin{macrocode}
\newdimen\chronos@borderheight
\newdimen\chronos@height
\newdimen\chronos@width
\chronos@width=\textwidth
\newdimen\chronos@eramargin
\newdimen\chronos@timelinemargin
\newdimen\chronos@inner@halfheight
\newdimen\chronos@outer@halfheight
%    \end{macrocode}
%^^A \newdimen\chronos@timelineunitlength
%    \begin{macrocode}
\newdimen\chronos@pgflinewidth@saved
\newdimen\chronos@border@de
\newdimen\chronos@border@chwith
\newdimen\chronos@border@penawdau
\newdimen\chronos@border@pen
\newdimen\chronos@border@gwaelod
\newdimen\chronos@border@allanol
\newdimen\chronos@subheading@drop@uchod
\newdimen\chronos@subheading@drop@isod
\newdimen\chronos@heading@drop
\newdimen\chronos@llinell@yshift
\newdimen\chronos@llinell@yshift@base
\newdimen\chronos@llinell@add@yshift
\newdimen\chronos@testun@yshift
\newdimen\chronos@baselineskip
\newdimen\chronos@cylchtheori@mawr
\newdimen\chronos@cylchtheori@bach
\newdimen\chronos@tmpdimena
\newdimen\chronos@tmpdimenb
\chronos@testun@yshift=5pt
\chronos@height=\pi pt
\chronos@borderheight=\pi pt
\chronos@llinell@yshift=\pi pt
\chronos@llinell@yshift@base=\pi pt
\chronos@llinell@add@yshift=0pt
\chronos@timelinemargin=15pt
\chronos@eramargin=15pt
\chronos@border@allanol=5pt
\chronos@border@penawdau=\pi pt
\chronos@border@pen=0pt
\chronos@border@de=0pt
\chronos@border@gwaelod=0pt
\chronos@border@chwith=0pt
\chronos@cylchtheori@mawr=15pt
\chronos@cylchtheori@bach=9pt
%    \end{macrocode}
%^^A END dimens >>>
%^^A BEGIN rhifyddion 2e <<<
%    \begin{macrocode}
\newcounter{chronos@date}
\newcounter{chronos@startdate}
\newcounter{chronos@enddate}
\newcounter{chronos@startyear}
\newcounter{chronos@startmarkyear}
\newcounter{chronos@endyear}
\newcounter{chronos@yeardate}
\newcounter{chronos@thingdate}
\newcounter{chronos@otherthingdate}
\newcounter{chronos@genidate}
\newcounter{chronos@marwdate}
\newcounter{chronos@digdate}
\newcounter{chronos@weekday}
\newcounter{chronos@theori@countanchors}
\newcounter{chronos@tempcnta}
\newcounter{chronos@tempcntb}
\newcounter{chronos@tempcntc}
\newcounter{chronos@tempadate}
\newcounter{chronos@tempbdate}
\newcounter{chronos@bagpuss}
%    \end{macrocode}
%^^A END rhifyddion 2e >>>
%^^A BEGIN amodol <<<
% Internal pre/2e booleans.
%    \begin{macrocode}
\newif\ifchronos@marks
\chronos@markstrue
\newif\ifchronos@marks@minor
\chronos@marks@minortrue
\newif\ifchronos@marks@bare
\chronos@marks@barefalse
\newif\ifchronos@timeline@showyears
\chronos@timeline@showyearstrue
\newif\ifchronos@eventyearsonline
\chronos@eventyearsonlinefalse
\newif\ifchronos@yearzero
\chronos@yearzerofalse
\newif\ifchronos@markateraswitch
\chronos@markateraswitchfalse
\newif\ifchronos@onlytext
\chronos@onlytextfalse
\newif\ifchronos@markeras
\chronos@markerasfalse
\newif\ifchronos@yearsonline
\chronos@yearsonlinefalse
\newif\ifchronos@eventdatessplit
\chronos@eventdatessplitfalse
\newif\ifchronos@minoryears
\chronos@minoryearstrue
\newif\ifchronos@byw@isod
\chronos@byw@isodfalse
\newif\ifchronos@byw@isod@rhag
\chronos@byw@isod@rhagfalse
\newif\ifchronos@every@byw@isod
\chronos@every@byw@isodfalse
\newif\ifchronos@every@byw@uchod
\chronos@every@byw@uchodfalse
\newif\ifchronos@byw@cysylltiad
\chronos@byw@cysylltiadtrue
\newif\ifchronos@byw@cysylltiadtheori
\chronos@byw@cysylltiadtheorifalse
\newif\ifchronos@digwyddiad@isod
\chronos@digwyddiad@isodfalse
\newif\ifchronos@digwyddiad@isod@rhag
\chronos@digwyddiad@isod@rhagfalse
\newif\ifchronos@every@digwyddiad@isod
\chronos@every@digwyddiad@isodfalse
\newif\ifchronos@every@digwyddiad@uchod
\chronos@every@digwyddiad@uchodfalse
\newif\ifchronos@digwyddiad@cysylltiad
\chronos@digwyddiad@cysylltiadtrue
\newif\ifchronos@digwyddiad@cysylltiadtheori
\chronos@digwyddiad@cysylltiadtheorifalse
\newif\ifchronos@parhad@isod
\chronos@parhad@isodfalse
\newif\ifchronos@parhad@isod@rhag
\chronos@parhad@isod@rhagfalse
\newif\ifchronos@every@parhad@isod
\chronos@every@parhad@isodfalse
\newif\ifchronos@every@parhad@uchod
\chronos@every@parhad@uchodfalse
\newif\ifchronos@parhad@cysylltiad
\chronos@parhad@cysylltiadtrue
\newif\ifchronos@parhad@cysylltiadtheori
\chronos@parhad@cysylltiadtheorifalse
\newif\ifchronos@theori@isod
\chronos@theori@isodfalse
\newif\ifchronos@theori@cysylltiadtheori
\chronos@theori@cysylltiadtheorifalse
\newif\ifchronos@cam@mod
\newif\ifchronos@middleanchorborder
\newif\ifchronos@troilliwiau
\chronos@troilliwiautrue
\newif\ifchronos@dangoscyfnodau
\chronos@dangoscyfnodautrue
\newif\ifchronos@felymae
\chronos@felymaefalse
\newif\ifchronos@temp
\chronos@temptrue
\newif\ifchronos@headings
\chronos@headingsfalse
\newif\ifchronos@frame
\chronos@framefalse
\newif\ifchronos@framedefnyddiobb
\chronos@framedefnyddiobbtrue
\newif\ifchronos@placeholders
\chronos@placeholdersfalse
\newif\ifchronos@showcoords
\chronos@showcoordsfalse
\newif\ifchronos@showbb
\chronos@showbbfalse
\newif\ifchronos@shownodes
\chronos@shownodesfalse
\newif\ifchronos@bufarw
\chronos@bufarwtrue
\newif\ifchronos@gorffenedig
\chronos@gorffenedigtrue
\newif\ifchronos@preset
\chronos@presettrue
\newif\ifchronos@blynyddoedduchod
\chronos@blynyddoedduchodfalse
\newif\ifchronos@blynyddoeddisod
\chronos@blynyddoeddisodfalse
\newif\ifchronos@dimondblynyddoedd
\chronos@dimondblynyddoeddfalse
\newif\ifchronos@tag@cysylltu
\chronos@tag@cysylltutrue
\newif\ifchronos@copyleft
\chronos@copyleftfalse
\newif\ifchronos@phantom
\chronos@phantomfalse
\newif\ifchronostimelinearrow
\chronostimelinearrowfalse
%    \end{macrocode}
% \changes{v0.9.3}{2025-07-18}{Add \cs{ifchronos@hollti@testun@tag}\ in lieu of starred form of text tag creator (so I can replace \cs{NewDocumentCommand}\ by more proper \cs{def}s.}
% Whether text tag is to be split (and this is the first bit).
% We can't use \cs{ifchronos@eventdatessplit} when splitting the tag as that is true during the entire element creation.
%    \begin{macrocode}
\newif\ifchronos@hollti@testun@tag
\chronos@hollti@testun@tagfalse
%    \end{macrocode}
%^^A END amodol >>>
%^^A BEGIN pre-defined macros <<<
%    \begin{macrocode}
\let\chronos@coords\@empty
\def\chronos@ce{CE}
\def\chronos@bce{BCE}
\def\chronos@yearce{\textsc{ce}}
\def\chronos@yearbce{\textsc{bce}}
\def\chronos@yshift{0pt}
\def\chronos@ffont@camaumawr{\sffamily\bfseries}
\def\chronos@ffont@camaubach{\sffamily}
\def\chronos@ffont@cyfnodau{\sffamily\bfseries}
%    \end{macrocode}
%^^A \def\chronos@width{\textwidth}
%    \begin{macrocode}
\def\chronos@uchod{0}
\def\chronos@isod{0}
%    \end{macrocode}
%^^A END pre-defined macros >>>
% addaswyd o ateb Martin Scharrer: \url{https://tex.stackexchange.com/a/56405/}
%
% i ddefnyddio \cs{setto}<dim> macros y tu mewn i lluniau tikz
%
% to use \cs{setto}<dim> macros inside tikz pictures
%
% LPPL permission: \url{https://tex.stackexchange.com/users/2975/martin-scharrer}
%    \begin{macrocode}
\let\orig@settodim\@settodim
\let\chronos@settodim\@settodim
\patchcmd{\chronos@settodim}{\setbox\@tempboxa\hbox}{\chronos@tikz@setbox}{}{}
\def\chronos@tikz@setbox#1{%
  \setbox\@tempboxa\hbox{\pgfinterruptpicture #1\endpgfinterruptpicture}%
}
\appto\tikz@installcommands{%
  \let\@settodim\chronos@settodim
}
\appto\tikz@uninstallcommands{%
  \let\@settodim\orig@settodim
}
%    \end{macrocode}
%^^A BEGIN lliwiau <<<
% \begin{colour}{%^^A
%   Blue,%^^A
%   Blue3,%^^A
%   DarkGoldenrod1,%^^A
%   DarkGray,%^^A
%   DarkOrange1,%^^A
%   DarkOrchid3,%^^A
%   DarkSlateGrey,%^^A
%   DeepPink2,%^^A
%   DeepSkyBlue2,%^^A
%   DodgerBlue1,%^^A
%   DodgerBlue2,%^^A
%   DodgerBlue3,%^^A
%   DodgerBlue4,%^^A
%   Firebrick1,%^^A
%   ForestGreen,%^^A
%   Green,%^^A
%   Green3,%^^A
%   Ivory2,%^^A
%   Ivory3,%^^A
%   Ivory4,%^^A
%   Lavender,%^^A
%   LavenderBlush1,%^^A
%   LavenderBlush2,%^^A
%   LavenderBlush3,%^^A
%   LavenderBlush4,%^^A
%   MediumPurple,%^^A
%   MidnightBlue,%^^A
%   MistyRose2,%^^A
%   MistyRose3,%^^A
%   MistyRose4,%^^A
%   Orange,%^^A
%   OrangeRed1,%^^A
%   Purple0,%^^A
%   Red,%^^A
%   SeaGreen3,%^^A
%   Seashell2,%^^A
%   Seashell3,%^^A
%   Seashell4,%^^A
%   Silver,%^^A
%   SpringGreen4,%^^A
%   Thistle2,%^^A
%   Thistle3,%^^A
%   Thistle4,%^^A
%   Violet,%^^A
%   Yellow,%^^A
%   darkgray%^^A
% }
% Copied from \path{xcolor.sty}, \path{x11names.def}, \path{svgnames.def}
%    \begin{macrocode}
\definecolorset{rgb}{chronos}{}{% xcolor.sty, x11names.def, svgnames.def
  Blue,0,0,1;%
  Blue3,0,0,.804;%
  DarkGoldenrod1,1,.725,.06;%
  DarkGray,.664,.664,.664;%
  DarkOrange1,1,.498,0;%
  DarkOrchid3,.604,.196,.804;%
  DarkSlateGrey,.185,.31,.31;%
  DeepPink2,.932,.07,.536;%
  DeepSkyBlue2,0,.698,.932;%
  DodgerBlue1,.116,.565,1;%
  DodgerBlue2,.11,.525,.932;%
  DodgerBlue3,.094,.455,.804;%
  DodgerBlue4,.064,.305,.545;%
  Firebrick1,1,.19,.19;%
  ForestGreen,.132,.545,.132;%
  Green,0,.5,0;%
  Green3,0,.804,0;%
  Ivory2,.932,.932,.88;%
  Ivory3,.804,.804,.756;%
  Ivory4,.545,.545,.512;%
  Lavender,.9,.9,.98;%
  LavenderBlush1,1,.94,.96;%
  LavenderBlush2,.932,.88,.898;%
  LavenderBlush3,.804,.756,.772;%
  LavenderBlush4,.545,.512,.525;%
  MediumPurple,.576,.44,.86;%
  MidnightBlue,.098,.098,.44;%
  MistyRose2,.932,.835,.824;%
  MistyRose3,.804,.716,.71;%
  MistyRose4,.545,.49,.484;%
  Orange,1,.648,0;%
  OrangeRed1,1,.27,0;%
  Purple0,.628,.125,.94;%
  Red,1,0,0;%
  SeaGreen3,.264,.804,.5;%
  Seashell2,.932,.898,.87;%
  Seashell3,.804,.772,.75;%
  Seashell4,.545,.525,.51;%
  Silver,.752,.752,.752;%
  SpringGreen4,0,.545,.27;%
  Thistle2,.932,.824,.932;%
  Thistle3,.804,.71,.804;%
  Thistle4,.545,.484,.545;%
  Violet,.932,.51,.932;%
  Yellow,1,1,0;%
  darkgray,.25,.25,.25%
}
%    \end{macrocode}
% \end{colour}
% \begin{colour}{chronosCerulean,chronosPeriwinkle,chronosWildStrawberry}
% From \path{dvipsnames.def}
%    \begin{macrocode}
%^^A dvipsnames.def
\definecolor{chronosCerulean}      {cmyk}{0.94,0.11,0,0}
\definecolor{chronosPeriwinkle}    {cmyk}{0.57,0.55,0,0}
\definecolor{chronosWildStrawberry}{cmyk}{0,0.96,0.39,0}
%    \end{macrocode}
% \end{colour}
% cronoleg colours
%    \begin{macrocode}
\newcommand*\chronos@lliwiau@cronoleg{%
  \chronos@lliwiau@isod{%
    chronosRed,%
    chronosOrange,%
    chronosYellow,%
    chronosGreen,%
    chronosBlue,%
    chronosMidnightBlue,%
    chronosViolet%
  }%
  \chronos@lliwiau@uchod{%
    chronosRed,%
    chronosOrange,%
    chronosYellow,%
    chronosGreen,%
    chronosBlue,%
    chronosMidnightBlue,%
    chronosViolet%
  }%
  \chronos@lliwiau@isod@tag{byw}{%
    chronosDodgerBlue3,%
    chronosGreen3,%
    chronosBlue3,%
    chronosSpringGreen4,%
    chronosDeepSkyBlue2,%
    chronosForestGreen,%
    chronosPeriwinkle,%
    chronosSeaGreen3%
  }%
  \chronos@lliwiau@uchod@tag{byw}{%
    chronosDeepPink2,%
    chronosDarkOrange1,%
    chronosFirebrick1,%
    chronosPurple0,%
    chronosWildStrawberry,%
    chronosOrangeRed1,%
    chronosDarkGoldenrod1,%
    chronosDarkOrchid3%
  }%
  \chronos@lliwiau@isod@tag{digwyddiad}{%
    chronosSeashell4,%
    chronosSeashell4!.5!chronosSeashell3,%
    chronosSeashell3,%
    chronosSeashell3!.5!chronosSeashell2,%
    chronosSeashell2%
  }%
  \chronos@lliwiau@uchod@tag{digwyddiad}{%
    chronosThistle4,%
    chronosThistle4!.5!chronosThistle3,%
    chronosThistle3,%
    chronosThistle3!.5!chronosThistle2,%
    chronosThistle2%
  }%
  \chronos@lliwiau@isod@tag{parhad}{%
    chronosIvory4,%
    chronosIvory4!.5!chronosIvory3,%
    chronosIvory3,%
    chronosIvory3!.5!chronosIvory2,%
    chronosIvory2%
  }%
  \chronos@lliwiau@uchod@tag{parhad}{%
    chronosMistyRose4,%
    chronosMistyRose4!.5!chronosMistyRose3,%
    chronosMistyRose3,%
    chronosMistyRose3!.5!chronosMistyRose2,%
    chronosMistyRose2%
  }%
%    \end{macrocode}
%^^A  BEGIN lliwiau prif
%    \begin{macrocode}
  \colorlet{chronos@prifliw}{black}% prifliw
  \colorlet{chronos@prifliw@cefndir}{white}% prifliw cefndir
  \colorlet{chronos@lliw@cefndir@llinell}{black}%^^A oedd lliw cefndir amser?
  \colorlet{chronos@lliw@llinell}{white}%^^A oedd lliw amser
%    \end{macrocode}
%^^A   \colorlet{chronos@lliw@cefndir}{white}% lliw cefndir
%^^A  angen y ffurf gywir
%^^A  yn wreiddiol, 'gwybodaeth' oedd theori ac 'ee' oedd gwybodaeth
%    \begin{macrocode}
  \colorlet{chronos@lliw@theori}{white}%
  \colorlet{chronos@lliw@cefndir@theori}{black}%
  \colorlet{chronos@lliw@cefndir@gwybodaeth}{chronos@prifliw!25!chronos@prifliw@cefndir}%^^A lliw cefndir ee = prifliw!25!prifliw cefndir
  \colorlet{chronos@lliw@gwybodaeth}{chronos@prifliw}% lliw ee = prifliw
%    \end{macrocode}
%^^A  \colorlet{chronos@lliw@symbolau@cefndir}{chronos@lliw@cefndir}% lliw symbolau cefndir = lliw cefndir
%^^A  \colorlet{chronos@lliw@symbolau}{chronos@prifliw}% lliw symbolau = prifliw
%^^A   \colorlet{lliw dig}{prifliw!75!prifliw cefndir}
%^^A  END lliwiau prif
%    \begin{macrocode}
}
%    \end{macrocode}
% default colours
%    \begin{macrocode}
\newcommand*\chronos@lliwiau@rhagosodedig{%
  \chronos@lliwiau@isod{%
    chronosRed,%
    chronosOrange,%
    chronosYellow,%
    chronosGreen,%
    chronosBlue,%
    chronosMidnightBlue,%
    chronosViolet%
  }%
  \chronos@lliwiau@uchod{%
    chronosRed,%
    chronosOrange,%
    chronosYellow,%
    chronosGreen,%
    chronosBlue,%
    chronosMidnightBlue,%
    chronosViolet%
  }%
%    \end{macrocode}
%^^A  BEGIN lliwiau prif
%    \begin{macrocode}
  \colorlet{chronos@prifliw}{black}%^^A prifliw
  \colorlet{chronos@prifliw@cefndir}{white}%^^A prifliw cefndir
  \colorlet{chronos@lliw@cefndir@llinell}{black}%^^A oedd lliw cefndir amser?
  \colorlet{chronos@lliw@llinell}{white}%^^A oedd lliw amser
%    \end{macrocode}
%^^A   \colorlet{chronos@lliw@cefndir}{white}% lliw cefndir
%^^A  angen y ffurf gywir
%^^A  yn wreiddiol, 'gwybodaeth' oedd theori ac 'ee' oedd gwybodaeth
%    \begin{macrocode}
  \colorlet{chronos@lliw@theori}{white}%
  \colorlet{chronos@lliw@cefndir@theori}{black}%
  \colorlet{chronos@lliw@cefndir@gwybodaeth}
    {chronos@prifliw!25!chronos@prifliw@cefndir}%^^A lliw cefndir ee = prifliw!25!prifliw cefndir
  \colorlet{chronos@lliw@gwybodaeth}{chronos@prifliw}%^^A lliw ee = prifliw
%    \end{macrocode}
%^^A  \colorlet{chronos@lliw@symbolau@cefndir}{chronos@lliw@cefndir}% lliw symbolau cefndir = lliw cefndir
%^^A  \colorlet{chronos@lliw@symbolau}{chronos@prifliw}% lliw symbolau = prifliw
%^^A   \colorlet{lliw dig}{prifliw!75!prifliw cefndir}
%    \begin{macrocode}
  \colorlet{chronos@borderouter}{chronos@prifliw@cefndir}%
  \colorlet{chronos@borderinner}{chronos@lliw@cefndir@llinell}%
  \colorlet{chronos@bordermiddle}{chronos@borderouter!50!chronos@borderinner}%
%    \end{macrocode}
%^^A  END lliwiau prif
%    \begin{macrocode}
}
%    \end{macrocode}
%^^A END lliwiau >>>
%^^A rhagosodedig
% we need an English alias here
%    \begin{macrocode}
\chronos@lliwiau@rhagosodedig
\let\chronos@lliwiau@default\chronos@lliwiau@rhagosedig
%    \end{macrocode}
% \begin{macro}{\testunteitl}%^^A <<<
%   Main title tag.
% 
%   \#1: opsiwn: style for node
%   \#2: enw sy'n cael ei ddefnyddio dwywaith -> node name + node content (\cs{chronos@testunteitl@priflythrennu})
%   \#3: opsiwn: content y node 
%   \#4: first node for horizontal (x) placement
%   \#5: second node for horizontal (x) placement (average taken)
%   \#6: () required: node for vertical (y) placement
%    \begin{macrocode}
\NewDocumentCommand \testunteitl { O {/chronos/@amserau} m o m m r() }{%^^A <<<
  \coordinate (chronos@coord@temp) at ($(#4)!1/2!(#5)$);
  \IfValueTF {#3}{\def\chronos@tempa{#3}}{%
    \edef\chronos@tempa{\chronos@testunteitl@priflythrennu{#2}}%
  }%
  \node (#2) [anchor=base,#1] at (#6 -| chronos@coord@temp) {\chronos@tempa};
  \ifchronos@shownodes
    \begin{scope}[on chronos overlay layer]
      \draw [help lines, draw=chronos@lliw@node] (#2.north east) 
        -| (#2.south west) -| cycle;
    \end{scope}%
  \fi
}% >>>
%    \end{macrocode}
% \end{macro}%^^A >>>

%^^A BEGIN allweddau PGF/TikZ <<<
%^^A BEGIN rhifau <<<
% Number format from \texttt{fixedpointarithmetic}.
%    \begin{macrocode}
\pgfkeys{/pgf/number format,
  int detect,
  set thousands separator={},
}
%    \end{macrocode}
%^^A END rhifau >>>
%^^A BEGIN layers / haenennau / haenau <<<
% Layers
%    \begin{macrocode}
\pgfqkeys{/chronos}{%
  declare layer/.code={%\DeclareDocumentCommand
    \pgfdeclarelayer{chronos #1}%
  },
  declare layer/.list={background,middle ground,foreground,overlay},
}
\IfFileExists{tikzlibrarycfrforeground.code.tex}{%
  \def\chronos@layers{%
    background,%
    chronos background,%
    chronos middle ground,%
    main,%
    chronos foreground,%
    chronos overlay,%
    foreground%
  }%
}{%
  \def\chronos@layers{%
    background,%
    chronos background,%
    chronos middle ground,%
    main,%
    chronos foreground,%
    chronos overlay%
  }%
}
\pgfqkeys{/chronos}{%
  create layer/.code={%
    \tikzset{%
%    \end{macrocode}
% adapted from \path{tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarybackgrounds.code.tex}
%    \begin{macrocode}
      on chronos #1 layer/.style={%
        execute at begin scope={%
          \pgfonlayer{chronos #1}%
          \let\tikz@options=\pgfutil@empty%
          \tikzset{every on chronos #1 layer/.try,##1}%
          \tikz@options%
        },
        execute at end scope={\endpgfonlayer}
      },
    }%
  },
  create layer/.list={background,middle ground,foreground,overlay},
}
%    \end{macrocode}
%^^A END layers / haenennau / haenau >>>
%^^A BEGIN ychwanegu i siap rectangle <<<
% Adapt the rectangle shape to provide more anchors for easy placement of connectors.
% This is used locally within the package environment.
%
% ateb Symbol 1: \url{https://tex.stackexchange.com/a/385953/}
%    \begin{macrocode}
\def\pgf@sm@shape@name{rectangle}
\pgf@sh@savedanchor\middlenortheast{%
  \pgf@x=\the\wd\pgfnodeparttextbox%
  \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}%
  \advance\pgf@x by 2\pgf@xc%
  \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
  \ifdim\pgf@x<\pgf@xb
    \pgf@x=\pgf@xb
  \fi
  \pgf@x=.5\pgf@x\advance\pgf@x by.5\wd\pgfnodeparttextbox%
  \pgf@y=\ht\pgfnodeparttextbox\advance\pgf@y by\dp\pgfnodeparttextbox%
  \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}%
  \advance\pgf@y by 2\pgf@yc%
  \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
  \ifdim\pgf@y<\pgf@yb
    \pgf@y=\pgf@yb
  \fi
  \pgf@y=.5\pgf@y\advance\pgf@y by-.5\dp\pgfnodeparttextbox%
  \advance\pgf@y by.5\ht\pgfnodeparttextbox%
}
\pgf@sh@savedanchor\middlesouthwest{%
  \pgf@x=\wd\pgfnodeparttextbox%
  \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}
  \advance\pgf@x by 2\pgf@xc%
  \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
  \ifdim\pgf@x<\pgf@xb
    \pgf@x=\pgf@xb
  \fi
  \pgf@x=-.5\pgf@x\advance\pgf@x by.5\wd\pgfnodeparttextbox%
  \pgf@y=\ht\pgfnodeparttextbox%
  \advance\pgf@y by\dp\pgfnodeparttextbox%
  \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}%
  \advance\pgf@y by 2\pgf@yc%
  \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
  \ifdim\pgf@y<\pgf@yb
    \pgf@y=\pgf@yb
  \fi
  \pgf@y=-.5\pgf@y%
  \advance\pgf@y by-.5\dp\pgfnodeparttextbox%
  \advance\pgf@y by.5\ht\pgfnodeparttextbox%
}
\pgf@sh@anchor{middle north east}{\middlenortheast}
\pgf@sh@anchor{middle south west}{\middlesouthwest}
\pgf@sh@anchor{middle south east}{\middlenortheast\pgf@xa=\pgf@x%
  \middlesouthwest\pgf@x=\pgf@xa}
\pgf@sh@anchor{middle north west}{\middlesouthwest\pgf@xa=\pgf@x%
  \middlenortheast\pgf@x=\pgf@xa}
\pgf@sh@anchor{middle north}{%
  \pgf@process{\middlesouthwest}%
  \pgf@xa=.5\pgf@x%
  \pgf@process{\middlenortheast}%
  \pgf@x=.5\pgf@x\advance\pgf@x by \pgf@xa
}
\pgf@sh@anchor{middle south}{%
  \pgf@process{\middlenortheast}%
  \pgf@xa=.5\pgf@x%
  \pgf@process{\middlesouthwest}%
  \pgf@x=.5\pgf@x\advance\pgf@x by \pgf@xa
}
\pgf@sh@anchor{middle west}{%
  \pgf@process{\middlenortheast}%
  \pgf@ya=.5\pgf@y%
  \pgf@process{\middlesouthwest}%
  \pgf@y=.5\pgf@y%
  \advance\pgf@y by \pgf@ya
}
\pgf@sh@anchor{middle east}{%
  \pgf@process{\middlesouthwest}%
  \pgf@ya=.5\pgf@y%
  \pgf@process{\middlenortheast}%
  \pgf@y=.5\pgf@y%
  \advance\pgf@y by \pgf@ya
}
\pgf@sh@anchorborder{%
  \pgf@xb=\pgf@x\pgf@yb=\pgf@y%
  \ifchronos@middleanchorborder
    \middlesouthwest%
  \else
    \southwest
  \fi
  \pgf@xa=\pgf@x\pgf@ya=\pgf@y
  \ifchronos@middleanchorborder
    \middlenortheast%
  \else
    \northeast%
  \fi
  \advance\pgf@x by-\pgf@xa%
  \advance\pgf@y by-\pgf@ya%
  \pgf@xc=.5\pgf@x\pgf@yc=.5\pgf@y%
  \advance\pgf@xa by\pgf@xc%
  \advance\pgf@ya by\pgf@yc%
  \edef\pgf@marshal{\noexpand\pgfpointborderrectangle
    {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}%
    {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
  }%
  \pgf@process{\pgf@marshal}\advance\pgf@x by\pgf@xa\advance\pgf@y by\pgf@ya%
}
\tikzset{%
  /chronos/middle anchorborder/.is if=chronos@middleanchorborder,
}
%    \end{macrocode}
%^^A END ychwanegu i siap rectangle >>>
%^^A BEGIN \tikzset helpers <<<
% Context initialisation.
%
%   \changes{v0.9.3}{2025-07-15}{Eliminate \lpack{xparse} macros for internal commands. (According to \TeX{} SE chat this is The Right Thing To Do).}
%
% Now have up to six stages of config, application and one auxiliary.
% \begin{enumerate*}
%   \item[] Double first arg.
%   \item Prevent tag/default properties from being affected.
%   \item First stage of date-related key setup.
%   \item Common housekeeping.
%   \item[] Install (apply) properties.
%   \item Filter keys.
%   \item Second stage of date-related key setup (formats).
% \end{enumerate*}
%    \begin{macrocode}
\protected\def\chronos@cyd@destun@init@craidd#1#2{% byw, digwyddiad, parhad
  \chronos@cyd@destun@init@un@nodweddion
  \chronos@cyd@destun@init@dau@dyddiadau{#1}%
  \chronos@cyd@destun@init@tri{#1}%
  \chronos@gosod@nodweddion{#1}%
  \chronos@cyd@destun@init@pedwar@filter{#1}{#2}%
  \chronos@cyd@destun@init@pump@dyddiadau{#1}%
}
\protected\def\chronos@cyd@destun@init@sylfaenol#1#2{% theori, gwybodaeth
  \chronos@cyd@destun@init@sylfaenol@aux{#1}{#1}{#2}%
}
\protected\def\chronos@cyd@destun@init@sylfaenol@aux#1#2#3{% cylch theori [theori, gwybodaeth]
  \chronos@cyd@destun@init@un@nodweddion
  \chronos@cyd@destun@init@tri{#2}%
  \chronos@gosod@nodweddion{#2}%
  \chronos@cyd@destun@init@pedwar@filter{#1}{#3}%
}
\protected\def\chronos@cyd@destun@init@star#1#2{% prif, hawfraint
  \chronos@cyd@destun@init@un@nodweddion
  \chronos@cyd@destun@init@tri{#1}%
  \chronos@cyd@destun@init@pedwar@filter{#1}{#2}%
}
\protected\def\chronos@cyd@destun@init@un@nodweddion{%^^A oes angen \relax yn y fan hon?
  \def\chronos@ychwanegu@nodweddion##1##2##3{\relax}%
  \def\chronos@ychwanegu@nodweddion@rhag##1##2{\relax}%
  \def\chronos@cadw@nodweddion##1##2##3{\relax}%
  \def\chronos@cadw@nodweddion@rhag##1##2{\relax}%
}
%    \end{macrocode}
% first stage of date processing
%    \begin{macrocode}
\protected\def\chronos@cyd@destun@init@dau@dyddiadau#1{%
  \pgfqkeys{/chronos}{% paid ag ychwanegu i property lists rhagosodedig mewn cyd-destun lleoll
%    \end{macrocode}
% don't add to default property lists in a local context
%    \begin{macrocode}
    blynyddoedd yn unig/.code={%
      \chronos@dimondblynyddoeddtrue
      \ifchronos@dangoscyfnodau
        \pgfqkeys{/chronos/#1/dangos cyfnodau}{@blynyddoedd yn unig}%
      \else
        \pgfqkeys{/chronos/#1/heb gyfnodau}{@blynyddoedd yn unig}%
      \fi
    },
    dyddiadau llawn/.code={%
      \chronos@dimondblynyddoeddfalse
      \ifchronos@dangoscyfnodau
        \pgfqkeys{/chronos/#1/dangos cyfnodau}{@llawn}%
      \else
        \pgfqkeys{/chronos/#1/heb gyfnodau}{@llawn}%
      \fi
    },
    dangos cyfnodau/.code={%
      \chronos@dangoscyfnodautrue
      \ifchronos@dimondblynyddoedd
        \pgfqkeys{/chronos/#1/dangos cyfnodau}{@blynyddoedd yn unig}%
      \else
        \pgfqkeys{/chronos/#1/dangos cyfnodau}{@llawn}%
      \fi
    },
    heb gyfnodau/.code={%
      \chronos@dangoscyfnodaufalse
      \ifchronos@dimondblynyddoedd
        \pgfqkeys{/chronos/#1/heb gyfnodau}{@blynyddoedd yn unig}%
      \else
        \pgfqkeys{/chronos/#1/heb gyfnodau}{@llawn}%
      \fi
    },
  }%
}
\protected\def\chronos@cyd@destun@init@tri#1{%
  \pgfqkeys{/chronos}{%^^A paid ag ychwanegu i property lists rhagosodedig mewn cyd-destun lleoll | ditto
    tags/.code={\pgfqkeys{/chronos}{@tag/.style={##1}}},
    tags+/.code={\pgfqkeys{/chronos}{@tag/.append style={##1}}},
    testunau/.code={\pgfqkeys{/chronos}{@testun/.style={##1}}},
    testunau+/.code={\pgfqkeys{/chronos}{@testun/.append style={##1}}},
    cysylltiadau/.code={\pgfqkeys{/chronos}{@cysylltiad/.style={##1}}},
    cysylltiadau+/.code={\pgfqkeys{/chronos}{@cysylltiad/.append style={##1}}},
    cysylltwyr chronos'/.code={\pgfqkeys{/chronos}{@cysylltwr@chronos/.style={##1}}},
    cysylltwyr chronos+/.code={%
      \pgfqkeys{/chronos}{@cysylltwr@chronos/.append style={##1}}%
    },
    cysylltwyr testun'/.code={\pgfqkeys{/chronos}{@cysylltwr@testun/.style={##1}}},
    cysylltwyr testun+/.code={\pgfqkeys{/chronos}{@cysylltwr@testun/.append style={##1}}},
    prif gysylltwyr testun'/.code={%
      \pgfqkeys{/chronos}{@cysylltwr@testun@prif/.style={##1}}%
    },
    prif gysylltwyr testun+/.code={%
      \pgfqkeys{/chronos}{@cysylltwr@testun@prif/.append style={##1}}%
    },
    llinellau/.code={\pgfqkeys{/chronos}{@llinell/.style={##1}}},
    llinellau+/.code={\pgfqkeys{/chronos}{@llinell/.append style={##1}}},
    phantom/.is if=chronos@phantom,
    phantom/.default=true,
    troi lliwiau/.is if=chronos@troilliwiau,
    troi lliwiau/.default=true,
    testun yshift/.chronos dimen=\chronos@testun@yshift,
    #1/tag'/.code={\pgfqkeys{/chronos}{@tag/.style={##1}}},
    #1/testun'/.code={\pgfqkeys{/chronos}{@testun/.style={##1}}},
    #1/cysylltiad'/.code={\pgfqkeys{/chronos}{@cysylltiad/.style={##1}}},
    #1/llinell'/.code={\pgfqkeys{/chronos}{@llinell/.style={##1}}},
    #1/cysylltwr chronos'/.code={%
      \pgfqkeys{/chronos}{@cysylltwr@chronos/.style={##1}}%
    },
    #1/cysylltwr testun'/.code={%
      \pgfqkeys{/chronos}{@cysylltwr@testun/.style={##1}}%
    },
    #1/prif gysylltwr testun'/.code={%
      \pgfqkeys{/chronos}{@cysylltwr@testun@prif/.style={##1}}%
    },
    #1/tag+/.code={\pgfqkeys{/chronos}{@tag/.append style={##1}}},
    #1/testun+/.code={\pgfqkeys{/chronos}{@testun/.append style={##1}}},
    #1/cysylltiad+/.code={\pgfqkeys{/chronos}{@cysylltiad/.append style={##1}}},
    #1/llinell+/.code={\pgfqkeys{/chronos}{@llinell/.append style={##1}}},
    #1/cysylltwr chronos+/.code={%
      \pgfqkeys{/chronos}{@cysylltwr@chronos/.append style={##1}}%
    },
    #1/cysylltwr testun+/.code={%
      \pgfqkeys{/chronos}{@cysylltwr@testun/.append style={##1}}%
    },
    #1/prif gysylltwr testun+/.code={%
      \pgfqkeys{/chronos}{@cysylltwr@testun@prif/.append style={##1}}%
    },
    #1/blynyddoedd yn unig/.forward to=/chronos/blynyddoedd yn unig,
    #1/dyddiadau llawn/.forward to=/chronos/dyddiadau llawn,
    #1/dangos cyfnodau/.forward to=/chronos/dangos cyfnodau,
    #1/heb gyfnodau/.forward to=/chronos/heb gyfnodau,
    #1/testun yn unig/.forward to=/chronos/testun yn unig,
    #1/troi lliwiau/.is if=chronos@troilliwiau,
    #1/troi lliwiau/.default=true,
    #1/phantom/.is if=chronos@phantom,
    #1/phantom/.default=true,
    #1/testun yshift/.chronos dimen=\chronos@testun@yshift,
    #1/lliw rhagosodedig/.code={%
      \edef\tempa{\csname chronos@#1@lliw\endcsname}%
      \edef\tempb{\csname chronos@#1@lliw@rhagosodedig\endcsname}%
      \expandafter\let\tempa\tempb
    },
  }%
  \def\chronos@cadw{}% clirio'r macro
}
\protected\def\chronos@cyd@destun@init@pedwar@filter#1#2{%
  \pgfqkeys{/pgf}{%
    key filters/defined/.install key filter,
    key filter handlers/append filtered to/.install key filter handler=\chronos@cadw,
  }%
  %^^A defnyddio'r allweddau sy'n diffinio | define defined keys
  \pgfkeysfiltered{/chronos/#1/.cd,/chronos/@tag,#2}% 
}
%    \end{macrocode}
%^^A   \show\chronos@cadw
%    \begin{macrocode}
\protected\def\chronos@cyd@destun@init@pump@dyddiadau#1{%
%^^A set date formats, whether showing eras, whether using full dates
  \chronos@if@gosodF{@#1@fformatiau@dyddiadau}{%
    \ifchronos@dimondblynyddoedd
      \ifchronos@dangoscyfnodau
        \pgfqkeys{/chronos/#1/dangos cyfnodau}{@blynyddoedd yn unig}%
      \else
        \pgfqkeys{/chronos/#1/heb gyfnodau}{@blynyddoedd yn unig}%
      \fi
    \else
      \ifchronos@dangoscyfnodau
        \pgfqkeys{/chronos/#1/dangos cyfnodau}{@llawn}%
      \else
        \pgfqkeys{/chronos/#1/heb gyfnodau}{@llawn}%
      \fi
    \fi
  }%
}% >>>
%    \end{macrocode}
%^^A END \tikzset helpers >>>
%    \begin{macrocode}
\tikzset{% 
%    \end{macrocode}
%^^A BEGIN handlers <<<
%    \begin{macrocode}
  /handlers/.chronos dimen/.code={%
    \pgfkeysdef{\pgfkeyscurrentpath}{%
      \pgfmathparse{##1}%
      #1=\pgfmathresult pt
    }%
    \pgfkeysdef{\pgfkeyscurrentpath'}{#1=##1}%
    \pgfkeysdef{\pgfkeyscurrentpath'+}{\advance #1 by ##1}%
    \pgfkeysdef{\pgfkeyscurrentpath'-}{\advance #1 by -##1}%
    \pgfkeysdef{\pgfkeyscurrentpath+}{%
      \pgfmathparse{##1}%
      \advance #1 by \pgfmathresult pt
    }%
    \pgfkeysdef{\pgfkeyscurrentpath-}{%
      \pgfmathparse{##1}%
      \advance #1 by -\pgfmathresult pt
    }%
  },
  /handlers/.chronos 2 dimens/.code 2 args={%
    \pgfkeysdefargs{\pgfkeyscurrentpath}{##1:##2}{%
      \pgfmathparse{##1}%
      #1=\pgfmathresult pt
      \pgfmathparse{##2}%
      #2=\pgfmathresult pt
    }%
    \pgfkeysdefargs{\pgfkeyscurrentpath'}{##1:##2}{%
      #1=##1 
      #2=##2
    }%
    \pgfkeysdefargs{\pgfkeyscurrentpath'+}{##1:##2}{%
      \advance #1 by ##1
      \advance #2 by ##2
    }%
    \pgfkeysdefargs{\pgfkeyscurrentpath'-}{##1:##2}{%
      \advance #1 by -##1
      \advance #2 by -##2
    }%
    \pgfkeysdefargs{\pgfkeyscurrentpath+}{##1:##2}{%
      \pgfmathparse{##1}\advance #1 by \pgfmathresult pt
      \pgfmathparse{##2}\advance #2 by \pgfmathresult pt
    }%
    \pgfkeysdefargs{\pgfkeyscurrentpath-}{##1:##2}{%
      \pgfmathparse{##1}\advance #1 by -\pgfmathresult pt
      \pgfmathparse{##2}\advance #2 by -\pgfmathresult pt
    }%
  },
  /handlers/.chronos layer choice/.code={%
%    \end{macrocode}
% \cs{chronos@ychwanegu@gosod} tracks the setting so if a user sets the layer explicitly, chronos won't override it
%    \begin{macrocode}
    \edef\chronos@temppgfpath{\pgfkeyscurrentpath}%
    \pgfkeys{%^^A set the layer to put all things of some kind on e.g. connections, lines, timeline border
      \pgfkeyscurrentpath/.is choice,
      \chronos@temppgfpath/.cd,
      background/.code={%
        \pgfkeys{/chronos/chronos@#1@haenen/.style={on chronos background layer}}%
        \chronos@ychwanegu@gosod{#1}%
      },
      middle ground/.code={%
        \pgfkeys{/chronos/chronos@#1@haenen/.style={on chronos middle ground layer}}%
        \chronos@ychwanegu@gosod{#1}%
      },
      foreground/.code={%
        \pgfkeys{/chronos/chronos@#1@haenen/.style={on chronos foreground layer}}%
        \chronos@ychwanegu@gosod{#1}%
      },
      overlay/.code={%
        \pgfkeys{/chronos/chronos@#1@haenen/.style=on chronos overlay layer}%
        \chronos@ychwanegu@gosod{#1}%
      },
      main/.code={%
        \pgfkeys{/chronos/chronos@#1@haenen/.style={}}%
        \chronos@ychwanegu@gosod{#1}%
      },
    }%
  },
  /handlers/.chronos lliw/.code={% chronos colour
    \pgfkeysdef{\pgfkeyscurrentpath}{\colorlet{chronos@#1}{##1}}%
  },
  /handlers/.chronos track/.code={% track setting of property by user
    \pgfkeys{%
      \pgfkeyscurrentpath/.append code={\chronos@ychwanegu@gosod{#1}},
    }%
  },
  /handlers/.chronos search/.code={%^^A set up search so english paths work e.g. /chronos/life
    \pgfkeys{%
      \pgfkeyscurrentpath/.unknown/.code={%
        \let\searchname=\pgfkeyscurrentname%
        \pgfkeysalso{%^^A **angen** y {} o gwmpas ##1 isod! | **need** the {} around ##1 below!
          /chronos/#1/\searchname/.try={##1},
          /chronos/\searchname/.retry={##1},
          /tikz/\searchname/.retry={##1},
          /pgf/\searchname/.lastretry={##1}%
        }%
      },
    }%
  },
%    \end{macrocode}
%^^A BEGIN /handlers/.chronos tag init
%    \begin{macrocode}
  /handlers/.chronos tag init/.code 2 args={%^^A initialise a chronos 'tag' e.g. life, event, period
    \pgfkeys{%
      \pgfkeyscurrentpath/.cd,
%    \end{macrocode}
% english translations below
%    \begin{macrocode}
      enw/.store in/.expand once=\csname chronos@#1@enw\endcsname,
%    \end{macrocode}
% create a tikz-friendly version of name, in case name contains anything problematic
%    \begin{macrocode}
      chronos@tikzname/.code={\chronos@creu@tikzname {#1}{##1}},
      enw/.forward to=/chronos/#1/chronos@tikzname,
      fel y mae/.is if=chronos@felymae,
      fel y mae/.default=true,
      llinell'/.code={\chronos@cadw@nodweddion{#1}{@llinell}{##1}},
      llinell+/.code={\chronos@ychwanegu@nodweddion{#1}{@llinell}{##1}},
      llinell/.forward to=/chronos/#1/llinell',
      llinell add yshift/.chronos dimen=\chronos@llinell@add@yshift,
      lliw/.store in/.expand once=\csname chronos@#1@lliw\endcsname,
%    \end{macrocode}
%^^A    %   lliw/.chronos tag lliw={#1}{lliw},
%    \begin{macrocode}
      lliw rhagosodedig/.store in/.expand once=\csname chronos@#1@lliw@rhagosodedig\endcsname,
      lliw rhagosodedig=chronos@prifliw,
      lliwiau uchod/.code={\chronos@lliwiau@uchod@tag{#1}{##1}},
      lliwiau isod/.code={\chronos@lliwiau@isod@tag{#1}{##1}},
      lliwiau uchod o clist/.code={\chronos@global@eq@clist{lliwiau_#1_uchod}{##1}},
      lliwiau isod o clist/.code={\chronos@global@eq@clist{lliwiau_#1_isod}{##1}},
      isod/.is if=chronos@#1@isod,
      uchod/.code/.expand once={\csname chronos@#1@isodfalse\endcsname},
      at/.store in/.expand once=\csname chronos@#1@at\endcsname,
      at/.expand once=\csname chronos@#1@tikzname\endcsname,
%    \end{macrocode}
% \changes{v0.9.3}{2025-07-11}{Add \texttt{at aux} for placing the \texttt{text tag} relative to the beginning or ending of a \texttt{life} or \textt{period}.} 
%    \begin{macrocode}
      at aux/.code={%
        \expandafter\def\expandafter\chronos@tempa{\csname chronos@#1@tikzname\endcsname}%
        \expandafter\def\csname chronos@#1@at\endcsname {%
          ##1 \chronos@tempa}},
      angor/.store in/.expand once=\csname chronos@#1@angor\endcsname,
      angor/.forward to=/tikz/anchor,
      cysylltu/.is if=chronos@#1@cysylltiad,
      cysylltiad'/.code={\chronos@cadw@nodweddion{#1}{@cysylltiad}{##1}},
      cysylltiad+/.code={\chronos@ychwanegu@nodweddion{#1}{@cysylltiad}{##1}},
      cysylltiad/.forward to=/chronos/#1/cysylltiad',
      cysylltwr chronos'/.code={%
        \chronos@cadw@nodweddion{#1}{@cysylltwr@chronos}{##1}},
      cysylltwr chronos+/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@cysylltwr@chronos}{##1}},
      cysylltwr chronos/.forward to=/chronos/#1/cysylltwr chronos+,
      cysylltwr testun'/.code={%
        \chronos@cadw@nodweddion{#1}{@cysylltwr@testun}{##1}},
      cysylltwr testun+/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@cysylltwr@testun}{##1}},
      cysylltwr testun/.forward to=/chronos/#1/cysylltwr testun+,
      ffont testun/.code={%
        \expandafter\def\csname chronos@#1@ffonttestun\endcsname{##1}},
      ffont testun=,
      prif gysylltwr testun'/.code={%
        \chronos@cadw@nodweddion{#1}{@cysylltwr@testun@prif}{##1}},
      prif gysylltwr testun+/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@cysylltwr@testun@prif}{##1}},
      prif gysylltwr testun/.forward to=/chronos/#1/prif gysylltwr testun',
      tag'/.code={\chronos@cadw@nodweddion{#1}{@tag}{##1}},
      tag+/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{##1}},
      tag/.forward to=/chronos/#1/tag+,
      testun'/.code={\chronos@cadw@nodweddion{#1}{@testun}{##1}},
      testun+/.code={\chronos@ychwanegu@nodweddion{#1}{@testun}{##1}},
      testun/.forward to=/chronos/#1/testun',
      cysylltwyr+/.code={%^^A rhan o /chronos/#1; paid â ddileu fe!! | part of /chronos/#1; don't delete it!!
        \csname chronos@#1@cysylltiadtheoritrue\endcsname
        \IfExistTF \chronos@cysylltwyr {%
          \expandafter\def\expandafter\chronos@cysylltwyr\expandafter{%
            \chronos@cysylltwyr,##1}%
        }{\def \chronos@cysylltwyr{##1}}%
      },
      cysylltwyr'/.code={%
        \csname chronos@#1@cysylltiadtheoritrue\endcsname
        \def \chronos@cysylltwyr{##1}%
      },
      cysylltwyr/.forward to=/chronos/#1/cysylltwyr+,
      testun yn unig/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yn unig}},
      troi lliwiau/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/troi lliwiau=##1}},
      troi lliwiau/.default=true,
      phantom/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/phantom=##1}},
      phantom/.default=true,
      cynnwys testun/.store in=\chronos@cynnwys@testun,
      cynnwys enw/.store in=\chronos@cynnwys@enw,
      cynnwys dyddiadau/.store in=\chronos@cynnwys@dyddiadau,
      yshift/.store in=\chronos@yshift,
      yshift/.forward to=yshift,
      testun yshift/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift=##1}},
      testun yshift'/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift'=##1}},
      testun yshift+/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift+=##1}},
      testun yshift-/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift-=##1}},
      testun yshift'+/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift'+=##1}},
      testun yshift'-/.code={%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift'-=##1}},
%    \end{macrocode}
% begin saesneg: \verb|/chronos/#1|
%^^A       /chronos/#2/.cd,% yn anffodus dyw hyn ddim yn gweithio (not forwarded on pellach)
%    \begin{macrocode}
      name/.forward to=/chronos/#1/enw,
%    \end{macrocode}
%^^A       at/.forward to=/chronos/#1/at, % paid â gwneud hwn! vicious circularity -> tex capacity exceeded!!
%    \begin{macrocode}
      as is/.forward to=/chronos/#1/fel y mae,
      colour/.forward to=/chronos/#1/lliw,
      color/.forward to=/chronos/#1/lliw,
      default colour/.forward to=/chronos/#1/lliw rhagosodedig,
      default color/.forward to=/chronos/#1/lliw rhagosodedig,
      colours above/.forward to=/chronos/#1/lliwiau uchod,
      colours below/.forward to=/chronos/#1/lliwiau isod,
      colors above/.forward to=/chronos/#1/lliwiau uchod,
      colors below/.forward to=/chronos/#1/lliwiau isod,
      colours above from clist/.forward to=/chronos/#1/lliwiau uchod o clist,
      colours below from clist/.forward to=/chronos/#1/lliwiau isod o clist,
      colors above from clist/.forward to=/chronos/#1/lliwiau uchod o clist,
      colors below from clist/.forward to=/chronos/#1/lliwiau isod o clist,
      place below/.forward to=/chronos/#1/isod,
      place above/.forward to=/chronos/#1/uchod,
      tag anchor/.forward to=/chronos/#1/angor,
      connect/.forward to=/chronos/#1/cysylltu,
      connection/.forward to=/chronos/#1/cysylltiad,
      connection'/.forward to=/chronos/#1/cysylltiad',
      connection+/.forward to=/chronos/#1/cysylltiad+,
      connectors/.forward to=/chronos/#1/cysylltwyr,
      connectors+/.forward to=/chronos/#1/cysylltwyr+,
      connectors'/.forward to=/chronos/#1/cysylltwyr',
      text font/.forward to=/chronos/#1/ffont testun,
      text tag connector+/.forward to=/chronos/#1/cysylltwr testun+,
      text tag connector'/.forward to=/chronos/#1/cysylltwr testun',
      text tag connector/.forward to=/chronos/#1/cysylltwr testun,
      main text tag connector+/.forward to=/chronos/#1/prif gysylltwr testun+,
      main text tag connector'/.forward to=/chronos/#1/prif gysylltwr testun',
      main text tag connector/.forward to=/chronos/#1/prif gysylltwr testun,
      chronos connector+/.forward to=/chronos/#1/cysylltwr chronos+,
      chronos connector'/.forward to=/chronos/#1/cysylltwr chronos',
      chronos connector/.forward to=/chronos/#1/cysylltwr chronos,
      colour rotation/.forward to=/chronos/#1/troi lliwiau,
      color rotation/.forward to=/chronos/#1/troi lliwiau,
      line/.forward to=/chronos/#1/llinell,
      line'/.forward to=/chronos/#1/llinell',
      line+/.forward to=/chronos/#1/llinell+,
      line add yshift/.chronos dimen=\chronos@llinell@add@yshift,
      only text/.forward to=/chronos/#1/testun yn unig,
      text tag/.forward to=/chronos/#1/testun,
      text tag'/.forward to=/chronos/#1/testun',
      text tag+/.forward to=/chronos/#1/testun+,
      text tag yshift/.forward to=/chronos/#1/testun yshift,
      text tag yshift'/.forward to=/chronos/#1/testun yshift',
      text tag yshift+/.forward to=/chronos/#1/testun yshift+,
      text tag yshift-/.forward to=/chronos/#1/testun yshift-,
      text tag yshift'+/.forward to=/chronos/#1/testun yshift'+,
      text tag yshift'-/.forward to=/chronos/#1/testun yshift'-,
      text content/.forward to=/chronos/#1/cynnwys testun,
      name content/.forward to=/chronos/#1/cynnwys enw,
      dates content/.forward to=/chronos/#1/cynnwys dyddiadau,
%    \end{macrocode}
%^^A       yshift/.forward to=/chronos/#1/yshift, % paid â gwneud hwn! vicious circularity -> tex capacity exceeded!!
%^^A       tag/.forward to=/chronos/#1/tag, % paid â gwneud hwn! vicious circularity -> tex capacity exceeded!!
%^^A       tag+/.forward to=/chronos/#1/tag+, % paid â gwneud hwn! vicious circularity -> tex capacity exceeded!!
% end saesneg: \verb|/chronos/#1|
%
% begin shortcuts
%    \begin{macrocode}
      /chronos/.cd,
      cysylltiad #1+/.forward to=/chronos/#1/cysylltiad+,
      cysylltiad #1'/.forward to=/chronos/#1/cysylltiad',
      cysylltiad #1/.forward to=/chronos/#1/cysylltiad,
      cysylltwr chronos #1+/.forward to=/chronos/#1/cysylltwr chronos+,
      cysylltwr chronos #1'/.forward to=/chronos/#1/cysylltwr chronos',
      cysylltwr chronos #1/.forward to=/chronos/#1/cysylltwr chronos,
      cysylltwr testun #1+/.forward to=/chronos/#1/cysylltwr testun+,
      cysylltwr testun #1'/.forward to=/chronos/#1/cysylltwr testun',
      cysylltwr testun #1/.forward to=/chronos/#1/cysylltwr testun,
      prif gysylltwr testun #1+/.forward to=/chronos/#1/prif gysylltwr testun+,
      prif gysylltwr testun #1'/.forward to=/chronos/#1/prif gysylltwr testun',
      prif gysylltwr testun #1/.forward to=/chronos/#1/prif gysylltwr testun,
      llinell #1+/.forward to=/chronos/#1/llinell+,
      llinell #1'/.forward to=/chronos/#1/llinell',
      llinell #1/.forward to=/chronos/#1/llinell,
      testun #1+/.forward to=/chronos/#1/testun+,
      testun #1'/.forward to=/chronos/#1/testun',
      testun #1/.forward to=/chronos/#1/testun,
%    \end{macrocode}
%^^A    % begin saesneg
%    \begin{macrocode}
      #2 connection+/.forward to=/chronos/#1/cysylltiad+,
      #2 connection'/.forward to=/chronos/#1/cysylltiad',
      #2 connection/.forward to=/chronos/#1/cysylltiad,
      #2 chronos connector+/.forward to=/chronos/#1/cysylltwr chronos+,
      #2 chronos connector'/.forward to=/chronos/#1/cysylltwr chronos',
      #2 chronos connector/.forward to=/chronos/#1/cysylltwr chronos,
      #2 text tag connector+/.forward to=/chronos/#1/cysylltwr testun+,
      #2 text tag connector'/.forward to=/chronos/#1/cysylltwr testun',
      #2 text tag connector/.forward to=/chronos/#1/cysylltwr testun,
      #2 main text tag connector+/.forward to=/chronos/#1/prif gysylltwr testun+,
      #2 main text tag connector'/.forward to=/chronos/#1/prif gysylltwr testun',
      #2 main text tag connector/.forward to=/chronos/#1/prif gysylltwr testun,
      #2 line+/.forward to=/chronos/#1/llinell+,
      #2 line'/.forward to=/chronos/#1/llinell',
      #2 line/.forward to=/chronos/#1/llinell,
      #2 text tag+/.forward to=/chronos/#1/testun+,
      #2 text tag'/.forward to=/chronos/#1/testun',
      #2 text tag/.forward to=/chronos/#1/testun,      
%    \end{macrocode}
%^^A    % end saesneg
%^^A    % end shortcuts
%    \begin{macrocode}
      /chronos/#2/.chronos search=#1,
      /chronos/#1/.chronos search=#2,% heb bwrpas | pointless
      /chronos/#1/.code={\pgfqkeys{/chronos/#1}{##1}},
      /chronos/#2/.forward to=/chronos/#1,
    }%
  },
%    \end{macrocode}
%^^A END .chronos tag init
%^^A BEGIN /handlers/.chronos tag dyddiadau init
%    \begin{macrocode}
  /handlers/.chronos tag dyddiadau init/.code args={#1:#2:#3:#4:#5:#6:#7:#8:#9}{% e.g. /chronos/byw/.chronos tag dyddiadau init=byw:geni:marw:bu farw:bufarw:geni:marw:birth:death
%    \end{macrocode}
% for elements belonging to tags of types which span more than one date e.g.\ life, period.
% we need 3 date formats (possibly all the same).
% the first is for the begin date when both dates belong to the same era.
% the second is for the begin date when the eras differ.
% the third is for the end date (regardless).
%    \begin{macrocode}
    \pgfkeys{\pgfkeyscurrentpath/.cd,
      dyddiadau/.code args={##1:##2}{%^^A angen y llinell nesaf am y saesneg yn unig
        \pgfqkeys{/chronos/#1}{#2=##1}%^^A needed only for the english ?? (why?)
        \edef\tempa{##2}\edef\tempb{}%
        \ifx\tempa\tempb
        \else
          \pgfqkeys{/chronos/#1}{#3=##2}%
        \fi
      },
      #4/.is if=chronos@#5,
%    \end{macrocode}
% paid â cheisio ddefnyddio macros yn lle allweddau yn y fan hon 
%
% don't try to use macros instead of keys here
%^^A       #2/.code={\chronos@set@date@aux{##1-01-01-0@#6}},
%^^A       #3/.code={\chronos@set@date@aux{##1-12-31-0@#7}\chronos@legacy@if@set{#5}{true}},
%    \begin{macrocode}
      #2/.style={/chronos/set date aux/.expanded={##1-01-01-0@#6}},
      #3/.style={/chronos/set date aux/.expanded={##1-12-31-0@#7},/chronos/#1/#4=true},
      #3={\year-\month-\day},
      label #2/.store in/.expand once=\csname chronos@#1@label#2\endcsname,
      label #3/.store in/.expand once=\csname chronos@#1@label#3\endcsname,
      fformatiau dyddiadau/.style args={##1:##2:##3}{%
        /chronos/#1/fformat #2 yr un gyfnod={##1},
        /chronos/#1/fformat #2 cyfnodau gwahanol={##2},
        /chronos/#1/fformat #3={##3},
      },
      fformatiau dyddiadau/.chronos track={@#1@fformatiau@dyddiadau,@#1@cyfnodau,@#1@llawn},
      fformat #2 yr un gyfnod/.code={%
        \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{##1}%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/#1/fformat #2 yr un gyfnod={##1}}%
      },
      fformat #2 cyfnodau gwahanol/.code={%
        \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{##1}%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{%
          /chronos/#1/fformat #2 cyfnodau gwahanol={##1}}%
      },
      fformat #2/.forward to=/chronos/#1/fformat #2 yr un gyfnod,
      fformat #2/.forward to=/chronos/#1/fformat #2 cyfnodau gwahanol,
      fformat #3/.code={%
        \expandafter\def\csname chronos@#1@fformat#3\endcsname{##1}%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/#1/fformat #3={##1}}%
      },
      fformat #2 yr un gyfnod/.chronos track={%
        @#1@fformatiau@dyddiadau,@#1@cyfnodau,@#1@llawn},
      fformat #2 cyfnodau gwahanol/.chronos track={%
        @#1@fformatiau@dyddiadau,@#1@cyfnodau,@#1@llawn},
      fformat #2/.chronos track={%
        @#1@fformatiau@dyddiadau,@#1@cyfnodau,@#1@llawn},
      fformat #3/.chronos track={%
        @#1@fformatiau@dyddiadau,@#1@cyfnodau,@#1@llawn},
      dangos cyfnodau/@blynyddoedd yn unig/.code={%^^A show eras + only years formats
        \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{!Y}%
        \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{%
          !Y\thinspace !E}%
        \expandafter\def\csname chronos@#1@fformat#3\endcsname{!Y\thinspace !E}%
      },
      dangos cyfnodau/@llawn/.code={% show eras + full dates formats
        \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{!d/!m/!Y}%
        \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{%
          !d/!m/!Y\thinspace !E}%
        \expandafter\def\csname chronos@#1@fformat#3\endcsname{%
          !d/!m/!Y\thinspace !E}%
      },
      dangos cyfnodau/llawn/.code n args=3{%^^A show eras + full dates set formats
        \pgfqkeys{/chronos/#1/dangos cyfnodau}{%
          @llawn/.code={%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{##1}%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{##2}%
            \expandafter\def\csname chronos@#1@fformat#3\endcsname{##3}%
          }%
        }%
      },
      dangos cyfnodau/blynyddoedd yn unig/.code n args=3{%^^A show eras + only years set formats
        \pgfqkeys{/chronos/#1/dangos cyfnodau}{%
          @blynyddoedd yn unig/.code={%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{##1}%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{##2}%
            \expandafter\def\csname chronos@#1@fformat#3\endcsname{##3}%
          }%
        }%
      },
      heb gyfnodau/@blynyddoedd yn unig/.code={%^^A w/o eras + only years formats
            \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{!Y}%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{!Y}%
            \expandafter\def\csname chronos@#1@fformat#3\endcsname{!Y}%
      },
      heb gyfnodau/@llawn/.code={%^^A w/o eras + full dates formats
        \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{!d/!m/!Y}%
        \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{!d/!m/!Y}%
        \expandafter\def\csname chronos@#1@fformat#3\endcsname{!d/!m/!Y}%
      },
      heb gyfnodau/llawn/.code n args=3{%^^A w/o eras + full dates set formats
        \pgfqkeys{/chronos/#1/heb gyfnodau}{%
          @llawn/.code={%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{##1}%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{##2}%
            \expandafter\def\csname chronos@#1@fformat#3\endcsname{##3}%
          }%
        }%
      },
      heb gyfnodau/blynyddoedd yn unig/.code n args=3{%^^A w/o eras + only years set formats
        \pgfqkeys{/chronos/#1/heb gyfnodau}{%
          @blynyddoedd yn unig/.code={%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{##1}%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{##2}%
            \expandafter\def\csname chronos@#1@fformat#3\endcsname{##3}%
          }%
        }%
      },
%    \end{macrocode}
% english translations below
%    \begin{macrocode}
      blynyddoedd yn unig/.code={%
      \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/blynyddoedd yn unig}},
      dyddiadau llawn/.code={%
      \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/dyddiadau llawn}},
      dangos cyfnodau/.code={%
      \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/dangos cyfnodau}},
      heb gyfnodau/.code={%
      \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/heb gyfnodau}},
      dangos cyfnodau/.chronos track={@#1@cyfnodau},
      dyddiadau llawn/.chronos track={@#1@llawn},
      heb gyfnodau/.chronos track={@#1@cyfnodau},
      blynyddoedd yn unig/.chronos track={@#1@llawn},
      ffont dyddiad/.code={%
      \expandafter\def\csname chronos@#1@ffontdyddiad\endcsname{##1}},
      ffont dyddiad=,
%    \end{macrocode}
%  begin saesneg: \verb|/chronos/#1|
%    \begin{macrocode}
      dates/.forward to=/chronos/#1/dyddiadau,
      #8/.forward to=/chronos/#1/#2,
      #9/.forward to=/chronos/#1/#3,
      date formats/.forward to=/chronos/#1/fformatiau dyddiadau,
      #8 format/.forward to=/chronos/#1/fformat #2,
      same era #8 format/.forward to=/chronos/#1/fformat #2 yr un gyfnod,
      different eras #8 format/.forward to=/chronos/#1/fformat #2 cyfnodau gwahanol,
      #9 format/.forward to=/chronos/#1/fformat #3,
      show eras/full/.forward to=/chronos/#1/dangos cyfnodau/llawn,
      show eras/only years/.forward to=/chronos/#1/dangos cyfnodau/blynyddoedd yn unig,
      without eras/full/.forward to=/chronos/#1/heb gyfnodau/llawn,
      without eras/only years/.forward to=/chronos/#1/heb gyfnodau/blynyddoedd yn unig,
      #8 label/.forward to=/chronos/#1/label #2,
      #9 label/.forward to=/chronos/#1/label #3,
      only years/.forward to=/chronos/#1/blynyddoedd yn unig,
      full dates/.forward to=/chronos/#1/dyddiadau llawn,
      without eras/.forward to=/chronos/#1/heb gyfnodau,
      show eras/.forward to=/chronos/#1/dangos cyfnodau,
      date font/.forward to=/chronos/#1/ffont dyddiad,
%    \end{macrocode}
% end saesneg: \verb|/chronos/#1|
%    \begin{macrocode}
    }%
  },
%    \end{macrocode}
%^^A END .chronos tag dyddiadau init
%    \begin{macrocode}
  /handlers/.chronos key maker/.code n args=3{%
    \chronos@keymaker{#1}{#2}{#3}%
  },
%    \end{macrocode}
%^^A END handlers >>>
%^^A BEGIN chronos (prif gôd)
%    \begin{macrocode}
  chronos/.code={\PackageError{chronos}{%
    The key chronos is deprecated.\MessageBreak
    Use the environment chronos instead.}},
%    \end{macrocode}
%^^A END chronos (prif gôd)
%^^A BEGIN byw | life (prif gôd)
%    \begin{macrocode}
  byw/.code={\chronos@cyd@destun@init@craidd{byw}{#1}},
  byw/.default={},
%    \end{macrocode}
%^^A END byw (prif gôd)
%^^A BEGIN digwyddiad | event (prif gôd)
%    \begin{macrocode}
  digwyddiad/.code={\chronos@cyd@destun@init@craidd{digwyddiad}{#1}},
  digwyddiad/.default={},
%    \end{macrocode}
%^^A END digwyddiad (prif gôd)
%^^A BEGIN parhad | period (prif gôd)
%    \begin{macrocode}
  parhad/.code={\chronos@cyd@destun@init@craidd{parhad}{#1}},
  parhad/.default={},
%    \end{macrocode}
%^^A END parhad (prif gôd)
%^^A BEGIN theori | theory (prif gôd)
%    \begin{macrocode}
  theori/.code={\chronos@cyd@destun@init@sylfaenol{theori}{#1}\chronos@tag@cysylltufalse},
  theori/.default={},
%    \end{macrocode}
%^^A END theori (prif gôd)
%^^A BEGIN cylch theori | theory circle (prif gôd) --- cylchau bychain heb gysylltiadau
%    \begin{macrocode}
  cylch theori/.code={%
    \chronos@cyd@destun@init@sylfaenol@aux{theori/cylchau}{theori}{#1}%
    \chronos@tag@cysylltufalse},
  cylch theori/.default={},
%    \end{macrocode}
%^^A END cylch theori (prif gôd)
%^^A BEGIN gwybodaeth | info (prif gôd)
%    \begin{macrocode}
  gwybodaeth/.code={%
    \chronos@cyd@destun@init@sylfaenol{gwybodaeth}{#1}\chronos@tag@cysylltufalse},
  gwybodaeth/.default={},
%    \end{macrocode}
%^^A END gwybodaeth (prif gôd)
%^^A BEGIN prif (teitl) main (title) (prif gôd) 
%    \begin{macrocode}
  prif/.code={\chronos@cyd@destun@init@star{prif}{#1}},
  prif/.default={},
%    \end{macrocode}
%^^A END prif (teitl) (prif gôd)
%^^A BEGIN hawlfraint copyright (prif gôd) 
%    \begin{macrocode}
  hawlfraint/.code={\chronos@cyd@destun@init@star{hawlfraint}{#1}},
  hawlfraint/.default={},
%    \end{macrocode}
%^^A END hawlfraint copyright (prif gôd)
%^^A BEGIN saesneg byw digwyddiad parhad theori cylch theori prif
%    \begin{macrocode}
  life/.forward to=/tikz/byw,
  event/.forward to=/tikz/digwyddiad,
  period/.forward to=/tikz/parhad,
  theory/.forward to=/tikz/theori,
  theory circle/.forward to=/tikz/cylch theori,
  main/.forward to=/tikz/prif,
  copyright/.forward to=/tikz/hawlfraint,
  copyleft/.forward to=/tikz/hawlfraint,
%    \end{macrocode}
%^^A END saesneg byw digwyddiad parhad theori cylch theori prif
%^^A BEGIN top-level styles
%    \begin{macrocode}
  chronos connect/.style args={#1:#2}{#1,/chronos/@cysylltiad=lliw #2},
  chronos create chronos connector/.style args={#1:#2}{%
    #1,/chronos/@cysylltwr@chronos=lliw #2},
  chronos create text tag connector/.style args={#1:#2}{%
    #1,/chronos/@cysylltwr@testun=lliw #2},
  chronos mark line/.style args={#1:#2}{#1,/chronos/@llinell=lliw #2},
  chronos text tag/.style args={#1:#2}{#1,/chronos/@testun=lliw #2},
  chronos tikz'/.code={\pgfkeysdef{/chronos/@tikz}{#1}},
  chronos tikz+/.code={\pgfqkeys{/chronos}{@tikz/.append code={#1}}},
  chronos tikz/.forward to=/chronos tikz+,
  chronos tikz outside bb'/.code={\pgfkeysdef{/chronos/@@tikz}{#1}},
  chronos tikz outside bb+/.code={\pgfqkeys{/chronos}{@@tikz/.append code={#1}}},
  chronos tikz outside bb/.forward to=/chronos tikz outside bb+,
%    \end{macrocode}
%^^A END top-level styles
%^^A BEGIN llwybrau: /chronos /chronos/byw /chronos/digwyddiad /chronos/theori
%    \begin{macrocode}
  /chronos/.search also={/chronos/llinell amser,/tikz,/pgf},
  /chronos/llinell amser/.search also={/chronos,/tikz,/pgf},
  /chronos/byw/.search also={/chronos,/tikz,/pgf},
  /chronos/digwyddiad/.search also={/chronos,/tikz,/pgf},
  /chronos/parhad/.search also={/chronos,/tikz,/pgf},
  /chronos/theori/.search also={/chronos,/tikz,/pgf},
  /chronos/theori/cylchau/.search also={/chronos/theori,/chronos,/tikz,/pgf},
%    \end{macrocode}
%^^A END llwybrau: /chronos /chronos/byw /chronos/digwyddiad /chronos/theori
%^^A BEGIN /chronos <<<
%    \begin{macrocode}
  /chronos/.cd,
  @before@headings/.code={},
  before headings+/.code={\pgfqkeys{/chronos}{@before@headings/.append code={#1}}},
  before headings'/.code={\pgfqkeys{/chronos}{@before@headings/.code={#1}}},
  before headings/.forward to=/chronos/before headings+,
  @before@frame/.code={},
  before drawing frame+/.code={%
    \pgfqkeys{/chronos}{@before@frame/.append code={#1}}},
  before drawing frame'/.code={\pgfqkeys{/chronos}{@before@frame/.code={#1}}},
  before drawing frame/.forward to=/chronos/before drawing frame+,
  tikz'/.forward to=/tikz/chronos tikz',
  tikz+/.forward to=/tikz/chronos tikz+,
  tikz/.forward to=/tikz/chronos tikz,
  tikz outside bb'/.forward to=/tikz/chronos tikz outside bb',
  tikz outside bb+/.forward to=/tikz/chronos tikz outside bb+,
  tikz outside bb/.forward to=/tikz/chronos tikz outside bb,
%    \end{macrocode}
% @tikz is for standard ; @@tikz ignores bb ; for both user code and chronos
%    \begin{macrocode}
  @tikz/.style={},
  @@tikz/.style={},
%    \end{macrocode}
%  @timeline@config is for indirect user code or overwritable chronos ; @@ is reserved for chronos
%    \begin{macrocode}
  @timeline@config/.code={},
  @@timeline@config/.code={%
    \chronos@if@gosodF {@byw@cyfnodau} 
      {\pgfqkeys{/chronos/byw}{dangos cyfnodau}}%
    \chronos@if@gosodF {@parhad@cyfnodau}
      {\pgfqkeys{/chronos/parhad}{dangos cyfnodau}}%
    \chronos@if@gosodF {@digwyddiad@cyfnodau}
      {\pgfqkeys{/chronos/digwyddiad}{dangos cyfnodau}}%
    \chronos@if@gosodF {@byw@llawn}
      {\pgfqkeys{/chronos/byw}{blynyddoedd yn unig}}%
    \chronos@if@gosodF {@parhad@llawn}
      {\pgfqkeys{/chronos/parhad}{blynyddoedd yn unig}}%
    \chronos@if@gosodF {@digwyddiad@llawn}
      {\pgfqkeys{/chronos/digwyddiad}{dyddiadau llawn}}%
    \chronos@if@gosodF{timeline@years}
      {\pgfqkeys{/chronos/llinell amser}{blynyddoedd=ar y llinell}}%
    \ifchronos@yearsonline
      \chronos@ychwanegu@nodweddion@rhestr{byw,parhad}{@llinell}%
        {fill=####1,fill opacity=.25,draw=none}%
      \chronos@ychwanegu@nodweddion@rhestr{digwyddiad}{@llinell}%
        {draw=####1,fill=none,opacity=.25}%
    \else
      \chronos@ychwanegu@nodweddion@rhestr{byw,parhad}{@llinell}%
        {draw=####1,thick,fill opacity=.75}%
      \chronos@ychwanegu@nodweddion@rhestr{digwyddiad}{@llinell}%
        {draw=####1,draw opacity=.75,fill=none}%
    \fi
%    \end{macrocode}
% efaillai bod yn anghywir tan inni ailosod yn hwyrach!! \textbar{} maybe wrong until we reset later!!
%    \begin{macrocode}
    \let\timelineht\chronos@height
  },
  @style/.style={},
  @@timeline@config@diwedd/.style={},
  @@timeline@config@dechrau/.style={},  
  chronos tweak/.code={\pgfqkeys{/chronos}{@style/.append style={#1}}},
  chronos opacity/.code={%
    \ifchronos@preset\chronos@temptrue\else\chronos@tempfalse\fi
    \chronos@presettrue
    \pgfqkeys{/chronos}{%
      @style/.append style={transparency group,opacity=#1},
      every cysylltiadau+={opacity=#1},
      every cysylltwyr chronos+={opacity=#1},
      /chronos/prif/@frame/.append style={opacity=#1},
      /chronos/llinell amser/.cd,
      llinell+={draw opacity=#1,fill opacity=#1},
      timeline@bare@mark@on@line/.append style={opacity=#1},
      timeline@minor@mark@on@line/.append style={opacity=#1},
      timeline@mark@on@line/.append style={opacity=#1},
      timeline@bare@mark@off@line/.append style={opacity=#1},
      timeline@minor@mark@off@line/.append style={opacity=#1},
      timeline@mark@off@line/.append style={opacity=#1},
      timeline@year@on@line/.append style={opacity=#1},
      timeline@year@ff@line/.append style={opacity=#1},
      border+={opacity=#1}}%
    \ifchronos@temp\chronos@presettrue\else\chronos@presetfalse\fi
  },
%    \end{macrocode}
%^^A BEGIN dyddiadau (pgfcalendar)
%    \begin{macrocode}
  set date aux/.code={% paid â geisio dorri hwn - mae'n torri pethau'n ddrwg ond *dim ond yn nifer bach o achosion felly rhy hawdd i feddwl bod popeth yn iawn ...
    \chronos@set@date@aux{#1}%
  },
%    \end{macrocode}
%^^A END dyddiadau (pgfcalendar)
%^^A BEGIN teitlau, pennawdau, isbennawdau etc. <<<
%    \begin{macrocode}
  headings+/.code={% 
    \chronos@headingstrue
    \chronos@to@clist@append{headings}{#1}%
  },
  heading+/.code n args=3{% name/content; start ; end
    \chronos@headingstrue
    \chronos@to@clist@append{headings}{#1/#2/#3}%
  },
  subheading+/.code n args=4{% name/content; start ; end; pos
    \chronos@headingstrue
    \chronos@to@clist@append{subheadings}{#1/#2/#3/#4}%
  },
  subheadings+/.code={% name/content; start ; end; pos
    \chronos@headingstrue
    \chronos@to@clist@append{subheadings}{#1}%
  },
  heading'/.code n args=3{%
    \chronos@headingstrue
    \chronos@to@clist{headings}{#1/#2/#3}%
  },
  headings'/.code={%
    \chronos@headingstrue
    \chronos@to@clist{headings}{#1}%
  },
  subheading'/.code n args=4{%
    \chronos@headingstrue
    \chronos@to@clist{subheadings}{#1/#2/#3/#4}%
  },
  subheadings'/.code={%
    \chronos@headingstrue
    \chronos@to@clist{subheadings}{#1}%
  },
  century subheading+/.code 2 args={% name/content; start ; end; pos
    \chronos@headingstrue
    \chronos@global@to@clist@append{century_subheadings}{#1/#2}%
  },
  century subheadings+/.code 2 args={% name/content; start ; end; pos
    \chronos@headingstrue
    \foreach \i in {#1} {\chronos@global@to@clist@append{century_subheadings}{\i/#2}}%
  },
  century subheading'/.code 2 args={% name/content; start ; end; pos
    \chronos@headingstrue
    \chronos@global@to@clist{century_subheadings}{#1/#2}%
  },
  century subheadings'/.code 2 args={% name/content; start ; end; pos
    \chronos@headingstrue
    \chronos@global@clear@to@clist{century_subheadings}%
    \foreach \i in {#1} {\chronos@global@to@clist{century_subheadings}{\i/#2}}%
  },
  heading/.forward to=/chronos/heading+,
  headings/.forward to=/chronos/headings+,
  subheading/.forward to=/chronos/subheading+,
  subheadings/.forward to=/chronos/subheadings+,
  century subheading/.forward to=/chronos/century subheading+,
  century subheadings/.forward to=/chronos/century subheadings+,
  subheadings drops/.chronos 2 dimens={\chronos@subheading@drop@uchod}%
    {\chronos@subheading@drop@isod},
  heading drop/.chronos dimen=\chronos@heading@drop,
  headings drops'/.code args={#1:#2:#3}{%
    \chronos@heading@drop=#1 
    \chronos@subheading@drop@uchod=#2 
    \chronos@subheading@drop@isod=#3%
  },
  headings drops'+/.code args={#1:#2:#3}{%
    \advance \chronos@heading@drop by #1 
    \advance \chronos@subheading@drop@uchod by #2 
    \advance\chronos@subheading@drop@isod by #3%
  },
  headings drops'-/.code args={#1:#2:#3}{%
    \advance \chronos@heading@drop by -#1 
    \advance \chronos@subheading@drop@uchod by -#2 
    \advance\chronos@subheading@drop@isod by -#3%
  },
  headings drops'=0pt:0pt:0pt,
  chronos coords'/.code={\chronos@to@clist{dyddiadau_coords}{#1}},
  chronos coords+/.code={\chronos@to@clist@append{dyddiadau_coords}{#1}},
  chronos coords/.forward to=/chronos/chronos coords+,
  frame/.is if=chronos@frame,
  frame/.default=true,
  frame uses bb/.is if=chronos@framedefnyddiobb,
  frame/.default=true,
%    \end{macrocode}
%^^A END teitlau, pennawdau, isbennawdau etc. >>>
%    \begin{macrocode}
}
\ExplSyntaxOn
%    \end{macrocode}
% set up every byw, every byw', every byw+, every life, every life', every life+ etc.; \verb|#3| gives default (' or +)
%    \begin{macrocode}
\__chronos_kexpandtotags:nnn { byw } { life } { + }
\__chronos_kexpandtotags:nnn { digwyddiad } { event } { + }
\__chronos_kexpandtotags:nnn { parhad } { period } { + }
\__chronos_kexpandtotags:nnn { theori } { theory } { + }
\__chronos_kexpandtotags:nnn { gwybodaeth } { info } { + }
%    \end{macrocode}
% like kexpander but without every keys
%    \begin{macrocode}
\__chronos_kextripler:nnnnn { every ~ cylch ~ cylch ~ theori }
  { every ~ theory ~ circle ~ text } { every@cylch ~ cylch ~ theori } { + }
  { style }
\__chronos_kextripler:nnnnn { every ~ testun ~ cylch ~ theori }
  { every ~ theory ~ circle ~ circle } { every@testun ~ cylch ~ theori }
  { + } { style }
\__chronos_kextripler:nnnnn { llinell ~ amser / llinell } { timeline ~ line }
  { llinell ~ amser / timeline@line } { ' } { style }
\__chronos_kextripler:nnnnn { llinell ~ amser / border } { timeline ~ border }
  { llinell ~ amser / timeline@border } { ' } { style }
\__chronos_kextripler:nnnnn { prif / teitl } { prif / title } { prif / @teitl }
  { ' } { style }
\__chronos_kextripler:nnnnn { amserau } { subheadings ~ style } { @amserau }
  { ' } { style }
\__chronos_kextripler:nnnnn { amseraumawr } { headings ~ style }
  { @amseraumawr } { ' } { style }
\__chronos_kextripler:nnnnn { hawlfraint } { copyright } { @hawlfraint }
  { ' } { style }
\__chronos_kextripler:nnnnn { hawlfraint } { copyright } { @hawlfraint } { ' }
  { style }
\__chronos_kexforwardtriple:nn { hawlfraint } { copyleft }
\__chronos_kextripler:nnnn { timeline ~ config } {@timeline@config } { + } { code }
\__chronos_kextripler:nnnn { gwybodaeth / label } { gwybodaeth / @label } { ' }
  { style }
\__chronos_kextripler:nnnn { prif / frame } { prif / @frame } { ' } { style }
\__chronos_kextripler:nnnn { theori / cylchau / label }
  { theori / cylchau / @label } { ' } { style }
\ExplSyntaxOff
\pgfqkeys{/chronos}{%
%    \end{macrocode}
%^^A BEGIN every (digwyddiad, byw, parhad, theori) <<<
%    \begin{macrocode}
  every@cylch cylch theori/.style={%
    fill=chronos@prifliw, draw=chronos@prifliw, even odd rule},
  every@testun cylch theori/.style={%
    decoration={text effects along path, text={#1}, text effects/.cd,%
      fit text to path, text=chronos@prifliw@cefndir,%
      characters={text along path, font=\scriptsize\scshape}}, decorate},
  every byw isod/.code={%
    \chronos@every@byw@isodtrue
    \chronos@every@byw@uchodfalse
    \chronos@byw@isodtrue
  },
  every digwyddiad isod/.code={%
    \chronos@every@digwyddiad@isodtrue
    \chronos@every@digwyddiad@uchodfalse
    \chronos@digwyddiad@isodtrue
  },
  every parhad isod/.code={%
    \chronos@every@parhad@isodtrue
    \chronos@every@parhad@uchodfalse
    \chronos@parhad@isodtrue
  },
  every byw uchod/.code={%
    \chronos@every@byw@uchodtrue
    \chronos@every@byw@isodfalse
    \chronos@byw@isodfalse
  },
  every digwyddiad uchod/.code={%
    \chronos@every@digwyddiad@uchodtrue
    \chronos@every@digwyddiad@isodfalse
    \chronos@digwyddiad@isodfalse
  },
  every parhad uchod/.code={%
    \chronos@every@parhad@uchodtrue
    \chronos@every@parhad@isodfalse
    \chronos@parhad@isodfalse
  },
%    \end{macrocode}
%^^A BEGIN every (digwyddiad, byw, parhad, theori) saesneg
%    \begin{macrocode}
  every life below/.forward to=/chronos/every byw isod,
  every period below/.forward to=/chronos/every parhad isod,
  every event below/.forward to=/chronos/every digwyddiad isod,
  every life above/.forward to=/chronos/every byw uchod,
  every period above/.forward to=/chronos/every parhad uchod,
  every event above/.forward to=/chronos/every digwyddiad uchod,
%    \end{macrocode}
%^^A END every (digwyddiad, byw, parhad, theori) saesneg
%^^A END every (digwyddiad, byw, parhad, theori) >>>
%    \begin{macrocode}
}
\tikzset{%
%    \end{macrocode}
%^^A BEGIN llinell amser | timeline <<<
%    \begin{macrocode}
  /chronos/llinell amser/.code={\pgfqkeys{/chronos/llinell amser}{#1}},
  /chronos/timeline/.forward to=/chronos/llinell amser,
  /chronos/timeline/.chronos search=llinell amser,
  /chronos/llinell amser/.cd,
  timeline arrow/.is if=chronostimelinearrow,
  timeline arrow/.default=true,
  no timeline arrow/.code={\chronostimelinearrowfalse},
  timeline@arrow/.style={},
  no@timeline@arrow/.style={},
  do timeline arrow/.code={},
  conditional timeline arrow/.code 2 args={%
    \pgfqkeys{/chronos}{%
      llinell amser/.cd,
      timeline@arrow/.style={/chronos/.cd,#1},
      no@timeline@arrow/.style={/chronos/.cd,#2},
      do timeline arrow/.add code={%
        \ifchronostimelinearrow 
          \tikzset{/chronos/llinell amser/timeline@arrow}%
        \else
          \tikzset{/chronos/llinell amser/no@timeline@arrow}%
        \fi
      },
    }%
  },
%    \end{macrocode}
%^^A BEGIN ffontiau
%    \begin{macrocode}
  ffont camau mawr/.store in=\chronos@ffont@camaumawr,
  ffont camau bach/.store in=\chronos@ffont@camaubach,
  ffont cyfnodau/.store in=\chronos@ffont@cyfnodau,
  ffont/.forward to=/chronos/llinell amser/ffont cyfnodau,
  ffont/.forward to=/chronos/llinell amser/ffont camau bach,
  ffont/.forward to=/chronos/llinell amser/ffont camau mawr,
%    \end{macrocode}
%^^A BEGIN ffontiau saesneg
%    \begin{macrocode}
  major step font/.forward to=/chronos/llinell amser/ffont camau mawr,
  minor step font/.forward to=/chronos/llinell amser/ffont camau bach,
  eras font/.forward to=/chronos/llinell amser/ffont cyfnodau,
  timeline font/.forward to=/chronos/llinell amser/ffont,
%    \end{macrocode}
%^^A END ffontiau saesneg
%^^A END ffontiau
%^^A BEGIN llinell amser | timeline
%^^A BEGIN hydoedd % haenau  (dim dyfnder?)
%    \begin{macrocode}
  border ar/.chronos layer choice=border,
  border ar=background,
  llinell amser ar/.chronos layer choice=llinell amser,
  llinell amser ar=foreground,
%    \end{macrocode}
%^^A BEGIN hydoedd & haenau saesneg
%    \begin{macrocode}
  border on/.forward to=/chronos/llinell amser/border ar,
  timeline on/.forward to=/chronos/llinell amser/llinell amser ar,
%    \end{macrocode}
%^^A END hydoedd & haenau saesneg
%^^A END hydoedd & haenau
%^^A BEGIN dyddiadau
%    \begin{macrocode}
  dyddiad diwedd/.style={%
    /chronos/@@timeline@config@diwedd/.code={%
      \pgfqkeys{/chronos}{set date aux/.expanded={#1-12-31-0@end}}%
    },
  },
  dyddiad dechrau/.style={%
    /chronos/@@timeline@config@dechrau/.code={%
      \pgfqkeys{/chronos}{set date aux/.expanded={#1-01-01-0@start}}%
    },
  },
  dyddiadau/.code args={#1:#2}{%^^A angen y llinell nesaf am y saesneg yn unig <= ???!!
    \pgfqkeys{/chronos/llinell amser}{dyddiad dechrau=#1,dyddiad diwedd=#2}%
  },
%    \end{macrocode}
%^^A END dyddiadau
%^^A BEGIN camau
%    \begin{macrocode}
  cam blwyddyn fawr/.store in=\chronos@cam@blwyddyn@fawr, %^^A oedd cam mawr
  cam blwyddyn fach/.store in=\chronos@cam@blwyddyn@fach, %^^A oedd cam bach
  rhaniadau cam/.store in=\chronos@camrhaniadau,%^^A cam rhaniadau %^^A oedd camau bach / \chronos@minorsteps
  camu o flwyddyn/.store in=\chronos@stepfrom,
  cam blwyddyn/.code={%
    \pgfqkeys{/chronos/llinell amser}{cam blwyddyn fawr=#1}%
    \Undefine\chronos@cam@blwyddyn@fach
  },
%    \end{macrocode}
%^^A END camau
%^^A BEGIN lliwiau y llinell amser
%    \begin{macrocode}
  lliw mewnol y border/.chronos lliw=borderinner,
  timeline border inner colour/.forward to=/chronos/llinell amser/lliw mewnol y border,
  timeline border inner color/.forward to=/chronos/llinell amser/lliw mewnol y border,
  lliw allanol y border/.chronos lliw=borderouter,
  timeline border outer colour/.forward to=/chronos/llinell amser/lliw allanol y border,
  timeline border outer color/.forward to=/chronos/llinell amser/lliw allanol y border,
  lliw canol y border/.chronos lliw=bordermiddle,
  timeline border middle colour/.forward to=/chronos/llinell amser/lliw canol y border,
  timeline border middle color/.forward to=/chronos/llinell amser/lliw canol y border,
  cefndir/.chronos lliw=lliw@cefndir@llinell,
  blaendir/.chronos lliw=lliw@llinell,
  timeline background/.forward to=/chronos/llinell amser/cefndir,
  timeline foreground/.forward to=/chronos/llinell amser/blaendir,
  background/.forward to=/chronos/llinell amser/cefndir,
  foreground/.forward to=/chronos/llinell amser/blaendir,
%    \end{macrocode}
%^^A END lliwiau y llinell amser
%^^A BEGIN nodau a blynyddoedd | marks and years
%    \begin{macrocode}
  nodi cyfnodau/.is if=chronos@markeras,% cyfnodau ar y llinell amser
  @nodi cyfnodau/.code={\chronos@ychwanegu@gosod{markeras}},
  nodi cyfnodau/.forward to=/chronos/llinell amser/@nodi cyfnodau,
  timeline mark eras/.forward to=/chronos/llinell amser/nodi cyfnodau,
  mark eras/.forward to=/chronos/llinell amser/nodi cyfnodau,
  timeline years set/.store in=\chronos@timelineyears,
  blynyddoedd/.is choice,
  timeline years/.forward to=/chronos/llinell amser/blynyddoedd,
%    \end{macrocode}
%^^A   blynyddoedd y llinell amser/.forward to=/chronos/llinell amser/blynyddoedd,
%    \begin{macrocode}
  blynyddoedd/.forward to=/chronos/llinell amser/timeline years set,
  blynyddoedd/dim/.code={%
    \chronos@timeline@showyearsfalse
    \chronos@blynyddoedduchodfalse
    \chronos@blynyddoeddisodfalse
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@years/.style={},
      angor blynyddoedd=base,
    }% 
  },% oedd /chronos/llinell amser/heb flynyddoedd
  blynyddoedd/none/.forward to=/chronos/llinell amser/blynyddoedd/dim,%^^A oedd /chronos/timeline no years
  blynyddoedd/uchod/.code={% 
    \chronos@yearsonlinefalse
    \chronos@blynyddoedduchodtrue
    \chronos@blynyddoeddisodfalse
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@years/.style={%
        above, anchor=\chronos@timelineyearsanchor, yshift=.5*\chronos@height},
      angor blynyddoedd=south,
    }%
  },
  blynyddoedd/above/.forward to=/chronos/llinell amser/blynyddoedd/uchod,
  blynyddoedd/isod/.code={%
    \chronos@yearsonlinefalse
    \chronos@blynyddoedduchodfalse
    \chronos@blynyddoeddisodtrue
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@years/.style={%
        below, anchor=\chronos@timelineyearsanchor, yshift=-.5*\chronos@height},
      angor blynyddoedd=north,
    }%
  },
  blynyddoedd/below/.forward to=/chronos/llinell amser/blynyddoedd/isod,
  blynyddoedd/ar y llinell/.code={%
    \chronos@yearsonlinetrue
    \chronos@blynyddoedduchodfalse
    \chronos@blynyddoeddisodfalse
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@years/.style={anchor=\chronos@timelineyearsanchor},
      angor blynyddoedd=center,
    }%
  },
  blynyddoedd/on line/.forward to=/chronos/llinell amser/blynyddoedd/ar y llinell,
  blynyddoedd/off line/.code={%    
    \IfBooleanExprTF {%
      ! ( \LegacyBoolean {chronos@blynyddoedduchod} %
      || \LegacyBoolean {chronos@blynyddoeddisod} )
    }{%
      \pgfqkeys{/chronos/llinell amser}{blynyddoedd=uchod}%
    }{%
      \chronos@yearsonlinefalse
    }%
  },  
  blynyddoedd/.chronos track=timeline@years,
  angor blynyddoedd/.store in=\chronos@timelineyearsanchor,
  angor blynyddoedd/.chronos track={angor@blynyddoedd},
  timeline years anchor/.forward to=/chronos/llinell amser/angor blynyddoedd,
  blwyddyn sero/.is if=chronos@yearzero,
  year zero/.forward to=/chronos/llinell amser/blwyddyn sero,
  mark at era switch/.is if=chronos@markateraswitch,
  mark at era switch/.default=true,
  @mark at era switch/.code={\chronos@ychwanegu@gosod{markateraswitch}},
  mark at era switch/.forward to=/chronos/llinell amser/@mark at era switch,
  year at era switch/.code={%
    \chronos@legacy@if@set{chronos@temp}{#1}%
    \ifchronos@temp
      \chronos@markateraswitchfalse
    \else
      \chronos@markateraswitchtrue
    \fi
    \chronos@ychwanegu@gosod{markateraswitch}},
  year at era switch/.default=true,
  blynyddoedd bychain/.is if=chronos@minoryears,
  blynyddoedd bychain/.default=true,
  minor years/.forward to=/chronos/llinell amser/blynyddoedd bychain,
  nodau/.is if=chronos@marks,
  nodau/.default=true,
  timeline marks/.forward to=/chronos/llinell amser/nodau,
  nodau bach/.is if=chronos@marks@minor,
  nodau bach/.default=true,
  timeline minor marks/.forward to=/chronos/llinell amser/nodau bach,
  dangos blynyddoedd/.is if=chronos@timeline@showyears,
  dangos blynyddoedd/.default=true,
  timeline show years/.forward to=/chronos/llinell amser/dangos blynyddoedd,
  nodau noeth/.is if=chronos@marks@bare,
  nodau noeth/.default=true,
  nodau noeth/.chronos track={@bare},
  timeline bare marks/.forward to=/chronos/llinell amser/nodau noeth,
  timeline@year@off@line/.style={%
    text=chronos@lliw@llinell, text opacity=1, align=center, %
    fill opacity=.75, anchor=\chronos@timelineyearsanchor},
  timeline@mark@off@line/.style={draw=chronos@lliw@llinell,%
    {Triangle[width=0pt 3,reversed,length=0pt 1.5]}-, thin, shorten >=-2.5pt},
  timeline@minor@mark@off@line/.style={draw=chronos@lliw@llinell,%
    {Triangle[width=0pt 3,reversed,length=0pt 1.5]}-, very thin,%
    shorten >=-2.5pt},
  era switch off line/.style={thick, shorten >=0pt},
  timeline@bare@mark@off@line/.style={draw=chronos@lliw@llinell,%
    {Triangle[width=0pt 3,reversed,length=0pt 1.5]}-, very thin,%
    shorten >=-1.5pt},
  timeline@year@on@line/.style={text=chronos@lliw@llinell, anchor=center},
  timeline@mark@on@line/.style={draw=chronos@lliw@llinell},
  timeline@minor@mark@on@line/.style={draw=chronos@lliw@llinell, thin},
  timeline@bare@mark@on@line/.style={draw=chronos@lliw@llinell, thick},
  timeline mark@too/.code={%
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@mark@on@line/.append style={#1},
      timeline@mark@off@line/.append style={#1},
    }%
  },
  timeline minor mark@too/.code={%
    \pgfqkeys{/chronos/llinell amser}{%
      timeline minor marks,
      timeline@minor@mark@on@line/.append style={#1},
      timeline@minor@mark@off@line/.append style={#1},
    }%
  },
  timeline bare mark@too/.code={%
    \pgfqkeys{/chronos/llinell amser}{%
      timeline bare marks,
      timeline@bare@mark@on@line/.append style={#1},
      timeline@bare@mark@off@line/.append style={#1},
    }%
  },
  timeline year@too/.code={%
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@year@on@line/.append style={#1},
      timeline@year@off@line/.append style={#1},
    }%
  },
%    \end{macrocode}
%^^A END nodau a blynyddoedd | marks and years
%^^A END llinell amser | timeline >>>
%    \begin{macrocode}
}
\ExplSyntaxOn
%    \end{macrocode}
% forward each key in \#3 to the key in \#2; all keys on /chronos/\#1
%    \begin{macrocode}
\__chronos_kexforwarder:nnn { llinell ~ amser } { timeline ~ mark@too } 
  { timeline ~ mark, timeline ~ all ~ marks }
\__chronos_kexforwarder:nnn { llinell ~ amser } { timeline ~ minor ~ mark@too }
  { timeline ~ minor ~ mark, timeline ~ all ~ marks }
\__chronos_kexforwarder:nnn { llinell ~ amser } { timeline ~ bare ~ mark@too }
  { timeline ~ bare ~ mark, timeline ~ all ~ marks }
\__chronos_kexforwarder:nnn { llinell ~ amser } { timeline ~ year@too }
  { timeline ~ year, timeline ~ all ~ marks }
\__chronos_kexforwarder:nnn { llinell ~ amser } {dyddiadau } { dates }
\__chronos_kexforwarder:nnn { llinell ~ amser } {dyddiad ~ dechrau }
  {  dechrau, start ~ date, start }
\__chronos_kexforwarder:nnn { llinell ~ amser } {dyddiad ~ diwedd }
  {  diwedd, end ~ date, end }
\__chronos_kexforwarder:nnn { llinell ~ amser } {cam ~ blwyddyn ~ fawr }
  { step ~ major ~ years, step ~ major ~ year, cam ~ blwyddyn ~ mawr }
\__chronos_kexforwarder:nnn { llinell ~ amser } {cam ~ blwyddyn ~ fach }
  { cam ~ blynyddoedd ~ bach, step ~ minor ~ years, step ~ minor ~ year }
\__chronos_kexforwarder:nnn { llinell ~ amser } {rhaniadau ~ cam }
  { step ~ divisions } %^^A oedd camau bach, minor steps
\__chronos_kexforwarder:nnn { llinell ~ amser } {cam ~ blwyddyn }
  { cam ~ blynyddoedd, step ~ years, step ~ year }
\__chronos_kexforwarder:nnn { llinell ~ amser } {camu ~ o ~ flwyddyn }
  { step ~ from ~ year }
\ExplSyntaxOff
\pgfqkeys{/chronos}{%
%    \end{macrocode}
%^^A BEGIN testun
%    \begin{macrocode}
  ce year label/.store in=\chronos@yearce,
  bce year label/.store in=\chronos@yearbce,
  timeline ce label/.store in=\chronos@ce,
  timeline bce label/.store in=\chronos@bce,
%    \end{macrocode}
%^^A END testun  
%^^A BEGIN lliwiau <<<
%    \begin{macrocode}
  cefndir/.chronos lliw=prifliw@cefndir,
  background/.forward to=/chronos/cefndir,
  blaendir/.chronos lliw=prifliw,
  foreground/.forward to=/chronos/blaendir,
  troi lliwiau/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/troi lliwiau=#1}%
    \chronos@legacy@if@set{chronos@troilliwiau}{#1}%
  },
  troi lliwiau/.default=true,
  colour rotation/.forward to=/chronos/troi lliwiau,
  color rotation/.forward to=/chronos/troi lliwiau,
  heb droi lliwiau/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/troi lliwiau=false}%
    \chronos@troilliwiaufalse
  },
  no colour rotation/.forward to=/chronos/heb droi lliwiau,
  no color rotation/.forward to=/chronos/heb droi lliwiau,
  troi pob liw/.style={/chronos/.cd, byw/troi lliwiau=true,%
    digwyddiad/troi lliwiau=true, parhad/troi lliwiau=true, %
    theori/troi lliwiau=true, troi lliwiau=true},
  rotate all colours/.forward to=/chronos/troi pob liw,
  rotate all colors/.forward to=/chronos/troi pob liw,
  troi dim lliwiau/.style={/chronos/.cd, byw/troi lliwiau=false,%
    digwyddiad/troi lliwiau=false, parhad/troi lliwiau=false,%
    theori/troi lliwiau=false, heb droi lliwiau},
  rotate no colours/.forward to=/chronos/troi dim lliwiau,
  rotate no colors/.forward to=/chronos/troi dim lliwiau,
%    \end{macrocode}
%^^A END lliwiau >>>
%^^A BEGIN lefelau <<<
%    \begin{macrocode}
  lefelau/.style args={#1:#2}{
	/chronos/uchod=#1,
	/chronos/isod=#2,
  },
  lefelau at/.store in=\chronos@lefelau@at,
  lefelau at=chronos mid,
  uchod/.store in=\chronos@uchod,
  isod/.store in=\chronos@isod,
%    \end{macrocode}
%^^A END lefelau >>>
%^^A BEGIN formats <<<
%    \begin{macrocode}
  fformat dyddiad/.code={\chronos@setdateformat{#1}},
  date format/.forward to=/chronos/fformat dyddiad,
  year format/.code={\chronos@setyearformat{#1}},
  minor year format/.code={\chronos@setminoryearformat{#1}},
  dangos cyfnodau/@blynyddoedd yn unig/.code={%
    \chronos@setdateformat{!Y\thinspace !E}%
  },
  dangos cyfnodau/@llawn/.code={\chronos@setdateformat{!d/!m/!Y\thinspace !E}},
  dangos cyfnodau/llawn/.code={%
    \pgfqkeys{/chronos/dangos cyfnodau}{%
      @llawn/.code={\chronos@setdateformat{#1}}%
    }%
  },
  dangos cyfnodau/blynyddoedd yn unig/.code={%
    \pgfqkeys{/chronos/dangos cyfnodau}{%
      @blynyddoedd yn unig/.code={\chronos@setdateformat{#1}}%
    }%
  },
  heb gyfnodau/@blynyddoedd yn unig/.code={\chronos@setdateformat{!Y}},
  heb gyfnodau/@llawn/.code={\chronos@setdateformat{!d/!m/!Y}},
  heb gyfnodau/llawn/.code={%
    \pgfqkeys{/chronos/heb gyfnodau}{@llawn/.code={\chronos@setdateformat{#1}}}%
  },
  heb gyfnodau/blynyddoedd yn unig/.code={%
    \pgfqkeys{/chronos/heb gyfnodau}{%
      @blynyddoedd yn unig/.code={\chronos@setdateformat{#1}}%
    }%
  },
  blynyddoedd yn unig/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/blynyddoedd yn unig}%
    \chronos@ychwanegu@nodweddion{byw}{@tag}{/chronos/blynyddoedd yn unig}%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/blynyddoedd yn unig}%
    \chronos@ychwanegu@nodweddion{parhad}{@tag}{/chronos/blynyddoedd yn unig}%
    \chronos@dimondblynyddoeddtrue
    \ifchronos@dangoscyfnodau
      \pgfqkeys{/chronos}{%
        dangos cyfnodau/@blynyddoedd yn unig,
      }%
    \else
      \pgfqkeys{/chronos}{%
        heb gyfnodau/@blynyddoedd yn unig,
      }%
    \fi
  },
  only years/.forward to=/chronos/blynyddoedd yn unig,
  dyddiadau llawn/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/dyddiadau llawn}%
    \chronos@ychwanegu@nodweddion{byw}{@tag}{/chronos/dyddiadau llawn}%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/dyddiadau llawn}%
    \chronos@ychwanegu@nodweddion{parhad}{@tag}{/chronos/dyddiadau llawn}%
    \chronos@dimondblynyddoeddfalse
    \ifchronos@dangoscyfnodau
      \pgfqkeys{/chronos}{%
        dangos cyfnodau/@llawn,
      }%
    \else
      \pgfqkeys{/chronos}{%
        heb gyfnodau/@llawn,
      }%
    \fi
  },
  full dates/.forward to=/chronos/dyddiadau llawn,
  dangos cyfnodau/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/dangos cyfnodau}%
    \chronos@ychwanegu@nodweddion{byw}{@tag}{/chronos/dangos cyfnodau}%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/dangos cyfnodau}%
    \chronos@ychwanegu@nodweddion{parhad}{@tag}{/chronos/dangos cyfnodau}%
    \chronos@dangoscyfnodautrue
    \ifchronos@dimondblynyddoedd
      \pgfqkeys{/chronos}{%
        dangos cyfnodau/@blynyddoedd yn unig,
      }%
    \else
      \pgfqkeys{/chronos}{%
        dangos cyfnodau/@llawn,
      }%
    \fi
  },
  show eras/.forward to=/chronos/dangos cyfnodau,
  heb gyfnodau/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/heb gyfnodau}%
    \chronos@ychwanegu@nodweddion{byw}{@tag}{/chronos/heb gyfnodau}%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/heb gyfnodau}%
    \chronos@ychwanegu@nodweddion{parhad}{@tag}{/chronos/heb gyfnodau}%
    \chronos@dangoscyfnodaufalse
    \ifchronos@dimondblynyddoedd
      \pgfqkeys{/chronos}{%
        heb gyfnodau/@blynyddoedd yn unig,
      }%
    \else
      \pgfqkeys{/chronos}{%
        heb gyfnodau/@llawn,
      }%
    \fi
  },
  without eras/.forward to=/chronos/heb gyfnodau,
  show eras/only years/.forward to=/chronos/dangos cyfnodau/blynyddoedd yn unig,
  show eras/full dates/.forward to=/chronos/dangos cyfnodau/dyddiadau llawn,
  without eras/only years/.forward to=/chronos/heb gyfnodau/blynyddoedd yn unig,
  without eras/full dates/.forward to=/chronos/heb gyfnodau/dyddiadau llawn,
  heb gyfnodau/.chronos track={@digwyddiad@cyfnodau,@byw@cyfnodau,@parhad@cyfnodau},
  dangos cyfnodau/.chronos track={@digwyddiad@cyfnodau,@byw@cyfnodau,@parhad@cyfnodau},
  dyddiadau llawn/.chronos track={@digwyddiad@llawn,@byw@llawn,@parhad@llawn},
  blynyddoedd yn unig/.chronos track={@digwyddiad@llawn,@byw@llawn,@parhad@llawn},
%    \end{macrocode}
% \changes{v0.9.4}{2026-03-21}{Fix non-working \texttt{every date format} key.}
%    \begin{macrocode}
  every date format/.code={%^^A defnyddio macros yn lle allweddau rhag ofn , yn #1 => pam ar ddaear?
    \chronos@setdateformat{#1}%
    \pgfqkeys{/chronos}{%
      digwyddiad/fformat dyddiad={#1},
      parhad/fformatiau dyddiadau={#1:#1:#1},
      byw/fformatiau dyddiadau={#1:#1:#1},
    }%
  },
  every date format/.chronos track={%
    @digwyddiad@fformatiau@dyddiadau,@digwyddiad@cyfnodau,@digwyddiad@llawn},
  every date format/.chronos track={%
    @byw@fformatiau@dyddiadau,@byw@cyfnodau,@byw@llawn},
  every date format/.chronos track={%
    @parhad@fformatiau@dyddiadau,@parhad@cyfnodau,@parhad@llawn},
  testun yn unig/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/testun yn unig}%
    \chronos@setdateformat{}%
    \chronos@onlytexttrue
  },
  only text/.forward to=/chronos/testun yn unig,
  event years on line/.code={% 
    \chronos@eventyearsonlinetrue
    \chronos@timeline@showyearsfalse
    \pgfqkeys{/chronos/digwyddiad}{blynyddoedd yn unig,heb gyfnodau}%
    \chronos@onlytexttrue
  },
  event year on line/.style={%
    /chronos/llinell amser/timeline@years,%
    /chronos/llinell amser/timeline@year@on@line,%
    font=\chronos@ffont@camaumawr%
  },
  event year on line skip/.code={\gdef\chronos@specialdate{}},
  event dates split/.is if=chronos@eventdatessplit,
  event date split/.style={},
  testun yshift/.code={%
    \pgfmathparse{#1}%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/testun yshift=\pgfmathresult pt}%
    \chronos@testun@yshift=\pgfmathresult pt
  },
  testun yshift'/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/testun yshift=#1}%
    \chronos@testun@yshift=#1
  },
  testun yshift+/.code={%
    \pgfmathparse{#1}%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/testun yshift'+=\pgfmathresult pt}%
    \advance \chronos@testun@yshift by \pgfmathresult pt
  },
  testun yshift'+/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/testun yshift'+=#1}%
    \advance \chronos@testun@yshift by #1
  },
  text tag yshift/.forward to=/chronos/testun yshift,
  text tag yshift'/.forward to=/chronos/testun yshift,
  text tag yshift'+/.forward to=/chronos/testun yshift,
  text tag yshift+/.forward to=/chronos/testun yshift,
  special date/.code={\gdef\chronos@specialdate{#1}},
%    \end{macrocode}
% saesneg: /chronos (mwy uchod)
%    \begin{macrocode}
  levels/.forward to=/chronos/lefelau,
  levels at/.forward to=/chronos/lefelau at,
%    \end{macrocode}
%^^A END formats >>>
%^^A BEGIN placeholders <<<
% ateb Qrrbrbirlbel \url{https://tex.stackexchange.com/a/694967/}
% permission for lppl: \url{https://tex.stackexchange.com/questions/694799/how-can-i-disable-shadows-and-similar-preaction-postaction-effects-in-tikz-or/694967#comment1725164_694967}
%    \begin{macrocode}
  discard node/.code={% ^^A
    \setbox\pgfutil@tempboxa\box\pgfutil@voidb@x % empty out box
    \def\tikz@whichbox{\pgfutil@tempboxa}%
  },
%    \end{macrocode}
% ateb Qrrbrbirlbel uchod ac ateb arall fe: \url{https://tex.stackexchange.com/a/688111/} ; defnyddio yn lle \cs{chronosphantom}
%    \begin{macrocode}
  phantom node/.code=\tikz@addoption{% 
    \expandafter\let\csname pgf@sh@boxes@\tikz@shape\endcsname\pgfutil@empty},
%    \end{macrocode}
% sylwad Qrrbrbirlbel: \url{https://tex.stackexchange.com/questions/694799/how-can-i-disable-shadows-and-similar-preaction-postaction-effects-in-tikz-or?noredirect=1#comment1724762_694799}
%    \begin{macrocode}
  zap preactions/.code=\let\tikz@preactions\@empty,
  zap postactions/.code=\let\tikz@postactions\@empty,
  placeholders/.is choice,
  placeholders/off/.code={%
    \chronos@placeholdersfalse
    \pgfqkeys{/chronos}{%
      placeholder/.style={fill=none, draw=none,/chronos/discard node},%^^A phantom node,zap preactions,zap postactions},
    }%
  },
  placeholders/on/.code={%
    \pgfqkeys{/chronos}{%
      placeholder/.style={on chronos middle ground layer,fill opacity=.1,%
        draw opacity=.25,text opacity=.5,/chronos/.cd,zap preactions,%
        zap postactions},
    }%
  },
  placeholders/.default=on,
  placeholders=off,
  placeholder lines/.style={help lines,%
    every node/.append style={rotate=-90,anchor=south,pos=.25,inner sep=0pt}},
%    \end{macrocode}
%^^A END placeholders >>>
%^^A BEGIN show coords <<<
%    \begin{macrocode}
  show coords/.is if=chronos@showcoords,
  show coords/.default=true,
  show nodes/.is if=chronos@shownodes,
  show nodes/.default=true,
  show coordinate/.style n args=5{fill=#1, circle, anchor=center,%
    inner sep=1pt, text=#1, pin={[#1, inner sep=0pt, pin edge={draw=#1},%
    pin distance=#4, #5]#2:#3}},
  show coord/.style 2 args={%
    /chronos/show coordinate={chronos@lliw@coord}{#1}{#2}{30pt}{}},
  show node coord/.style 2 args={%
    /chronos/show coordinate={chronos@lliw@node}{#1}{#2}{30pt}{}},
  show node/.style={},
  show bounding box/.is if=chronos@showbb,
  show bounding box/.default=true,
  show node colour/.chronos lliw=lliw@node,
  show bb colour/.chronos lliw=lliw@bb,
  show coordinate colour/.chronos lliw=lliw@coord,
  show node color/.forward to=/chronos/show node colour,
  show coordinate color/.forward to=/chronos/show coordinate colour,
  show bb color/.forward to=/chronos/show bb colour,
  show node colour=blue,
  show coordinate colour=red,
  show bb colour=chronosGreen,
%    \end{macrocode}
%^^A END show coords>>>
%    \begin{macrocode}
  dadfygio/.code={%
    \pgfqkeys{/chronos}{%
      placeholders,show coords,show node colour=blue,show coordinate colour=red,%
      show bounding box,show nodes,show node/.style={draw=chronos@lliw@node}}},
  debug/.forward to=/chronos/dadfygio,
%    \end{macrocode}
%^^A BEGIN digwyddiadau, bywydau, cysylltiadau rhwng y llinell a'r ddau
%    \begin{macrocode}
  enwau lliw syml/.is if=chronos@enwaulliwsyml,
  enwau lliw syml/.default=true,
  dim enwau lliw syml/.code={\chronos@enwaulliwsymlfalse},
  tags/.code={%
    \pgfqkeys{/chronos}{@tag/.style={#1}}%
    \chronos@cadw@nodweddion@rhag{@tag}{#1}},
  tags+/.code={%
    \pgfqkeys{/chronos}{@tag/.append style={#1}}%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{#1}},
  tags={},
  cysylltiad ar/.chronos layer choice=cysylltiad,
  cysylltiadau ar/.forward to=/chronos/cysylltiad ar,
  cysylltiad ar=main,
  llinell ar/.chronos layer choice=llinell,
  llinellau ar/.forward to=/chronos/llinell ar,
  llinell ar=middle ground,
%    \end{macrocode}
%^^A  bocses a chysylltiadau theori
%^^A   cysylltwr theori/.style={anchor=center},% oedd cylch cysylltu
%    \begin{macrocode}
  cysylltwyr theori/.forward to=/chronos/theori/cysylltwr testun,
%    \end{macrocode}
%^^A   {\pgfkeys{/chronos/theori/cysylltwr testun'={anchor=center, inner sep=0pt, outer sep=0pt,#1}}},% oedd cylchau cysylltu
%^^A   cylchau theori/.code={\pgfqkeys{/chronos/theori/cylchau}{label cylch theori/.style={#1}}},
%^^A   cylchau theori/.style={align=center, inner sep=0pt, outer sep=0pt, font=\scriptsize\scshape, text=chronos@prifliw},
%    \begin{macrocode}
  theori dash/.style={},
  lliwiau uchod/.code={\chronos@lliwiau@uchod{#1}},
  lliwiau isod/.code={\chronos@lliwiau@isod{#1}},
  lliwiau uchod o clist/.code={\chronos@global@eq@clist{lliwiau_uchod}{#1}},
  lliwiau isod o clist/.code={\chronos@global@eq@clist{lliwiau_isod}{#1}},
}
\ExplSyntaxOn
%    \end{macrocode}
% set up /chronos/\#1 with \textquotesingle{} and + variants to set default \#3; set up every \#1 with \textquotesingle{} and + variants to set default \#1 and corresponding keys for tags in \#5 ; use \#4 as the default ; set up keys for forwarding using \#2 as alias for \#1
%    \begin{macrocode}
\__chronos_kexpander:nnnnn { llinellau } { lines } { @llinell } { ' }
  { byw, digwyddiad, parhad }
\__chronos_kexpander:nnnnn { cysylltwyr  ~ chronos } { chronos ~ connectors }
  { @cysylltwr@chronos } { + } { byw, digwyddiad, parhad }
\__chronos_kexpander:nnnnn { cysylltwyr ~ testun } { text ~ tag ~ connectors }
  { @cysylltwr@testun } { + } { byw, digwyddiad, parhad, theori }
\__chronos_kexpander:nnnnn { prif ~ gysylltwyr ~ testun }
  { main ~ text ~ tag ~ connectors } { @cysylltwr@testun@prif } { ' }
  { byw, digwyddiad, parhad, theori }
\__chronos_kexpander:nnnnn { cysylltiadau } { connections } { @cysylltiad }
  { ' } { byw, digwyddiad, parhad, theori }
\__chronos_kexpander:nnnnn { testunau } { text ~ tags } { @testun }
  { ' } { byw, digwyddiad, parhad, theori, gwybodaeth }
\__chronos_kexpander:nnnnn { fformat ~ dyddiad } { date ~ format }
  { @fformat@dyddiad } { ' } { byw, digwyddiad, parhad, theori, gwybodaeth }
\ExplSyntaxOff
\pgfqkeys{/chronos}{%
  llinell amser/.cd,
  lled/.chronos dimen=\chronos@width,
  uchder/.chronos dimen=\chronos@height,
  uchder y border/.chronos dimen=\chronos@borderheight,
  timeline era margin/.chronos dimen=\chronos@eramargin,
  timeline margin/.chronos dimen=\chronos@timelinemargin,
  timeline width/.chronos dimen=\chronos@width,
  width/.chronos dimen=\chronos@width,
  timeline height/.chronos dimen=\chronos@height,
  height/.chronos dimen=\chronos@height,
  timeline border height/.chronos dimen=\chronos@borderheight,
  /chronos/.cd,
  llinell yshift/.chronos dimen=\chronos@llinell@yshift,
  line yshift/.chronos dimen=\chronos@llinell@yshift,
  border penawdau/.chronos dimen=\chronos@border@penawdau,
  border pen/.chronos dimen=\chronos@border@pen,
  border gwaelod/.chronos dimen=\chronos@border@gwaelod,
  border de/.chronos dimen=\chronos@border@de,
  border chwith/.chronos dimen=\chronos@border@chwith,
  border allanol/.chronos dimen=\chronos@border@allanol,
  headings border/.chronos dimen=\chronos@border@penawdau,
  top border/.chronos dimen=\chronos@border@penawdau,
  bottom border/.chronos dimen=\chronos@border@gwaelod,
  right border/.chronos dimen=\chronos@border@de,
  left border/.chronos dimen=\chronos@border@chwith,
  outer border/.chronos dimen=\chronos@border@allanol,
}
\tikzset{/chronos/.cd,
  no connections/.code={%
    \chronos@byw@cysylltiadfalse
    \chronos@digwyddiad@cysylltiadfalse
    \chronos@parhad@cysylltiadfalse
  },
  no connectors/.code={%
    \pgfqkeys{/chronos}{every cysylltwyr testun'={coordinate},%
      every cysylltwyr chronos'={coordinate}}},
  no text tag connectors/.code={%
    \pgfqkeys{/chronos}{every cysylltwyr testun'={coordinate}}},
%    \end{macrocode}
%^^A BEGIN saesneg: digwyddiadau, bywydau, cysylltiadau rhwng y llinell a'r ddau
%    \begin{macrocode}
  simple colour names/.forward to=/chronos/enwau lliw syml,
  simple color names/.forward to=/chronos/enwau lliw syml,
  no simple colour names/.forward to=/chronos/dim enwau lliw syml,
  no simple color names/.forward to=/chronos/dim enwau lliw syml,
  connection/.forward to=/chronos/@cysylltiad,
  connection on/.forward to=/chronos/cysylltiad ar,
  connections on/.forward to=/chronos/cysylltiadau ar,
  colours above/.forward to=/chronos/lliwiau uchod,
  colours below/.forward to=/chronos/lliwiau isod,
  colors above/.forward to=/chronos/lliwiau uchod,
  colors below/.forward to=/chronos/lliwiau isod,
  colours above from clist/.forward to=/chronos/lliwiau uchod o clist,
  colours below from clist/.forward to=/chronos/lliwiau isod o clist,
  colors above from clist/.forward to=/chronos/lliwiau uchod o clist,
  colors below from clist/.forward to=/chronos/lliwiau isod o clist,
  lines on/.forward to=/chronos/llinell ar,
  line on/.forward to=/chronos/llinell ar,
%    \end{macrocode}
%^^A   line yshift/.forward to=/chronos/llinell yshift,
%^^A END saesneg: digwyddiadau, bywydau, cysylltiadau rhwng y llinell a'r ddau
%^^A END digwyddiadau, bywydau, cysylltiadau rhwng y llinell a'r ddau
%^^A END /chronos >>>
%    \begin{macrocode}
}
\tikzset{%
%    \end{macrocode}
%^^A BEGIN /chronos/byw
%    \begin{macrocode}
  /chronos/byw/.chronos tag init={byw}{life},
  /chronos/byw/.chronos tag dyddiadau init=byw:geni:marw:bu farw:bufarw:geni:marw:birth:death,
  /chronos/byw/.cd,
%    \end{macrocode}
%^^A END /chronos/byw
%^^A BEGIN /chronos/digwyddiad <<<
%    \begin{macrocode}
  /chronos/digwyddiad/.chronos tag init={digwyddiad}{event},
  /chronos/digwyddiad/.cd,
  dyddiad/.style={/chronos/set date aux/.expanded={#1-01-01-0@dig}},
  ffont dyddiad/.code={\def\chronos@digwyddiad@ffontdyddiad{#1}},
  ffont dyddiad=,
  fformat dyddiad/.code={%
    \def\chronos@digwyddiad@fformatdyddiad{#1}%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}%
      {/chronos/digwyddiad/fformat dyddiad={#1}}%
  },
  fformat dyddiad/.chronos track={%
    @digwyddiad@fformatiau@dyddiadau,@digwyddiad@cyfnodau,@digwyddiad@llawn},
  dangos cyfnodau/@blynyddoedd yn unig/.code={%
    \def\chronos@digwyddiad@fformatdyddiad{!Y\thinspace !E}},
  dangos cyfnodau/@llawn/.code={%
    \def\chronos@digwyddiad@fformatdyddiad{!d/!m/!Y\thinspace !E}},
  dangos cyfnodau/llawn/.code={%
    \pgfqkeys{/chronos/digwyddiad/dangos cyfnodau}{%
      @llawn/.code={\def\chronos@digwyddiad@fformatdyddiad{#1}}}},
  dangos cyfnodau/blynyddoedd yn unig/.code={%
    \pgfqkeys{/chronos/digwyddiad/dangos cyfnodau}{%
      @blynyddoedd yn unig/.code={\def\chronos@digwyddiad@fformatdyddiad{#1}}}},
  heb gyfnodau/@blynyddoedd yn unig/.code={\def\chronos@digwyddiad@fformatdyddiad{!Y}},
  heb gyfnodau/@llawn/.code={\def\chronos@digwyddiad@fformatdyddiad{!d/!m/!Y}},
  heb gyfnodau/llawn/.code={%
    \pgfqkeys{/chronos/digwyddiad/heb gyfnodau}{%
      @llawn/.code={\def\chronos@digwyddiad@fformatdyddiad{#1}},@llawn/.show code}},
  heb gyfnodau/blynyddoedd yn unig/.code={%
    \pgfqkeys{/chronos/digwyddiad/heb gyfnodau}{%
      @blynyddoedd yn unig/.code={\def\chronos@digwyddiad@fformatdyddiad{#1}}}},
  dangos cyfnodau/.code={%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/dangos cyfnodau}},
  heb gyfnodau/.code={%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/heb gyfnodau}},
  dyddiadau llawn/.code={%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/dyddiadau llawn}},
  blynyddoedd yn unig/.code={%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/blynyddoedd yn unig}},
  dangos cyfnodau/.chronos track={@digwyddiad@cyfnodau},
  dyddiadau llawn/.chronos track={@digwyddiad@llawn},
  heb gyfnodau/.chronos track={@digwyddiad@cyfnodau},
  blynyddoedd yn unig/.chronos track={@digwyddiad@llawn},
%    \end{macrocode}
%^^A BEGIN saesneg: /chronos/digwyddiad
%    \begin{macrocode}
  date/.forward to=/chronos/digwyddiad/dyddiad,
  date font/.forward to=/chronos/digwyddiad/ffont dyddiad,
  date format/.forward to=/chronos/digwyddiad/fformat dyddiad,
  show eras/.forward to=/chronos/digwyddiad/dangos cyfnodau,
  only years/.forward to=/chronos/digwyddiad/blynyddoedd yn unig,
  full dates/.forward to=/chronos/digwyddiad/dyddiadau llawn,
  without eras/.forward to=/chronos/digwyddiad/heb gyfnodau,
  show eras/only years/.forward to=/chronos/digwyddiad/dangos cyfnodau/blynyddoedd yn unig,
  show eras/full dates/.forward to=/chronos/digwyddiad/dangos cyfnodau/dyddiadau llawn,
  without eras/only years/.forward to=/chronos/digwyddiad/heb gyfnodau/blynyddoedd yn unig,
  without eras/full dates/.forward to=/chronos/digwyddiad/heb gyfnodau/dyddiadau llawn,
%    \end{macrocode}
%^^A END saesneg: /chronos/digwyddiad
%^^A END /chronos/digwyddiad >>> 
%^^A BEGIN /chronos/parhad
%    \begin{macrocode}
  /chronos/parhad/.chronos tag init={parhad}{period},
  /chronos/parhad/.chronos tag dyddiadau init=parhad:dechrau:diwedd:gorffenedig:gorffenedig:thing:otherthing:start:end,
  /chronos/parhad/.cd,
%    \end{macrocode}
%^^A BEGIN saesneg: /chronos/parhad
%^^A END saesneg: /chronos/parhad
%^^A END /chronos/parhad
%^^A BEGIN /chronos/theori
%    \begin{macrocode}
  /chronos/theori/.chronos tag init={theori}{theory},
  /chronos/theori/.cd,
%    \end{macrocode}
%^^A BEGIN saesneg: /chronos/thoeri
%^^A END saesneg: /chronos/thoeri
%^^A BEGIN /chronos/theori/cylchau
%    \begin{macrocode}
  /chronos/theori/cylchau/.cd,
  enw/.store in=\chronos@cylchtheori@enw,
%    \end{macrocode}
%^^A   fel y mae/.is if=chronos@felymae,
%^^A   fel y mae/.default=true,
%    \begin{macrocode}
  chronos@tikzname/.code={%
    \chronos@creu@tikzname {cylchtheori}{#1}
  },
  enw/.forward to=/chronos/theori/cylchau/chronos@tikzname,
%    \end{macrocode}
%^^A   angor/.store in=\chronos@cylchtheori@angor,
%^^A   angor/.forward to=/tikz/anchor,
%^^A   at/.code yn gweithio am \cylchtheori ond ni weithio am \byw etc.
%    \begin{macrocode}
  at/.code={\coordinate (chronos@cylchtheori@at) at (#1);},
%    \end{macrocode}
%^^A   lliw/.store in=\chronos@cylchtheori@lliw,
%^^A   meintiau/.style args={#1:#2}{
%^^A 	/chronos/theori/cylchau/mawr=#1,
%^^A 	/chronos/theori/cylchau/bach=#2,
%^^A   },
%    \begin{macrocode}
  meintiau/.chronos 2 dimens={\chronos@cylchtheori@mawr}{\chronos@cylchtheori@bach},
  mawr/.chronos dimen=\chronos@cylchtheori@mawr,
  bach/.chronos dimen=\chronos@cylchtheori@bach,
  labeli/.style args={#1:#2}{
	/chronos/theori/cylchau/label uchod=#1,
	/chronos/theori/cylchau/label isod=#2,
  },
  label uchod/.store in=\chronos@cylchtheori@label@uchod,
  label isod/.store in=\chronos@cylchtheori@label@isod,
  testunau cylch/.style args={#1:#2}{
	/chronos/theori/cylchau/testun cylch uchod=#1,
	/chronos/theori/cylchau/testun cylch isod=#2,
  },
  testun cylch uchod/.store in=\chronos@cylchtheori@circletext@uchod,
  testun cylch isod/.store in=\chronos@cylchtheori@circletext@isod,
%    \end{macrocode}
%^^A BEGIN /chronos/theori/cylchau saesneg
%    \begin{macrocode}
  /chronos/theory/circles/.chronos search=theori/cylchau,
  name/.forward to=/chronos/theori/cylchau/enw,
%    \end{macrocode}
%^^A   as is/.forward to=/chronos/theori/fel y mae,
%^^A   tag anchor/.forward to=/chronos/theori/cylchau/angor,
%    \begin{macrocode}
  sizes/.chronos 2 dimens={\chronos@cylchtheori@mawr}{\chronos@cylchtheori@bach},
%    \end{macrocode}
%^^A   sizes/.forward to=/chronos/theori/cylchau/meintiau,
%^^A   theory circle label/.forward to=/chronos/theori/cylchau/label cylch theori,
%    \begin{macrocode}
  circle texts/.forward to=/chronos/theori/cylchau/testunau cylch,
  labels/.forward to=/chronos/theori/cylchau/labeli,
%    \end{macrocode}
%^^A END /chronos/theori/cylchau saesneg
%^^A END /chronos/theori/cylchau
%^^A END /chronos/theori
%^^A BEGIN /chronos/gwybodaeth
%    \begin{macrocode}
  /chronos/gwybodaeth/.cd,
  enw/.store in=\chronos@gwybodaeth@enw,
  chronos@tikzname/.code={%
    \chronos@creu@tikzname {gwybodaeth}{#1}
  },
  enw/.forward to=/chronos/gwybodaeth/chronos@tikzname,
  angor/.store in=\chronos@gwybodaeth@angor,
  at/.store in=\chronos@gwybodaeth@at,
  capsiwn/.store in=\chronos@gwybodaeth@capsiwn,
  lliw/.store in=\chronos@gwybodaeth@lliw,
  lliw rhagosodedig/.store in=\chronos@gwybodaeth@lliw@rhagosodedig,
  lliw rhagosodedig=chronos@lliw@gwybodaeth,
  tag'/.code={%
    \chronos@cadw@nodweddion{gwybodaeth}{@tag}{#1}%
  },
  tag+/.code={%
    \chronos@ychwanegu@nodweddion{gwybodaeth}{@tag}{#1}%
  },
  testun'/.code={%
    \chronos@cadw@nodweddion{gwybodaeth}{@testun}{#1}%
  },
  testun+/.code={%
    \chronos@ychwanegu@nodweddion{gwybodaeth}{@testun}{#1}%
  },
  testun/.forward to=/chronos/gwybodaeth/testun',
  tag/.forward to=/chronos/gwybodaeth/tag+,
  cynnwys testun/.store in=\chronos@cynnwys@testun,
  cynnwys enw/.store in=\chronos@cynnwys@enw,
%    \end{macrocode}
%^^A BEGIN saesneg: /chronos/gwybodaeth
%    \begin{macrocode}
  /chronos/info/.chronos search=gwybodaeth,
  name/.forward to=/chronos/gwybodaeth/enw,
  caption/.forward to=/chronos/gwybodaeth/capsiwn,
  colour/.forward to=/chronos/gwybodaeth/lliw,
  color/.forward to=/chronos/gwybodaeth/lliw,
  default colour/.forward to=/chronos/gwybodaeth/lliw rhagosodedig,
  default color/.forward to=/chronos/gwybodaeth/lliw rhagosodedig,
  text tag/.forward to=/chronos/gwybodaeth/testun,
  text tag'/.forward to=/chronos/gwybodaeth/testun',
  text tag+/.forward to=/chronos/gwybodaeth/testun+,
  tag anchor/.forward to=/chronos/gwybodaeth/angor,
  text content/.forward to=/chronos/gwybodaeth/cynnwys testun,
  name content/.forward to=/chronos/gwybodaeth/cynnwys enw,
%    \end{macrocode}
%^^A END saesneg: /chronos/gwybodaeth
%^^A END /chronos/gwybodaeth
%^^A BEGIN /chronos/prif
%    \begin{macrocode}
  /chronos/prif/.cd,
  enw/.store in=\chronos@prifdeitl@enw,
  chronos@tikzname/.code={%
    \chronos@creu@tikzname {prifdeitl}{#1}
  },
  enw/.forward to=/chronos/prif/chronos@tikzname,
  angor/.store in=\chronos@prifdeitl@angor,
  angor/.forward to=/tikz/anchor,
  at/.code={\coordinate (chronos@prifdeitl@at) at (#1);},
  cynnwys enw/.store in=\chronos@prifdeitl@cynnwys,
  llinellau teitl/.style={%
    /tikz/.cd,draw=chronos@prifliw,inner xsep=0pt,#1,%
    append after command={%
      (main title.north west)--(main title.north east) (main title.south west)%
      --(main title.south east)},draw=none},
%    \end{macrocode}
%^^A BEGIN /chronos/prif saesneg
%    \begin{macrocode}
  /chronos/main/.chronos search=prif,
  name/.forward to=/chronos/prif/enw,
  tag anchor/.forward to=/chronos/prif/angor,
  name content/.forward to=/chronos/prif/cynnwys enw,
  title lines/.forward to=/chronos/prif/llinellau teitl,
%    \end{macrocode}
%^^A END /chronos/prif saesneg
%^^A END /chronos/prif
%^^A BEGIN /chronos/hawlfraint
%    \begin{macrocode}
  /chronos/hawlfraint/.cd,
  enw/.store in=\chronos@hawlfraint@enw,
  chronos@tikzname/.code={%
    \chronos@creu@tikzname {hawlfraint}{#1}
  },
  enw/.forward to=/chronos/hawlfraint/chronos@tikzname,
  angor/.store in=\chronos@hawlfraint@angor,
  angor/.forward to=/tikz/anchor,
  at/.code={\coordinate (chronos@hawlfraint@at) at (#1);},
  awdur/.store in=\chronos@hawlfraint@awdur,
  blwyddyn/.store in=\chronos@hawlfraint@blwyddyn,
  cynnwys enw/.store in=\chronos@hawlfraint@cynnwys,
  cylchdroi/.store in=\chronos@hawlfraint@cylchdroi,
  notis/.code={\def\chronos@hawlfraint@notis##1##2{#1}\show\chronos@hawlfraint@notis},
  copyleft/.is if=chronos@copyleft,
  copyleft/.default=true,
%    \end{macrocode}
%^^A BEGIN /chronos/hawlfraint saesneg
%    \begin{macrocode}
  /chronos/copyright/.chronos search=hawlfraint,
  /chronos/copyleft/.chronos search=hawlfraint,
  author/.forward to=/chronos/hawlfraint/awdur,
  name/.forward to=/chronos/hawlfraint/enw,
  name content/.forward to=/chronos/hawlfraint/cynnwys enw,
  notice/.forward to=/chronos/hawlfraint/notis,
  rotate/.forward to=/chronos/hawlfraint/cylchdroi,
  tag anchor/.forward to=/chronos/hawlfraint/angor,
  year/.forward to=/chronos/hawlfraint/blwyddyn,
%    \end{macrocode}
%^^A END /chronos/hawlfraint saesneg
%^^A END /chronos/hawlfraint
%    \begin{macrocode}
  /chronos/.cd,
%    \end{macrocode}
%^^A BEGIN /chronos frâm, borders, cysylltwyr, llinellau, testunau etc.
%    \begin{macrocode}
  borders'/.code args={#1:#2:#3:#4:#5:#6}{%^^A penawdau:pen:de:gwaelod:chwith:allanol
    \chronos@border@penawdau=#1
    \chronos@border@pen=#2
    \chronos@border@de=#3
    \chronos@border@gwaelod=#4
    \chronos@border@chwith=#5
    \chronos@border@allanol=#6
  },
  borders'+/.code args={#1:#2:#3:#4:#5:#6}{%^^A penawdau:pen:de:gwaelod:chwith:allanol
    \advance\chronos@border@penawdau by #1 
    \advance\chronos@border@pen by #2 
    \advance\chronos@border@de by #3 
    \advance\chronos@border@gwaelod by #4 
    \advance\chronos@border@chwith by #5 
    \advance\chronos@border@allanol by #6 
  },
  borders'-/.code args={#1:#2:#3:#4:#5:#6}{%^^A penawdau:pen:de:gwaelod:chwith:allanol
    \advance\chronos@border@penawdau by -#1 
    \advance\chronos@border@pen by -#2 
    \advance\chronos@border@de by -#3 
    \advance\chronos@border@gwaelod by -#4 
    \advance\chronos@border@chwith by -#5 
    \advance\chronos@border@allanol by -#6 
  },
  cysylltwyr chronos={anchor=center,inner sep=0pt,outer sep=0pt},%^^A oedd cylch chronos
  cysylltwyr testun={anchor=center,inner sep=0pt,outer sep=0pt},%^^A oedd cylch
  prif gysylltwyr testun={},
  @llinell/.style={},
  testunau+={outer sep=0pt,text=#1!75!black},%^^A every eisiau ##
  cysylltiadau={draw=#1},
%    \end{macrocode}
%^^A END /chronos frâm, borders, cysylltwyr, llinellau, testunau etc.
%^^A BEGIN cynlluniau lliwiau
%    \begin{macrocode}
  cynllun lliwiau/.code={\csname chronos@lliwiau@#1\endcsname},
  colour scheme/.forward to=/chronos/cynllun lliwiau,
  color scheme/.forward to=/chronos/cynllun lliwiau,
  lliwiau cronoleg/.code={%
    \chronos@lliwiau@cronoleg
    \@ifpackageloaded{memoize}{%
      \mmzset{csname meaning to context={chronos@lliwiau@cronoleg}}%
    }{}%
  },
  lliwiau rhagosodedig/.code={\chronos@lliwiau@rhagosodedig},
%    \end{macrocode}
%^^A END cynlluniau lliwiau
%    \begin{macrocode}
}

%    \end{macrocode}
%^^A END allweddau PGF/TikZ >>>
%^^A BEGIN style cronoleg <<<
%    \begin{macrocode}
\pgfqkeys{/chronos}{%
  cronoleg/.style={% mewnol | internal
    /chronos/.cd,
    cronoleg/.meaning to context,
    cynllun lliwiau=cronoleg,
    byw/troi lliwiau=true,
    digwyddiad/troi lliwiau=true,
    parhad/troi lliwiau=true,
    theori/troi lliwiau=false,
    theori/lliw rhagosodedig=chronos@lliw@theori,
    digwyddiad/lliw rhagosodedig=chronos@prifliw!75!chronos@prifliw@cefndir,
    parhad/lliw rhagosodedig=chronos@prifliw!75!chronos@prifliw@cefndir,
    gwybodaeth/lliw rhagosodedig=chronos@lliw@gwybodaeth,
    cefndir=chronos@prifliw@cefndir,
    blaendir=chronos@prifliw,
    blynyddoedd yn unig,
    llinell amser={%
      timeline years=on line,
      llinell={chronos@lliw@cefndir@llinell, opacity=.8},
      ffont camau mawr=\normalfont\bfseries,
      ffont camau bach=\normalfont\bfseries\footnotesize,
      ffont cyfnodau=\normalfont\normalsize\bfseries,
      timeline year={text=chronos@lliw@llinell, align=center},
      timeline mark={draw=chronos@lliw@llinell, ultra thick, shorten >=1.5pt},
      timeline minor mark={draw=chronos@lliw@llinell, thick, shorten >=3pt},
      timeline height'=10mm,
      timeline border height'=2.5mm,
      width=235mm,
      cam blwyddyn fawr=500,
      cam blwyddyn fach=100,
      timeline border outer colour=chronos@prifliw@cefndir,
      timeline border inner colour=chronos@lliw@cefndir@llinell!80!chronos@borderouter,
      timeline border middle colour=chronos@lliw@cefndir@llinell!20!chronos@borderouter,
      timeline mark eras,
      timeline marks,
      minor years,
      llinell amser ar=foreground,
      border ar=background,
      start date={-500},
      end date=2050,
      timeline margin'=10pt,
      timeline era margin'=15pt,
    },
    timeline ce label={CE},
    timeline bce label={BCE},
    cysylltiadau={draw=##1, opacity=.75, thick},
    cysylltwyr testun={fill=##1, fill opacity=1, circle, minimum size=5pt, %
      anchor=center, inner sep=0pt, outer sep=0pt},
    cyffredin/cysylltiad/.style={draw=##1, opacity=.5, thick},
    every cysylltwyr chronos={fill=####1, opacity=.75, circle, %
      minimum size=2.5pt, anchor=center, inner sep=0pt, outer sep=0pt},
    cyffredin/testun/.style={outer xsep=0pt, rounded corners=2pt, thick, %
      text opacity=1, draw opacity=1, inner sep=2pt, fill opacity=.25,%
      font=\scshape\footnotesize},
    digwyddiad/cysylltiad={/chronos/cyffredin/cysylltiad=##1},
    byw/cysylltiad={/chronos/cyffredin/cysylltiad=##1, opacity=.75},
    parhad/cysylltiad={/chronos/cyffredin/cysylltiad=##1},
    theori/cysylltiad={thick, draw=chronos@prifliw, double=chronos@prifliw@cefndir},
%    \end{macrocode}
%^^A %     digwyddiad/lliwiau isod={chronos@prifliw!75!chronos@prifliw@cefndir},
%^^A %     digwyddiad/lliwiau uchod={chronos@prifliw!75!chronos@prifliw@cefndir},
%    \begin{macrocode}
    theori/cysylltwr testun={fill=chronos@prifliw@cefndir, circle, %
      minimum size=5pt, anchor=center, inner sep=0pt, outer sep=0pt, thick, %
      draw=chronos@prifliw},
    byw/testun={/chronos/cyffredin/testun, align=left, text=##1!50!black, %
      fill=##1, draw=##1},
%    \end{macrocode}
%^^A     every digwyddiad+={only text},% yn hawsach i toggle on na off felly paid ag analluogi fel rhagosodedig
%    \begin{macrocode}
    digwyddiad/testun={/chronos/cyffredin/testun, align=left, text=##1!50!black, %
      fill=##1, draw=##1},
    parhad/testun={/chronos/cyffredin/testun, align=left, text=##1!50!black, %
      fill=##1,  draw=##1},
    theori/testun={/chronos/cyffredin/testun, align=center, inner sep=3pt, %
      text=chronos@lliw@theori, fill=chronos@lliw@cefndir@theori, %
      fill opacity=.8, draw=chronos@prifliw, double=chronos@prifliw@cefndir, %
      font=\bfseries},
    byw/llinell={fill=##1, fill opacity=.25, draw=none},
    digwyddiad/llinell={draw=##1, draw opacity=.25, fill=none},
    parhad/llinell={fill=##1, fill opacity=.25, draw=none},
    llinell ar=main,
    cysylltiad ar=middle ground,
%    \end{macrocode}
%^^A     byw/lliwiau isod o clist={lliwiau_isod},
%^^A     byw/lliwiau uchod o clist={lliwiau_uchod},
%    \begin{macrocode}
    theori/cylchau/label={align=center, inner sep=0pt, outer sep=0pt,%
      font=\scriptsize\scshape, text=chronos@prifliw},
    every cylch cylch theori'={fill=chronos@prifliw, draw=chronos@prifliw, %
      thick, even odd rule, fill opacity=.8},
    every testun cylch theori'={decoration={text effects along path, text={##1}, %
        text effects/.cd, fit text to path, text=chronos@prifliw@cefndir, %
        characters={text along path, font=\scriptsize\scshape}}, decorate},
    theori/cylchau/labels=:,
    theori/cylchau/circle texts=:,
    theori/cylchau/meintiau'=15pt:9pt,
    gwybodaeth/label={/chronos/@amserau, font=\itshape\footnotesize, %
      anchor=north, yshift=-2.5pt},% oedd pethau
    gwybodaeth/testun={/chronos/cyffredin/testun, align=left, text=##1, %
      outer sep=0pt, fill=chronos@lliw@cefndir@gwybodaeth, draw opacity=.8, %
      text opacity=.8, font=\scriptsize, draw=chronos@prifliw},% oedd ee ? oedd testun ee?
    theori dash/.style={chronos@prifliw, opacity=.75, thick, densely dashed},
    theory dash/.link=/chronos/theori dash,
    amserau={align=center, anchor=base, inner sep=0pt, outer sep=0pt, %
      color=chronos@prifliw!75!chronos@prifliw@cefndir, opacity=.8, %
      font=\bfseries\itshape\footnotesize},
    amseraumawr={align=center, anchor=base, inner sep=0pt, outer sep=0pt, %
      color=chronos@prifliw, opacity=.8, font=\bfseries},
    prif/frame={inner sep=5pt, ultra thick, draw=chronos@prifliw, %
      double=chronos@prifliw@cefndir, fill=none},% oedd chronos@prifliw@cefndir
    prif/teitl={/chronos/prif/@frame, font=\Huge\bfseries, text=chronos@prifliw,%
      anchor=center, align=center, rounded corners=5pt},
    borders'=55pt:0pt:105pt:15pt:7.5pt:5pt,
    headings drops'=10pt:10pt:7.5pt,
    hawlfraint={font=\footnotesize\bfseries, inner sep=0pt, outer sep=0pt, %
      chronos@prifliw, fill=chronos@prifliw@cefndir},
%    \end{macrocode}
%^^A     hawlfraint/cylchdroi=90,
%^^A     hawlfraint/angor=west,
%    \begin{macrocode}
    llinellau={color=black!50, opacity=.5},
    lefelau=10:10,
    special date=none,
    ce year label={\textsc{ce}},
    bce year label={\textsc{bce}},
    testun yshift=10pt,
    frame uses bb=false,
    frame,
  },
}
%    \end{macrocode}
%^^A END style cronoleg >>>
%    \begin{macrocode}
\RequirePackage{chronos-lib-colschemes,chronos-lib-styles}
%    \end{macrocode}
%^^A BEGIN env y ddogfen <<<
% \begin{environment}{chronos}
%   Main environment.
%   Avoid \lpack{expl3} syntax here.
%    \begin{macrocode}
\NewDocumentEnvironment {chronos} { > { \TrimSpaces } O {} } 
{% https://tex.stackexchange.com/a/159856/ - Claudio Fiandrino
  \chronos@env@begin
  \begin{tikzpicture}[%
    align=center,
    anchor=mid,
    fixed point arithmetic,
    /chronos/.cd,
    prif/frame/.append code={\chronos@frametrue},
    prif/frame+/.append code={\chronos@frametrue},
    prif/frame'/.append code={\chronos@frametrue},
    #1,
    @@timeline@config@diwedd,
    @@timeline@config@dechrau,
    @@timeline@config@diwedd/.code={},
    @@timeline@config@dechrau/.code={},
    @@timeline@config,
    @@timeline@config/.code={},
    @timeline@config,
    @timeline@config/.code={},
    name prefix=\chronos@tikzprefix,
  ]%
%    \end{macrocode}
%^^A     \chronosshowpreset
%^^A     \chronosshowfeatures
%^^A %     
%^^A   \IfFreeF \bagpuss {%
%^^A     \chronosshowfeatures[digwyddiad]%
%^^A     \chronosshowfeatures
%^^A     \chronosshowfeatures[byw]
%^^A     \chronosshowfeatures[parhad]
%^^A     \chronosshowfeatures[theori]
%^^A     \chronosshowfeatures[gwybodaeth]}
%    \begin{macrocode}
  \IfBooleanExprT { \CSFreeBoolean \chronos@startyear || \CSFreeBoolean \chronos@endyear  }
    {%
      \PackageError{chronos}{%
        Missing start and/or end date for timeline.
        I will attempt to fathom the concept of a timeline without time, 
        but I predict unpredictable results}%
        {%
          You must specify both a start and end date. 
          If I try to start at the beginning or finish at the end, 
            I exceed TeX's maximum dimension. 
          Besides, what if time is cyclical? 
          My author didn't tell me how to draw a 3D timeline.}%
      \IfFreeT \chronos@startyear {\chronos@set@date{1800}{01}{01}{start}}%
      \IfFreeT \chronos@endyear {\chronos@set@date{2050}{12}{31}{end}}%
    }%  
    \ifnum\thechronos@startdate>\thechronos@enddate
      \PackageWarning{chronos}{%
        Sorry, but I cannot reverse time. 
        Perhaps you could ask a metaphysician? 
        Setting end to start and start to end}%
%    \end{macrocode}
% paid ag anghofio am awto-cywiro yn functions chronos re.\ blwyddyn sero
%
% don't forget about auto-correction in chronos functions re.\ year zero
%    \begin{macrocode}
      \setcounter{chronos@tempcnta}{\thechronos@startdate}%
      \setcounter{chronos@startdate}{\thechronos@enddate}%
      \setcounter{chronos@enddate}{\thechronos@tempcnta}%
      \let\chronos@tmpstartyear\chronos@startyear
      \let\chronos@tmpstartmonth\chronos@startmonth
      \let\chronos@tmpstartday\chronos@startday
      \let\chronos@startyear\chronos@endyear
      \let\chronos@startmonth\chronos@endmonth
      \let\chronos@startday\chronos@endday
      \let\chronos@endyear\chronos@tmpstartyear
      \let\chronos@endmonth\chronos@tmpstartmonth
      \let\chronos@endday\chronos@tmpstartday
    \fi
    \begin{scope}[/chronos/@style]
      \extractcolorspec{chronos@lliw@llinell}{\chronos@templlll}%^^A \show\chronos@templlll
      \extractcolorspec{chronos@lliw@cefndir@llinell}{\chronos@templlllc}%^^A \show\chronos@templlllc
      \extractcolorspec{white}{\chronos@templlw}%^^A \show\chronos@templlw
      \extractcolorspec{chronos@prifliw}{\chronos@templlpl}%^^A \show\chronos@templlpl
      \extractcolorspec{chronos@prifliw@cefndir}{\chronos@templlplc}%^^A \show\chronos@templlplc
      \ifchronos@yearsonline % BEGIN
        \chronos@if@gosodF{border}{\pgfqkeys{/chronos}{border ar=middle ground}}%
        \chronos@if@gosodF{llinell}{\pgfqkeys{/chronos}{llinell ar=middle ground}}%
        \chronos@if@gosodF{llinell amser}{\pgfqkeys{/chronos}{llinell amser ar=main}}%
        \chronos@if@gosodF{cysylltiad}{\pgfqkeys{/chronos}{cysylltiad ar=background}}%
%    \end{macrocode}
% rhag: llunio ar y border \textbar{} default: draw on the border
%    \begin{macrocode}
        \ifdim\chronos@llinell@yshift=\pi pt 
          \chronos@llinell@yshift=0pt %
        \fi
        \ifchronostimelinearrow
          \chronostimelinearrowfalse
          \PackageWarning{chronos}{%
            A timeline arrow requires a suitable off line style}
        \fi
      \else
        \chronos@if@gosodF{border}{\pgfqkeys{/chronos}{border ar=middle ground}}%
        \chronos@if@gosodF{llinell}{\pgfqkeys{/chronos}{llinell ar=main}}%
        \chronos@if@gosodF{llinell amser}{\pgfqkeys{/chronos}%
          {llinell amser ar=main}}%
        \chronos@if@gosodF{cysylltiad}{\pgfqkeys{/chronos}%
          {cysylltiad ar=background}}%
        \ifx\chronos@templlll\chronos@templlplc
          \ifx\chronos@templlll\chronos@templlw
            \colorlet{chronos@lliw@llinell}{chronos@prifliw}%
            \colorlet{chronos@lliw@cefndir@llinell}{chronos@prifliw@cefndir}%
          \fi
        \fi
      \fi
      \providecolor{chronos main colour}{named}{chronos@prifliw}%
      \providecolor{chronos main background colour}{named}%
        {chronos@prifliw@cefndir}%
      \providecolor{chronos main color}{named}{chronos@prifliw}%
      \providecolor{chronos main background color}{named}%
        {chronos@prifliw@cefndir}%
      \providecolor{chronos prifliw}{named}{chronos@prifliw}%
      \providecolor{chronos prifliw cefndir}{named}%
        {chronos@prifliw@cefndir}%
      \providecolor{chronos timeline foreground colour}{named}%
        {chronos@lliw@llinell}%
      \providecolor{chronos timeline background colour}{named}%
        {chronos@lliw@cefndir@llinell}%
      \providecolor{chronos timeline foreground color}{named}%
        {chronos@lliw@llinell}%
      \providecolor{chronos timeline background color}{named}%
        {chronos@lliw@cefndir@llinell}%
      \providecolor{chronos lliw llinell amser blaendir}{named}%
        {chronos@lliw@llinell}%
      \providecolor{chronos lliw llinell amser cefndir}{named}%
        {chronos@lliw@cefndir@llinell}%
      \providecolor{chronos timeline border inner colour}{named}%
        {chronos@borderinner}%
      \providecolor{chronos timeline border outer colour}{named}%
        {chronos@borderouter}%
      \providecolor{chronos timeline border middle colour}{named}%
        {chronos@bordermiddle}%
      \providecolor{chronos timeline border inner color}{named}
        {chronos@borderinner}%
      \providecolor{chronos timeline border outer color}{named}
        {chronos@borderouter}%
      \providecolor{chronos timeline border middle color}{named}
        {chronos@bordermiddle}%
      \providecolor{chronos lliw llinell amser border mewnol}{named}
        {chronos@borderinner}%
      \providecolor{chronos lliw llinell amser border allanol}{named}
        {chronos@borderouter}%
      \providecolor{chronos lliw llinell amser border canol}{named}
        {chronos@bordermiddle}%
      \colorlet{chronos current tag colour}{chronos@prifliw}%
      \colorlet{chronos current tag color}{chronos@prifliw}%
      \ifdim\chronos@height=\pi pt %^^A BEGIN
        \PackageInfo{chronos}{Timeline height unset. 
          Guessing an appropriate value.}%
        \ifchronos@yearsonline 
          \chronos@height=10mm
          \ifdim\chronos@borderheight=\pi pt
            \PackageInfo{chronos}{%
              Timeline border height unset. Guessing an appropriate value.}%
            \chronos@borderheight=2.5mm
          \fi
        \else % off line
          \ifdim\chronos@borderheight=\pi pt
            \PackageInfo{chronos}{%
              Timeline border height unset. Guessing an appropriate value.}%
            \chronos@height=1pt
            \chronos@borderheight=0pt
          \else
            \pgfmathsetlength \chronos@height {4*\chronos@borderheight}%
          \fi
        \fi
      \fi % END \ifdim\chronos@height=\pi pt
      \ifdim\chronos@borderheight=\pi pt %^^A angen height am hwn ; angen hwn am llinell yshift
        \PackageInfo{chronos}{%
          Timeline border height unset. Guessing an appropriate value.}%
        \ifchronos@yearsonline
          \pgfmathsetlength \chronos@borderheight {\chronos@height/4}
        \else
          \chronos@borderheight=0pt
        \fi
      \fi
      \ifchronos@yearsonline %^^A BEGIN \ifchronos@yearsonline
      \else
        \pgfqkeys{/chronos/timeline}{do timeline arrow}%
        \ifdim\chronos@llinell@yshift=\pi pt %^^A BEGIN
          \ifdim\chronos@height<5pt %^^A BEGIN
            \ifdim\chronos@borderheight<.5pt %^^A BEGIN
              \ifchronos@blynyddoeddisod%^^A BEGIN
                \chronos@llinell@yshift=5pt
              \else
                \ifchronos@blynyddoedduchod%^^A BEGIN
                  \chronos@llinell@yshift=-5pt
                \fi %^^A END \ifchronos@blynyddoedduchod
              \fi %^^A END \ifchronos@blynyddoeddisod
            \else
              \ifchronos@blynyddoeddisod %^^A BEGIN
                \chronos@llinell@yshift=\chronos@borderheight
              \else
                \ifchronos@blynyddoedduchod %^^A BEGIN
                  \chronos@llinell@yshift=-\chronos@borderheight
                \fi %^^A END \ifchronos@blynyddoedduchod
              \fi %^^A END % \ifchronos@blynyddoeddisod
            \fi %^^A END \ifdim\chronos@borderheight<.5pt
          \else
            \ifchronos@blynyddoeddisod %^^A BEGIN
              \chronos@llinell@yshift=2pt
            \else
              \ifchronos@blynyddoedduchod %^^A BEGIN
                \chronos@llinell@yshift=-2pt
              \fi %^^A END \ifchronos@blynyddoedduchod
            \fi %^^A END  \ifchronos@blynyddoeddisod
          \fi %^^A END \ifdim\chronos@height<5pt 
        \fi %^^A END \ifdim\chronos@llinell@yshift=\pi pt
      \fi %^^A END ifchronos@yearsonline
      \chronos@llinell@yshift@base=\chronos@llinell@yshift
      \ifx\chronos@templlpl\chronos@templlplc \PackageWarning{chronos}{%
        You've set the main colour and the main background colour to the same.}\fi
      \ifnum\chronos@startyear=0\relax
        \chronos@yearzerotrue
      \else
        \ifnum\chronos@endyear=0\relax
          \chronos@yearzerotrue
        \fi
      \fi
      \IfExistT \chronos@camrhaniadau {\chronos@if@gosodF{@bare}{%
          \ifnum\chronos@camrhaniadau>1
            \chronos@marks@baretrue
          \fi
        }%
      }%
      \setlength\chronos@diwedd@diwedd{0pt}%
      \setlength\chronos@dechrau@dechrau{0pt}%
      \chronos@if@gosodF{markeras}{%
        \ifnum\chronos@startyear<0
          \ifnum\chronos@endyear>0
            \chronos@markerastrue
          \fi
        \fi
      }% \chronos@if@gosodF{markeras}
      \ifchronos@markeras % BEGIN
%    \end{macrocode}
% angen côd Martin Scharrer uchod - needs the above code by Martin Scharrer
%
% Rmano: \url{https://chat.stackexchange.com/transcript/message/64273912#64273912}
%    \begin{macrocode}
        \ifnum\chronos@endyear>0 
          \settowidth\chronos@diwedd@diwedd{\chronos@ffont@cyfnodau\chronos@ce}%
          \addtolength{\chronos@diwedd@diwedd}{\chronos@eramargin}%
        \else
          \let\chronos@ce\relax
        \fi
%    \end{macrocode}
% Rmano: \url{https://chat.stackexchange.com/transcript/message/64273912#64273912}
%    \begin{macrocode}
        \ifnum\chronos@startyear<0 
          \settowidth\chronos@dechrau@dechrau{\chronos@ffont@cyfnodau\chronos@bce}%
          \addtolength{\chronos@dechrau@dechrau}{\chronos@eramargin}%
        \else
          \let\chronos@bce\relax
        \fi
      \fi % END \ifchronos@markeras
%    \end{macrocode}
% cofia!! \cs{chronos@set@date} a ffrindiau'n awto-cywiro am flwyddyn sero!!
%
% remember!! \cs{chronos@set@date} and friends auto-correct for year zero!!
%
% cofia! ti'n defnyddio **pgfcalendar** yn lle blynyddoedd nawr!!
%
% remember! you use \lpack{pgfcalendar} in place of years now!!
% (but I have no idea what I meant by this \dots)
%    \begin{macrocode}
      \pgfmathsetmacro\chronos@unit{%
        (\chronos@width-2*\chronos@timelinemargin-\chronos@dechrau@dechrau-%
        \chronos@diwedd@diwedd)/(\thechronos@enddate-\thechronos@startdate)%
      }%
%    \end{macrocode}
%^^A      \chronos@timelineunitlength \dimexpr\chronos@unit pt\relax% using this truncates the dimension and leads to visible inaccuracies e.g. 0.0003pt vs. 0.00031~pt makes a difference over 5,000 units or so!
%    \begin{macrocode}
      \pgfmathsetmacro{\chronos@amser@diwedd}{%
        (\thechronos@enddate-\thechronos@startdate)*\chronos@unit}%
      \addtolength{\chronos@dechrau@dechrau}{\chronos@timelinemargin}%
      \addtolength{\chronos@diwedd@diwedd}{\chronos@timelinemargin}%
      \path (0pt,0pt) ++(-\chronos@dechrau@dechrau,0pt) coordinate (chronos pre);%^^A oedd chronos@dechrau
      \path (\chronos@amser@diwedd pt,0pt) ++(\chronos@diwedd@diwedd,0pt) 
        coordinate (chronos post);%^^A oedd chronos@diwedd
      \chronos@inner@halfheight \dimexpr0.5\dimexpr\chronos@height\relax%
      \chronos@outer@halfheight \dimexpr\chronos@inner@halfheight+\dimexpr\chronos@borderheight\relax%
      \coordinate (chronos top) at (0pt,\chronos@inner@halfheight);%^^A oedd chronos@height
      \coordinate (chronos base) at (0pt,-\chronos@inner@halfheight);%^^A oedd chronos@depth
      \coordinate (chronos foot) at (0pt,-\chronos@outer@halfheight);
      \coordinate (chronos head) at (0pt,\chronos@outer@halfheight);
%    \end{macrocode}
% chronos pre-top, chronos post-top, chronos pre-base, chronos post-base
%    \begin{macrocode}
      \foreach \i/\j in {%
        pre/top,post/top,pre/base,post/base,pre/head,post/head,pre/foot,post/foot%
      } \coordinate (chronos \i-\j) at (chronos \i |- chronos \j);
      \coordinate (chronos start) at (0pt,0pt);% dal yn gywir?
      \coordinate (chronos origin) at (chronos start);% newid isod efaillai
      \coordinate (chronos end) at (\chronos@amser@diwedd pt,0pt);
      \coordinate (chronos mid) at ($(chronos pre)!.5!(chronos post)$);
      \coordinate (chronos mid-time) at ($(chronos start)!.5!(chronos end)$);
%    \end{macrocode}
% styles which rotate labels need this earlier; reset here in case altered
%    \begin{macrocode}
      \let\timelineht\chronos@height
      \begin{scope}[/chronos/chronos@border@haenen]
        \ifdim\chronos@borderheight>0pt
          \path [%
            top color=chronos@borderouter,%
            bottom color=chronos@borderinner,%
            middle color=chronos@bordermiddle,%
            /chronos/llinell amser/timeline@border%
          ] (chronos pre-top) rectangle (chronos post-head);
          \path [%
            bottom color=chronos@borderouter,%
            top color=chronos@borderinner,%
            middle color=chronos@bordermiddle,%
            /chronos/llinell amser/timeline@border%
          ] (chronos post-base) rectangle (chronos pre-foot);
        \fi
      \end{scope}% [/chronos/chronos@border@haenen]
      \begin{scope}[/chronos/chronos@llinell amser@haenen]
        \ifchronos@yearsonline
%    \end{macrocode}
% fill the timeline if putting the years etc. onto it
%    \begin{macrocode}
          \fill [%
            chronos@lliw@cefndir@llinell,%
            /chronos/llinell amser/timeline@line%
          ] (chronos pre-top) rectangle (chronos post-base);
%    \end{macrocode}
%^^A           \draw [chronos@lliw@cefndir@llinell,/chronos/llinell amser/timeline@line] (chronos pre-top) -- (chronos post-top) (chronos post-base) -- (chronos pre-base);
%    \begin{macrocode}
        \else
%    \end{macrocode}
% fel arall, draw
%    \begin{macrocode}
          \draw [%
            chronos@lliw@llinell,%
            line width=\chronos@height,%
            /chronos/llinell amser/timeline@line%
          ] (chronos pre) -- (chronos post);
%    \end{macrocode}
% gweler ateb Qrrbrbirlbel: \url{https://tex.stackexchange.com/a/701524/} i fy nghwestiwn: \url{https://tex.stackexchange.com/q/701518/}
%    \begin{macrocode}
          \coordinate (tmpa) at (current bounding box.north);
          \coordinate (tmpb) at (current bounding box.south);
          \pgfresetboundingbox
          \path (chronos pre) -- (chronos post) -- (tmpa) -- (tmpb);
        \fi % \ifchronos@yearsonline
%    \end{macrocode}
% prif label - main label
% lau cyfnodau - eras
%    \begin{macrocode}
        \ifchronos@markeras % BEGIN
          \ifchronos@yearsonline
            \node (chronos bce) [%
              text=chronos@lliw@llinell,%
              font=\chronos@ffont@cyfnodau,%
              inner xsep=0pt,%
              xshift=-\chronos@eramargin,%
              anchor=east%
            ] at (chronos start) {\chronos@bce};
            \node (chronos ce) [%
              text=chronos@lliw@llinell,%
              font=\chronos@ffont@cyfnodau,%
              inner xsep=0pt,%
              xshift=\chronos@eramargin,%
              anchor=west%
            ] at (chronos end) {\chronos@ce};
          \else 
            \settowidth \chronos@templgthc {\chronos@ffont@cyfnodau\chronos@bce}%
            \node (chronos bce) [%
              /chronos/llinell amser/timeline@years,%
              /chronos/llinell amser/timeline@year@off@line,%
              text=chronos@lliw@llinell,%
              font=\chronos@ffont@cyfnodau,%
              inner xsep=0pt,%
              xshift=-\chronos@eramargin-.5\chronos@templgthc%
            ] at (chronos start) {\chronos@bce};
            \settowidth \chronos@templgthc {\chronos@ffont@cyfnodau\chronos@ce}%
            \node (chronos ce) [%
              /chronos/llinell amser/timeline@years,%
              /chronos/llinell amser/timeline@year@off@line,%
              text=chronos@lliw@llinell,%
              font=\chronos@ffont@cyfnodau,%
              inner xsep=0pt,%
              xshift=\chronos@eramargin+.5\chronos@templgthc%
            ] at (chronos end) {\chronos@ce};
          \fi
        \fi % END \ifchronos@markeras
        \ifchronos@timeline@showyears % BEGIN
          \pgfmathsetcounter{chronos@startyear}{\chronos@startyear}%
          \pgfmathsetcounter{chronos@startmarkyear}{\chronos@startyear}%
          \pgfmathsetcounter{chronos@endyear}{\chronos@endyear}%
          \def\tempa{none}%
          \setcounter{chronos@tempcnta}{\value{chronos@endyear}}%
          \stepcounter{chronos@tempcnta}%
          \addtocounter{chronos@tempcnta}{-\value{chronos@startyear}}%
          \IfExistTF \chronos@cam@blwyddyn@fawr {%
            \IfExistTF \chronos@cam@blwyddyn@fach {%
              \ifnum\chronos@cam@blwyddyn@fach>\chronos@cam@blwyddyn@fawr
                \def\chronos@cam@blwyddyn@fach{0}%
                \PackageWarning{chronos}{Setting minor step year to zero}%
              \else
                \IfBooleanExprT {%
                  (\IntCompareBoolean {\chronos@cam@blwyddyn@fach} > {0}) && 
                  ! (\LegacyBoolean {chronos@minoryears}) && 
                  ! (\LegacyBoolean {chronos@marks@minor}) && 
                  (\LegacyBoolean {chronos@marks@bare})
                }{%
                  \PackageWarning{chronos}{%
                    Setting minor step year to zero so your marks are evenly spaced%
                  }%
                  \def\chronos@cam@blwyddyn@fach{0}%
                }%
              \fi
            }{\def\chronos@cam@blwyddyn@fach{0}}%
          }{%
            \IfExistTF \chronos@cam@blwyddyn@fach {%
              \let\chronos@cam@blwyddyn@fawr\chronos@cam@blwyddyn@fach
              \def\chronos@cam@blwyddyn@fach{0}%
              \PackageWarning{chronos}{%
                Using minor step year as step year and setting minor step %
                  year to zero%
              }%
            }{% 
              \PackageWarning{chronos}{%
                You have not specified how frequently years should be marked %
                  on the timeline. 
                Guessing appropriate values. 
                Set step major year and/or step minor year to specify%
              }%
              \ifnum\value{chronos@tempcnta}>1500
                \def\chronos@cam@blwyddyn@fawr{500}%
                \def\chronos@cam@blwyddyn@fach{100}%
                \else\ifnum\value{chronos@tempcnta}>1000
                  \def\chronos@cam@blwyddyn@fawr{250}%
                  \def\chronos@cam@blwyddyn@fach{50}%
                  \else\ifnum\value{chronos@tempcnta}>300
                    \def\chronos@cam@blwyddyn@fawr{100}%
                    \def\chronos@cam@blwyddyn@fach{50}%
                    \else\ifnum\value{chronos@tempcnta}>150
                      \def\chronos@cam@blwyddyn@fawr{100}%
                      \def\chronos@cam@blwyddyn@fach{25}%
                      \else\ifnum\value{chronos@tempcnta}>100
                        \def\chronos@cam@blwyddyn@fawr{50}%
                        \def\chronos@cam@blwyddyn@fach{10}%
                        \else\ifnum\value{chronos@tempcnta}>50
                          \def\chronos@cam@blwyddyn@fawr{20}%
                          \def\chronos@cam@blwyddyn@fach{10}%
                          \else\ifnum\value{chronos@tempcnta}>20
                            \def\chronos@cam@blwyddyn@fawr{10}%
                            \def\chronos@cam@blwyddyn@fach{2}%
                            \else\ifnum\value{chronos@tempcnta}>10
                              \def\chronos@cam@blwyddyn@fawr{5}%
                              \def\chronos@cam@blwyddyn@fach{1}%
                              \else\def\chronos@cam@blwyddyn@fawr{1}%
                              \def\chronos@cam@blwyddyn@fach{0}%
                            \fi % >10
                          \fi % >20
                        \fi % >50
                      \fi % > 100
                    \fi % > 150
                  \fi % >300
                \fi % >1000
              \fi % >1500
            }%
          }% \IfExistTF \chronos@cam@blwyddyn@fawr
          \chronos@if@gosodF{markateraswitch}{%
            \ifnum\chronos@cam@blwyddyn@fach=1
              \chronos@markateraswitchfalse
            \else
              \ifnum\chronos@cam@blwyddyn@fawr=1
                \chronos@markateraswitchfalse
              \else
                \chronos@markateraswitchtrue
              \fi
            \fi
          }%
          \ifnum\chronos@cam@blwyddyn@fach=0 
            \let\chronos@tempv\chronos@cam@blwyddyn@fawr
          \else 
              \let\chronos@tempv\chronos@cam@blwyddyn@fach 
          \fi
          \IfExistF \chronos@camrhaniadau {%^^A rhaid \chronos@marks@baretrue o achos y côd uchod
            \ifnum\value{chronos@tempcnta}<5
              \chronos@marks@baretrue
              \PackageInfo{chronos}{%
                I'm guessing you want bare marks on your timeline. 
                If I'm wrong, specify step divisions=0 to override my decision}%
              \ifnum\value{chronos@tempcnta}>2
                \def\chronos@camrhaniadau{4}%
              \else
                \ifnum\value{chronos@tempcnta}>1
                  \def\chronos@camrhaniadau{6}%
                \else
                  \def\chronos@camrhaniadau{12}%
                \fi % >1
              \fi % >2
            \else
              \ifchronos@marks@bare\relax
              \else
                \chronos@marks@barefalse
                \PackageInfo{chronos}{%
                  I'm guessing you don't want bare marks on your timeline. 
                  If I'm wrong, specify step divisions to override my decision}%
              \fi
            \fi % <5
          }% \chronos@camrhaniadau
          \ifchronos@marks@bare
            \IfExistF \chronos@camrhaniadau {%
              \PackageInfo{chronos}{%
                You have requested bare marks but not specified how many. 
                Guessing 4 per minor step. Set step divisions to specify}%
              \def\chronos@camrhaniadau{4}%
            }% \IfExistT \chronos@camrhaniadau
          \fi % \ifchronos@marks@bare
          \IfFreeTF \chronos@stepfrom {%
            \ifnum\thechronos@startyear=\thechronos@endyear
            \else
              \def\tempa{01}%
              \ifx\chronos@startmonth\tempa
                \ifx\chronos@startday\tempa
                \else
                  \stepcounter{chronos@startmarkyear}%
                \fi % \ifx\chronos@startday\tempa
              \else
                \stepcounter{chronos@startmarkyear}%
              \fi % \ifx\chronos@startmonth\tempa
            \fi % \ifnum\thechronos@startyear=\thechronos@endyear
            \pgfmathsetmacro\chronos@tempremainder{%
              int(mod(\thechronos@startmarkyear,\chronos@tempv))}%
            \ifnum\chronos@tempremainder=0\relax
            \else
              \IfBooleanExprTF {%
                ! (\LegacyBoolean{chronos@yearzero}) && 
                (\IntCompareBoolean{\thechronos@startmarkyear}{=}{1}) %
              }{%
                \setcounter{chronos@startmarkyear}{0}% => 1 fel chronos@startmarkyear
              }{%
                \ifnum\chronos@tempremainder<0
                  \pgfmathsetcounter{chronos@startmarkyear}{%
                    int(\thechronos@startmarkyear-\chronos@tempremainder)}%
                \else
                  \pgfmathparse{%
                    int(\thechronos@startmarkyear-\chronos@tempremainder+\chronos@tempv)%
                  }%
                  \ifnum\pgfmathresult>\thechronos@endyear
                    \PackageWarning{chronos}{Ignoring steps}%
                  \else
                    \setcounter{chronos@startmarkyear}{\pgfmathresult}%
                  \fi
                \fi
              }%
            \fi
          }{%
            \pgfmathsetcounter{chronos@startmarkyear}{\chronos@stepfrom}%
            \pgfmathparse{int(mod(\thechronos@startmarkyear,\chronos@tempv))}%
            \ifnum\pgfmathresult=0\relax
            \else
              \PackageWarning{chronos}{%
                You have explicitly requested years marked on your timeline %
                which are not modulo the steps you have specified. 
                I'm setting the year format to show full years, which should %
                make the result a bit more intelligible.%
              }%
              \chronos@setminoryearformat{!Y}%
            \fi
          }% \IfFreeTF \chronos@stepfrom
          \ifnum\chronos@cam@blwyddyn@fach=0
            \pgfmathsetmacro\chronos@nextstep{%
              int(((\thechronos@startmarkyear+\chronos@cam@blwyddyn@fawr)>\thechronos@endyear) 
              ? \thechronos@endyear : 
              (\thechronos@startmarkyear+\chronos@cam@blwyddyn@fawr))%
            }%
          \else
            \pgfmathsetmacro\chronos@nextstep{%
              int(((\thechronos@startmarkyear+\chronos@cam@blwyddyn@fach)>\thechronos@endyear) 
              ? \thechronos@endyear : 
              (\thechronos@startmarkyear+\chronos@cam@blwyddyn@fach))%
            }%
          \fi
          \chronos@global@clear@to@clist{tmpa}{}%
          \IfExistT \chronos@camrhaniadau 
            {\pgfmathsetmacro \chronos@tempml{int(\chronos@camrhaniadau-1)}}%
          \ifchronos@yearzero
            \setcounter{chronos@tempcnta}{1}
          \else
            \setcounter{chronos@tempcnta}{0}%
          \fi
          \IfBooleanExprTF {%
             (\IntCompareBoolean{\chronos@nextstep}{=}{\thechronos@startmarkyear})
             || !  (\IntCompareBoolean{\chronos@nextstep}{<}{\thechronos@endyear}) 
             || ( (  (\IntCompareBoolean{\chronos@nextstep}{=}{0}) ||  
             (\IntCompareBoolean{\thechronos@startmarkyear}{=}{0}) ) &&  
             (\IntCompareBoolean{\thechronos@startmarkyear}{<}{-\thechronos@endyear}) 
             && ! \LegacyBoolean {chronos@yearzero} )
          }{%^^A osgoi infinite loop yn pgf \foreach isod
            \setcounter{chronos@tempcntb}{\thechronos@endyear}%
            \addtocounter{chronos@tempcntb}{-\thechronos@startyear}%
            \IfBooleanExprT {%
              ! \LegacyBoolean {chronos@yearzero} &&  
              (\IntCompareBoolean{\thechronos@startmarkyear}{>}{-\thechronos@endyear}) 
              &&   (  (\IntCompareBoolean{\chronos@nextstep}{=}{0}) ||  
              (\IntCompareBoolean{\thechronos@startmarkyear}{=}{0}) )
            } {\addtocounter{chronos@tempcntb}{-1}}%
            \ifnum\thechronos@tempcntb<2
              \IfExistTF \chronos@camrhaniadau 
              {%
                \pgfmathparse{int(mod(12,\chronos@camrhaniadau))}%
                \ifnum\pgfmathresult=0\relax
                \else
                  \PackageWarning{%
                    Since your timeline spans fewer than two years, %
                    step divisions must be a factor of 12. 
                    I will use 4 if you requested 5 and 6 otherwise}%
                  \ifnum\pgfmathresult=5
                    \def\chronos@camrhaniadau{4}%
                  \else
                    \ifnum\pgfmathresult>6
                      \def\chronos@camrhaniadau{6}%
                    \fi % \fnum\pgfmathresult>6 hynny yw 7,8,9,10,11
                  \fi % \ifnum\pgfmathresult=5
                \fi % \ifnum\pgfmathresult=0
                \setcounter{chronos@tempcntb}{\chronos@startmonth}%
                \ifnum\chronos@startday>1 \stepcounter{chronos@tempcntb}\fi
                \edef\chronos@tmpstartmonth{\thechronos@tempcntb}%
                \IfBooleanExprF {%
                  (\IntCompareBoolean{\chronos@tmpstartmonth}{=}{\chronos@endmonth}) 
                  && 
                  (\IntCompareBoolean{\thechronos@startyear}{=}{\thechronos@endyear})
                }
                {%
                  \pgfmathsetcounter{chronos@tempcntc}{int{12/\chronos@camrhaniadau}}%
                  \addtocounter{chronos@tempcntb}{\thechronos@tempcntc}%
                  \ifnum\thechronos@tempcntb>11
                    \edef\chronos@tempu{\chronos@tmpstartmonth,12}%
                  \else
                    \edef\chronos@tempu{%
                      \chronos@tmpstartmonth,\thechronos@tempcntb,...,12}%
                  \fi
                  \foreach \m [expand list] in {\chronos@tempu}%
                  {%
                    \chronos@set@date {\thechronos@startyear}{\m}{01}{tempa}%
                    \ifnum\thechronos@tempadate>\thechronos@enddate
                      \breakforeach
                    \else
                      \ifnum\m=1
                        \chronos@global@to@clist@star@append{tmpa}{%
                          \thechronos@tempadate/\thechronos@startyear/\thechronos@startyear%
                        }%
                      \else
                        \chronos@global@to@clist@star@append{tmpa}{%
                          \thechronos@tempadate/-5000/\thechronos@startyear%
                        }%
                      \fi % \m=1
                    \fi % \thechronos@tempadate>\thechronos@enddate
                  }% \foreach \m in {\chronos@tmpstartmonth,...,12}
                  \ifnum\thechronos@startyear<\thechronos@endyear
                    \stepcounter{chronos@tempcntc}%
                    \ifnum\thechronos@tempcntc<\chronos@endmonth
                      \edef\chronos@tempu{1,\thechronos@tempcntc,...,\chronos@endmonth}%
                    \else
                      \edef\chronos@tempu{1,\thechronos@tempcntc}%
                    \fi
                    \foreach \m [expand list] in {\chronos@tempu} %^^A {1,...,\chronos@endmonth}
                    {%
                      \chronos@set@date {\thechronos@endyear}{\m}{01}{tempa}%^^A awto-cywiro am flwyddyn sero
                      \ifnum\thechronos@tempadate>\thechronos@enddate
                        \breakforeach
                      \else
                        \ifnum\m=1
                          \chronos@global@to@clist@star@append{tmpa}{%
                            \thechronos@tempadate/\thechronos@endyear/\thechronos@endyear%
                          }%
                        \else
                          \chronos@global@to@clist@star@append{tmpa}{%
                            \thechronos@tempadate/-5000/\thechronos@endyear%
                          }%
                        \fi %^^A \m=1
                      \fi %^^A \thechronos@tempadate>\thechronos@enddate
                    }%^^A \foreach \m in {1,...,\chronos@endmonth}
                  \fi % \thechronos@startyear<\thechronos@endyear
                  }%^^A \ifboolexpr { test {\ifnum\thechronos@tmpstartmonth=\thechronos@endmonth} and test {\ifnum\thechronos@startyear=\thechronos@endyear} }
              }{%^^A \IfExistTF \chronos@camrhaniadau F
                \chronos@global@to@clist@star@append{tmpa}{%
                  \thechronos@startdate/\thechronos@startmarkyear/\thechronos@startmarkyear,%
                  \thechronos@enddate/\thechronos@endyear/\thechronos@endyear%
                }%
              }%^^A \IfExistTF \chronos@camrhaniadau
              \chronos@marks@barefalse
            \else
              \foreach \b [%
                evaluate=\b as \i using {%
                  ((\b==0)&&(\thechronos@tempcnta==0)) ? 1 : int(\b)}%
              ] in {\thechronos@startmarkyear,\thechronos@endyear} {%
                \chronos@set@date{\i}{01}{01}{year}%^^A awto-cywiro am flwyddyn sero
                \chronos@global@to@clist@star@append{tmpa}{\thechronos@yeardate/\b/\i}%
              }% 
            \fi % \ifnum\thechronos@tempcntb<2
          }{%
            \foreach \b [%
              evaluate=\b as \i using {%
                ((\b==0)&&(\thechronos@tempcnta==0)) ? 1 : int(\b)}%
            ] in {%
              \thechronos@startmarkyear,\chronos@nextstep,...,\thechronos@endyear%
            } {%
              \chronos@set@date{\i}{01}{01}{year}% awto-cywiro am flwyddyn sero
              \chronos@global@to@clist@star@append{tmpa}{\thechronos@yeardate/\b/\i}%
            }% 
          }%^^A \ifboolexpr { test {\ifnumcomp{\chronos@nextstep}{=}{\thechronos@startyear}} or test {\ifnumcomp{\chronos@nextstep}{=}{\thechronos@endyear}} }
%    \end{macrocode}
%^^A           \IfFreeF \bagpuss { \show\chronos@camrhaniadau \ifchronos@marks@bare\show\mebare\else\show\meclothed\fi \chronosshowpreset}
%    \begin{macrocode}
          \foreach \d/\b/\chronosyeari [%
            expand list,%
            remember=\chronosyeari as \ilast (initially \pi),%
            remember=\d as \dlast (initially \pi)%
          ] in {\chronos@global@from@clist{tmpa}}
          {% BEGIN \foreach \b ...
            \ifnum\d=\dlast\relax % BEGIN
            \else
              \pgfmathsetmacro\chronos@tempa{(\d-\thechronos@startdate)*\chronos@unit}%
              \coordinate (chronos date \d) at (\chronos@tempa pt,0pt);
              \pgfqkeys{/chronos}{% defnyddio am nodau noeth beth bynnag ac am marciau cyffredinol os y llinell amser yn fyr
                temp@on/.style={/chronos/llinell amser/timeline@minor@mark@on@line},
                temp@off/.style={/chronos/llinell amser/timeline@minor@mark@off@line},
              }%    
              \ifnum\dlast=\pi
                \let\chronos@tempff\chronos@ffont@camaubach
                \ifchronos@yearsonline
                \node (chronos phantom year) [%
                  rotate around/.style={},%
                  rotate/.style={},%
                  /chronos/llinell amser/timeline@years,%
                  /chronos/llinell amser/timeline@year@on@line,%
                  font=\chronos@tempff%
                ] at (chronos start) {\phantom{1}};
                \else
                \node (chronos phantom year) [%
                  rotate around/.style={},%
                  rotate/.style={},%
                  /chronos/llinell amser/timeline@years,%
                  /chronos/llinell amser/timeline@year@off@line,%
                  font=\chronos@tempff,%
                  fill=none%
                ] at (chronos start) 
                  {\phantom{\chronos@showyear[\chronos@minoryearformat]{1}}};
                \fi
              \fi % \ifnum\dlast=\pi
              \ifnum\b=-5000
                \ifchronos@yearsonline
                  \path [/chronos/temp@on] 
                    (chronos phantom year.south -| chronos date \d) -- 
                    (chronos phantom year.north -| chronos date \d);
                \else
                  \path [/chronos/temp@off] (chronos date \d)  -- 
                    ( chronos date \d |- chronos phantom year.\chronos@timelineyearsanchor) 
                    ;
                \fi
              \else % \ifnum\b=-5000
                \coordinate (chronos year \chronosyeari) at (\chronos@tempa pt,0pt);
                \ifnum\b=\thechronos@startmarkyear 
                  \xdef\chronos@firstmarkedyeardate{\d}%
                  \coordinate (chronos first marked year) at (chronos year \chronosyeari);
                  \ifnum\chronosyeari=0
                    \coordinate (chronos origin) at (\chronos@tempa pt,0pt);
                  \fi
                \else
                  \ifnum\chronosyeari=1
                    \ifchronos@yearzero\relax
                    \else
                      \coordinate (chronos origin) at (\chronos@tempa pt,0pt);
%    \end{macrocode}
% make \cs{foreach} loops work straightforwardly (not used in main code)
%    \begin{macrocode}
                      \coordinate (chronos year 0) at (chronos year 1);
                    \fi % \ifchronos@yearzero
                  \fi % \ifnum\chronosyeari=1
                \fi % \ifnum\b=\thechronos@startmarkyear
                \ifnum\b=\chronos@nextstep
                  \ifchronos@marks@bare
                    \pgfmathsetmacro\chronos@tempg{%
                      ((\d-\chronos@firstmarkedyeardate)*\chronos@unit)/\chronos@camrhaniadau%
                    }%
                    \global\let\chronos@tempg\chronos@tempg
                  \fi
                \fi % \ifnum\b=\chronos@nextstep
                \ifnum\chronos@cam@blwyddyn@fach=0
                  \chronos@cam@modtrue
                \else
                  \pgfmathparse{int(mod(\chronosyeari,\chronos@cam@blwyddyn@fawr))}%
                  \ifnum\pgfmathresult=0\relax
                    \chronos@cam@modtrue
                  \else
                    \IfBooleanExprT {%
                      ! \LegacyBoolean {chronos@yearzero} && 
                      \IntCompareBoolean {\chronosyeari}={1}
                    }{%
                      \pgfmathparse{int(mod((\chronosyeari-1),\chronos@cam@blwyddyn@fawr))}%
                      \ifnum\pgfmathresult=0\relax
                        \chronos@cam@modtrue
                      \fi
                    }%
                  \fi % \ifnum\pgfmathresult=0
                \fi % \ifnum\chronos@cam@blwyddyn@fach=0
                \ifchronos@cam@mod
                  \pgfqkeys{/chronos}{%
                    temp@on/.style={%
                      /chronos/llinell amser/timeline@mark@on@line},
                    temp@off/.style={%
                      /chronos/llinell amser/timeline@mark@off@line},
                  }%
                  \let\chronos@tempff\chronos@ffont@camaumawr
                  \def\chronos@temph{}%
                \else
                  \pgfqkeys{/chronos}{%
                    temp@on/.style={%
                      /chronos/llinell amser/timeline@minor@mark@on@line},
                    temp@off/.style={%
                      /chronos/llinell amser/timeline@minor@mark@off@line},
                  }%
                  \let\chronos@tempff\chronos@ffont@camaubach
                  \xdef\chronos@temph{\chronos@minoryearformat}%
                  \ifchronos@marks@minor
                    \chronos@markstrue
                  \else
                    \chronos@marksfalse
                  \fi
                \fi %^^A \ifchronos@cam@mod
%    \end{macrocode}
% \cs{ifchronos@temp} tracks whether we draw a node (T) or coordinate (F)
%    \begin{macrocode}
                \ifchronos@markateraswitch %
                  \ifnum\b=0 
                    \chronos@tempfalse
                  \else 
                    \chronos@temptrue 
                  \fi
                  \ifchronos@minoryears \else \ifchronos@cam@mod \else \chronos@tempfalse \fi\fi
                \else 
                  \chronos@temptrue
                \fi
%    \end{macrocode}
% BEGIN \cs{ifchronos@yearsonline} \dots
%    \begin{macrocode}
                \ifchronos@yearsonline 
%    \end{macrocode}
% if labelling era switch or not switching here, use a node
%    \begin{macrocode}
                  \ifchronos@temp 
                    \node (chronos year \chronosyeari) [%
                      /chronos/llinell amser/timeline@years,%
                      /chronos/llinell amser/timeline@year@on@line,%
                      font=\chronos@tempff%
                    ] at (chronos year \chronosyeari) 
                      {\chronos@showyear[\chronos@temph]{\chronosyeari}};
                  \fi %^^A END \ifchronos@temp
                  \ifchronos@marks %^^A BEGIN
                    \path [/chronos/temp@on] (chronos year \chronosyeari.south) -- 
                      (chronos year \chronosyeari |- chronos base);%^^A rhag ofn rotate (pwy sy'n gwybod?)
                    \path [/chronos/temp@on] (chronos year \chronosyeari.north) -- 
                      (chronos year \chronosyeari |- chronos top);%^^A rhag ofn rotate (pwy sy'n gwybod?)
                    \ifchronos@marks@bare % BEGIN
                      \ifnum\dlast=\pi\relax % BEGIN
                      \else
                        \ifnum\chronos@camrhaniadau>1 % BEGIN
                          \foreach \m [evaluate=\m as \n using {int(\m-1)}] 
                            in {2,...,\chronos@camrhaniadau}
                          {%
                            \path [%
                              /chronos/llinell amser/timeline@bare@mark@on@line%
                            ] ([xshift={-\n*\chronos@tempg pt}]chronos year 
                              \chronosyeari |- chronos phantom year.south)
                              -- ([xshift={-\n*\chronos@tempg pt}]chronos year 
                              \chronosyeari |- chronos phantom year.north);
                          }%
                          \ifnum\b=\chronos@nextstep % BEGIN
                            \path (chronos year \ilast);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \setlength \chronos@templgtha{%
                              \chronos@tempgx-\chronos@tempg pt}%
                            \ifdim\chronos@templgtha<0pt\relax % BEGIN
                            \else
                              \foreach \n in {1,...,\chronos@tempml}
                              {%
                                \coordinate (a) at (\chronos@templgtha,0pt);
                                \path [%
                                  /chronos/llinell amser/timeline@bare@mark@on@line%
                                ]  (a |- chronos phantom year.south) -- 
                                  (a |- chronos phantom year.north);
                                \addtolength \chronos@templgtha{-\chronos@tempg pt}%
                                \ifdim\chronos@templgtha<0pt 
                                  \breakforeach
                                \fi
                                \global\chronos@templgtha\chronos@templgtha
                              }%
                            \fi % END \ifdim\chronos@templgtha<0pt
                          \fi % END \ifnum\b=\chronos@nextstep
                          \edef\chronos@tempey{\thechronos@endyear}%
                          \pgfmathsetmacro\chronos@tempny{int(\b+\chronos@tempv)}%
                          \ifnum\chronos@tempny>\thechronos@endyear % BEGIN
                            \path (chronos year \chronosyeari);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \setlength \chronos@templgtha{%
                              \chronos@tempgx+\chronos@tempg pt}%
                            \path (chronos end);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \ifdim\chronos@templgtha>\chronos@tempgx\relax % BEGIN
                            \else
                              \foreach \n in {1,...,\chronos@tempml}
                              {%
                                \coordinate (a) at (\chronos@templgtha,0pt);
                                \path [%
                                  /chronos/llinell amser/timeline@bare@mark@on@line%
                                ]  
                                  (a |- chronos phantom year.south) -- 
                                  (a |- chronos phantom year.north);
                                \addtolength \chronos@templgtha{\chronos@tempg pt}%
                                \ifdim\chronos@templgtha>\chronos@tempgx 
                                  \breakforeach
                                \fi
                                \global\chronos@templgtha\chronos@templgtha
                              }%
                            \fi % END \ifdim\chronos@templgtha<0pt                        
                          \fi % END \ifnum\chronos@tempny>\thechronos@endyear
                        \fi % END \ifnum\chronos@camrhaniadau>1
                      \fi % END \ifnum\dlast=\pi
                    \fi % END \ifchronos@marks@bare
                  \fi % END \ifchronos@marks
                \else % chronos@yearsonline yw F
%    \end{macrocode}
% if labelling era switch or not switching here, use a node
%    \begin{macrocode}
                  \ifchronos@temp 
                    \node (chronos node year \chronosyeari) [%
                      /chronos/llinell amser/timeline@years,%
                      /chronos/llinell amser/timeline@year@off@line,%
                      font=\chronos@tempff%
                    ] at (chronos year \chronosyeari) 
                      {\chronos@showyear[\chronos@temph]{\chronosyeari}};
                  \else
                    \node (chronos node year \chronosyeari) [%
                      /chronos/llinell amser/timeline@years,%
                      /chronos/llinell amser/timeline@year@off@line,%
                      font=\chronos@ffont@camaumawr,%
                      draw=none,%
                      fill=none%
                    ] at (chronos year \chronosyeari) 
                      {\phantom{\chronos@showyear[\chronos@temph]{\chronosyeari}}};
                  \fi %^^A END % \ifchronos@temp
                  \ifchronos@marks %^^A BEGIN 
                    \ifchronos@temp
                    \else
                      \ifnum\b=0
                        \path [%
                          shorten <=.5*\chronos@height,
                          /chronos/temp@off,
                          /chronos/llinell amser/era switch off line%
                        ] (\chronos@tempa pt,0pt)  -- 
                          (chronos node year \chronosyeari.center -| chronos year \chronosyeari) 
                          ;%^^A rhag ofn rotate
                        \chronos@temptrue
                      \fi
                    \fi
                      \path [shorten <=.5*\chronos@height, /chronos/temp@off] 
                        (\chronos@tempa pt,0pt)  -- 
                        (chronos node year \chronosyeari.\chronos@timelineyearsanchor -| chronos year \chronosyeari) ;
                    \ifnum\dlast=\pi\relax
                    \else
                      \ifchronos@marks@bare % BEGIN
                        \ifnum\chronos@camrhaniadau>1
                          \foreach \m  [evaluate=\m as \n using {int(\m-1)}] in
                            {2,...,\chronos@camrhaniadau}
                            \path [%
                              shorten <=.5*\chronos@height, 
                              /chronos/llinell amser/timeline@bare@mark@off@line%
                            ] ([xshift={-\n*\chronos@tempg pt}]\chronos@tempa pt,0pt) 
                              coordinate (\chronosyeari-\n) -- 
                              (\chronosyeari-\n |- chronos node year \chronosyeari.\chronos@timelineyearsanchor);
                          \ifnum\b=\chronos@nextstep % BEGIN
                            \path (chronos year \ilast);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \setlength \chronos@templgtha{%
                              \chronos@tempgx-\chronos@tempg pt}%
                            \ifdim\chronos@templgtha<0pt\relax % BEGIN
                            \else
                              \foreach \n in {1,...,\chronos@tempml}
                              {%
                                \path [%
                                  shorten <=.5*\chronos@height,
                                  /chronos/llinell amser/timeline@bare@mark@off@line%
                                ] (\chronos@templgtha,0pt) coordinate (a) -- 
                                  (a |- chronos node year \chronosyeari.\chronos@timelineyearsanchor);
                                \addtolength \chronos@templgtha{-\chronos@tempg pt}%
                                \ifdim\chronos@templgtha<0pt \breakforeach\fi
                                \global\chronos@templgtha\chronos@templgtha
                              }%
                            \fi % \ifdim\chronos@templgtha<0pt
                          \fi % \ifnum\b=\chronos@nextstep
                          \edef\chronos@tempey{\thechronos@endyear}%
                          \pgfmathsetmacro\chronos@tempny{int(\b+\chronos@tempv)}%
                          \ifnum\chronos@tempny>\thechronos@endyear % BEGIN
                            \path (chronos year \chronosyeari);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \setlength \chronos@templgtha{%
                              \chronos@tempgx+\chronos@tempg pt}%
                            \path (chronos end);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \ifdim\chronos@templgtha>\chronos@tempgx\relax % BEGIN
                            \else
                              \foreach \n in {1,...,\chronos@tempml}
                              {%
                                \path [%
                                  shorten <=.5*\chronos@height,%
                                  /chronos/llinell amser/timeline@bare@mark@off@line,%
                                  magenta%
                                ] (\chronos@templgtha,0pt) coordinate (a) -- 
                                  (a |- chronos node year \chronosyeari.\chronos@timelineyearsanchor);
                                \addtolength \chronos@templgtha{\chronos@tempg pt}%
                                \ifdim\chronos@templgtha>\chronos@tempgx 
                                  \breakforeach
                                \fi
                                \global\chronos@templgtha\chronos@templgtha
                              }%
                            \fi % END \ifdim\chronos@templgtha<0pt                        
                          \fi % END \ifnum\b=\thechronos@endyear
                        \fi % END \ifnum\chronos@camrhaniadau>1below
                      \fi % END \ifchronos@marks@bare
                    \fi % END  \ifnum\dlast=\pi
                  \fi % END \ifchronos@marks
                \fi % END years on line
              \fi % \ifnum\b=-5000
            \fi % \ifnum\d=\dlast % END
          }% END \foreach \b ...
        \fi % END showing years
        \chronos@from@clist{dyddiadau_coords}{\chronos@coords}%
        \ifx\chronos@coords\@empty\relax % BEGIN 
        \else
          \foreach \i in \chronos@coords {%
            \chronos@set@date{\i}{01}{01}{tempa}% awto-cywiro am flwyddyn sero
            \pgfmathsetmacro\chronos@temph{%
              (\thechronos@tempadate-\thechronos@startdate)*\chronos@unit%
            }%
            \edef\chronos@tempa{\chronos@tempayear}\edef\chronos@tempb{\i}%
            \ifx\chronos@tempa\chronos@tempb
              \coordinate (chronos year \i) at (\chronos@temph pt,0pt);
            \else
              \coordinate (chronos date \i) at (\chronos@temph pt,0pt);
            \fi
          }%
        \fi% END
        \ifchronos@eventyearsonline
          \pgfqkeys{/chronos}{%
            timeline years=on line,
          }%
        \fi
      \end{scope}% [/chronos/chronos@llinell amser@haenen] ?
%    \end{macrocode}
% phantom nodes - haws i gosodi pethau \textbar\ easy to install things
%    \begin{macrocode}
      \begin{scope}[%^^A <<< byw,every node etc.
          byw,every node/.append style={%
            /chronos/@testun=chronos@prifliw,/chronos/placeholder%
          }%
        ]%
        \ifnum\chronos@uchod>0
          \node (u1) [%
            anchor=south west, yshift=\chronos@borderheight+2pt, alias=level 1%
          ] at (chronos top -| \chronos@lefelau@at) 
            {\phantom{Enw}u1 \textbar{} level 1\\\phantom{1234}};
          \ifnum\chronos@uchod>1
            \foreach \i [count=\ino] in {2,...,\chronos@uchod} 
              \node (u\i) [anchor=south west, alias=level \i] at 
                (u\ino.north west) {%
                  \phantom{Enw}u\i{} \textbar{} level \i\\\phantom{1234}%
                };
          \fi
        \fi
        \ifnum\chronos@isod>0
          \node (i1) [%
            anchor=north west, yshift=-\chronos@borderheight-2pt, alias=level -1%
          ] at (chronos base -| \chronos@lefelau@at) 
            {\phantom{Enw}i1 \textbar{} level -1\\\phantom{1234}};
          \ifnum\chronos@isod>1
            \foreach \i [count=\ino] in {2,...,\chronos@isod} 
              \node (i\i) [anchor=north west, alias=level -\i] at 
                (i\ino.south west) 
                {\phantom{Enw}i\i{} \textbar{} level -\i\\\phantom{1234}};
          \fi
        \fi
        \ifchronos@showcoords
          \begin{scope}[on chronos overlay layer]
            \ifnum\chronos@uchod>0
              \foreach \i in {1,...,\chronos@uchod} 
                \draw [help lines, draw=chronos@lliw@node] (u\i.north east) 
                  -| (u\i.south west) -| cycle;
            \fi
            \ifnum\chronos@isod>0
              \foreach \i in {1,...,\chronos@isod} 
                \draw [help lines, draw=chronos@lliw@node] 
                  (i\i.north east) -| (i\i.south west) -| cycle;
            \fi
          \end{scope}%[on chronos overlay layer]
        \fi
      \end{scope}%^^A >>> byw, every node etc.
      \let\ceyearlabel\chronos@yearce
      \let\bceyearlabel\chronos@yearbce
      \let\celabel\chronos@ce
      \let\bcelabel\chronos@bce
      \let\timelineborderht\chronos@borderheight
      \let\timelinewd\chronos@width
      \let\lineyshift\chronos@llinell@yshift
%    \end{macrocode}
% At the end of \texttt{chronos} \dots
%    \begin{macrocode}
}{%^^A oedd yn execute at end picture={...}
      \ifchronos@frame
        \ifchronos@headings\relax
        \else
          \ifchronos@framedefnyddiobb\relax
          \else
            \pgfqkeys{/chronos}{subheadings drops'=0pt:0pt}%
            \chronos@headingstrue
          \fi % \ifchronos@framedefnyddiobb
        \fi % \ifchronos@headings
      \fi % \ifchronos@frame
      \ifchronos@headings
        \ifdim\chronos@heading@drop=0pt
          \chronos@heading@drop=15pt
          \PackageWarning{chronos}{Setting headings drop to 15pt}%
        \fi
        \ifdim\chronos@subheading@drop@uchod=0pt
          \chronos@subheading@drop@uchod=12pt
          \PackageWarning{chronos}{Setting upper subheading drop to 12pt}%
        \fi
        \ifdim\chronos@subheading@drop@isod=0pt
          \chronos@subheading@drop@isod=10pt
          \PackageWarning{chronos}{Setting lower subheading drop to 10pt}%
        \fi
        \ifnum\chronos@uchod=0
          \coordinate (u0) at (current bounding box.north);
          \PackageWarning{chronos}{%
            Placing (u0) at (current bounding box.north) for headings placement.%
          }%
        \fi
        \ifdim\chronos@border@penawdau=\pi pt
          \IfIntCompareTF {\chronos@uchod > 0}
          {%    
            \chronos@border@penawdau=15pt
            \PackageWarning{chronos}{%
              Allowing 15pt plus headings and subheadings drops for headings.%
            }%
          }{%
            \chronos@border@penawdau=5pt
            \PackageWarning{chronos}{%
              Allowing 5pt plus headings and subheadings drops for headings.%
            }%
          }%
          \advance \chronos@border@penawdau by \chronos@heading@drop
          \advance \chronos@border@penawdau by \chronos@subheading@drop@uchod
          \advance \chronos@border@penawdau by \chronos@subheading@drop@isod
        \fi
        \ifnum\chronos@isod=0
          \coordinate (i0) at (current bounding box.south);
          \PackageWarning{chronos}{%
            Placing (i0) at (current bounding box.south) for structural purposes.%
          }%
        \fi
        \chronos@templgtha=\chronos@border@penawdau
        \advance\chronos@templgtha by \chronos@border@pen
        \coordinate (chronos margin top) at 
          ($(u\chronos@uchod.north -| chronos post) + (0pt,\chronos@templgtha)$);
        \chronos@templgtha=\chronos@border@pen
        \advance\chronos@templgtha by \chronos@heading@drop
        \coordinate (chronos main headings) at 
          ($(chronos margin top) - (0pt,\chronos@templgtha)$);% oedd pen & gwahanol
        \coordinate (chronos bottom) at 
          ($(i\chronos@isod.south) + (0pt,-\chronos@border@gwaelod)$);% oedd gwaelod
        \coordinate (chronos upper subheadings) at 
          ($(chronos main headings) - (0pt,\chronos@subheading@drop@uchod)$);% oedd pwy1
        \coordinate (chronos lower subheadings) at 
          ($(chronos upper subheadings) - (0pt,\chronos@subheading@drop@isod)$);% oedd pwy2
        \coordinate (chronos@de) at ($(chronos post) + (\chronos@border@de,0pt)$);% oedd de
        \coordinate (chronos@chwith) at 
          ($(chronos pre) + (-\chronos@border@chwith,0pt)$);% oedd chwith
%    \end{macrocode}
%^^A        \coordinate (chronos@chwith1) at ($(chronos pre) + (\chronos@border@chwith,0pt)$);% oedd chwith1
%    \begin{macrocode}
      \fi % \ifchronos@headings
      \pgfqkeys{/chronos}{@before@headings}%
      \chronos@at@end
      \pgfqkeys{/chronos}{@before@frame}%
      \ifchronos@frame
        \scoped[on chronos background layer]{%
          \ifchronos@framedefnyddiobb % if frame uses bb
            \node (chronos frame) [%
              fit=(current bounding box), /chronos/prif/@frame%
            ] {};
          \else
            \node (chronos frame) [fit=(chronos margin top -| chronos@de) 
              (chronos bottom -| chronos@chwith), /chronos/prif/@frame] {};
          \fi % \ifchronos@framedefnyddiobb
          \path (chronos frame.south west) 
            ++(-\chronos@border@allanol,-\chronos@border@allanol) |- 
            (chronos frame.north east) -- 
            ++(\chronos@border@allanol,\chronos@border@allanol);
        }%
      \fi % \ifchronos@frame
      \pgfqkeys{/chronos}{@tikz}%
    \end{scope}% [/chronos/@style]
    \pgf@relevantforpicturesizefalse
    \pgfqkeys{/chronos}{@@tikz}%
    \ifchronos@showcoords
      \begin{scope}[on chronos overlay layer]
        \foreach \i/\j in {%
          chronos foot/-55,%
          chronos head/north,%
          chronos base/-25,%
          chronos top/120,%
          chronos start/85,%
          chronos end/85,%
          chronos pre/west,%
          chronos post/east,%
          chronos pre-top/175,%
          chronos post-top/15,%
          chronos pre-base/south west,%
          chronos post-base/south east,%
          chronos pre-head/155,%
          chronos post-head/north east,%
          chronos pre-foot/south,%
          chronos post-foot/south,%
          chronos origin/-85,%
          chronos mid/90,%
          chronos mid-time/-90%
        }
        \node [/chronos/show coord={\j}{\i}] at (\i) {}; 
        \ifchronos@timeline@showyears
          \node [/chronos/show coord={45}{chronos first marked year}] at 
            (chronos first marked year) {};
        \fi
        \ifchronos@headings
          \foreach \i/\j in {%
            chronos main headings/east,%
            chronos bottom/north,%
            chronos upper subheadings/east,%
            chronos lower subheadings/east,%
            chronos margin top/north%
          }
          \node [/chronos/show coord={\j}{\i}] at (\i) {};
        \fi
        \node (chronos@gwybodaeth@coords) [%
          below=2.5pt of current bounding box.south west,%
          anchor=north west,%
          every pin,%
          text=chronos@lliw@coord%
        ] {\textbullet{} coordinates};
      \end{scope}%
    \fi % \ifchronos@showcoords
    \ifchronos@shownodes
      \begin{scope}[on chronos overlay layer]
        \ifchronos@markeras
          \foreach \i/\j in {chronos bce/south, chronos ce/-95} 
          {%
            \draw [help lines, draw=chronos@lliw@node] (\i.north west) -| 
              (\i.south east) -| cycle;
            \node [/chronos/show node coord={\j}{\i}] at (\i) {};
          }%
        \fi % \ifchronos@markeras
        \ifchronos@frame
          \draw [help lines, draw=chronos@lliw@node] (chronos frame.north west)
            -| (chronos frame.south east) -| cycle;
          \node [/chronos/show node coord={north}{chronos frame}] at 
            (chronos frame.north) {};
        \fi % \ifchronos@frame
        \ifchronos@showcoords
          \node (chronos@gwybodaeth@nodes) [%
            right=of chronos@gwybodaeth@coords.base east,%
            anchor=base west,%
            every pin,%
            text=chronos@lliw@node%
          ] {\textbullet{} nodes};
        \else
          \node (chronos@gwybodaeth@nodes) [%
            below=2.5pt of current bounding box.south west,%
            anchor=north west,%
            every pin,%
            text=chronos@lliw@node%
          ] {\textbullet{} nodes};        
        \fi % \ifchronos@showcoords
      \end{scope}%
    \fi % \ifchronos@shownodes
    \ifchronos@showbb
      \begin{scope}[on chronos overlay layer]
        \draw [help lines,draw=chronos@lliw@bb]
          (current bounding box.north east) -| (current bounding box.south west)
            -| cycle;
        \node [%
          /chronos/show coordinate={chronos@lliw@bb}{90}{bounding box}{15pt}{}%
        ] at (current bounding box.120) {};
        \ifchronos@shownodes
          \node (chronos@gwybodaeth@bb) [%
            right=of chronos@gwybodaeth@nodes.base east,%
            anchor=base west,%
            every pin,%
            text=chronos@lliw@bb%
          ] {\textbullet{} bounding box};
        \else
          \ifchronos@showcoords
            \node (chronos@gwybodaeth@bb) [%
              right=of chronos@gwybodaeth@coords.base east,%
              anchor=base west,%
              every pin,%
              text=chronos@lliw@bb%
            ] {\textbullet{} bounding box};
          \else
            \node (chronos@gwybodaeth@bb) [%
              below=2.5pt of current bounding box.south west,%
              anchor=north west,%
              every pin,%
              text=chronos@lliw@bb%
            ] {\textbullet{} bounding box};        
          \fi % \ifchronos@showcoords
        \fi % \ifchronos@shownodes
      \end{scope}%
    \fi % \ifchronos@showbb
  \end{tikzpicture}%
%    \end{macrocode}
  % ailosod pethau rhagosodedig sy'n gosod gyda \cs{g} neu \cs{global}
%    \begin{macrocode}
  \chronos@global@clear@to@clist{century_subheadings}%
  \chronos@lliwiau@clear
  \ifchronos@byw@isod@rhag
    \global\chronos@byw@isodtrue
  \else 
    \global\chronos@byw@isodfalse
  \fi
  \ifchronos@digwyddiad@isod@rhag
    \global\chronos@digwyddiad@isodtrue
  \else 
    \global\chronos@digwyddiad@isodfalse
  \fi
  \ifchronos@parhad@isod@rhag 
    \global\chronos@parhad@isodtrue
  \else 
    \global\chronos@parhad@isodfalse
  \fi
  \let\chronosset\@chronosset
}
%    \end{macrocode}
% \end{environment}
%^^A END env y ddogfen >>>
%^^A BEGIN macros y ddogfen <<<
% \begin{macro}{\chronosset,\@chronosset,\@@chronosset,\s@chronos@set,\@chronos@set}%^^A <<<
%   \changes{v0.9.3}{2025-07-15}{Eliminate \lpack{xparse} macros for internal commands. (According to \TeX{} SE chat this is The Right Thing To Do).}
%   Provide conditional interface for defining custom styles, schemes, settings etc\@. 
%   We don't want this to do anything inside a \env{chronos} environment, so just issue a warning in that case.
%    \begin{macrocode}
\protected\gdef\@chronosset{%
  \typeout{Setting for all clangers!}%
  \@ifstar\s@chronos@set\@chronos@set
}
\protected\gdef\@chronos@set#1{%
  \typeout{Starless Sneetches.}%
  \pgfqkeys{/chronos}{#1}%
}
\protected\gdef\s@chronos@set#1{%
  \typeout{Stars upon thars.}%
  \pgfqkeys{/chronos}{#1}%
  \ifchronos@byw@isod
    \chronos@byw@isod@rhagtrue
  \else
    \chronos@byw@isod@rhagfalse
  \fi
  \ifchronos@digwyddiad@isod
    \chronos@digwyddiad@isod@rhagtrue
  \else
    \chronos@digwyddiad@isod@rhagfalse
  \fi
  \ifchronos@parhad@isod
    \chronos@parhad@isod@rhagtrue
  \else
    \chronos@parhad@isod@rhagfalse
  \fi
  \chronos@lliwiau@cadw@rhag
}
\protected\gdef\@@chronosset{%
  \PackageWarning{chronos}{%
    \bs chronosset has no effect inside a chronos environment.
    Usage ignored %
  }%
  \@ifstar\@gobble\@gobble
}
\let\chronosset\@chronosset
%    \end{macrocode}
% \end{macro}%^^A >>>
% \begin{macro}{\byw}%^^A <<<
% That is, \cs{chronoslife}.
%    \begin{macrocode}
\NewDocumentCommand\byw { m }{%
  \begingroup
    \Undefine\chronos@byw@labelgeni
    \Undefine\chronos@byw@labelmarw
    \Undefine\chronos@byw@angor
    \Undefine\chronos@byw@at
    \Undefine\chronos@byw@invanchor
    \Undefine\chronos@cynnwys@testun
    \Undefine\chronos@cynnwys@dyddiadau
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@cysylltwyr
    \chronos@byw@cysylltiadtheorifalse %^^A rhag ofn
    \tikzset{byw={enw={??},marw={\year-\month-\day},bu farw=false,#1}}%
    \ifchronos@eventdatessplit
      \PackageInfo{chronos}{Setting split false for non-event.}%
      \chronos@eventdatessplitfalse
    \fi
    \pgfmathsetmacro\chronos@temph{%
      (\thechronos@genidate-\thechronos@startdate)*\chronos@unit
    }%
    \pgfmathsetmacro\chronos@tempk{%
      (\thechronos@marwdate-\thechronos@startdate)*\chronos@unit
    }%
    \pgfmathsetmacro\chronos@templ{%
      (\chronos@temph+\chronos@tempk)*\chronos@unit/2%
    }%
%    \end{macrocode}
% temporary coordinate accurate only for x
%    \begin{macrocode}
    \coordinate (\chronos@byw@tikzname) at (\chronos@templ pt,0pt);
%    \end{macrocode}
% \changes{v0.9.3}{2025-07-09}{Add helper coordinates for placing things relative to life/period lines, including provisional coordinates for getting \texttt{x} only.}
% These are exposed publicly, as they are useful, but they are only correct for \texttt{x} during \texttt{life} creation.
%    \begin{macrocode}
    \coordinate [alias=birth \chronos@byw@tikzname] (geni \chronos@byw@tikzname) at (\chronos@temph pt,0pt);
    \coordinate [alias=death \chronos@byw@tikzname] (marw \chronos@byw@tikzname) at (\chronos@tempk pt,0pt);
    \chronos@troilliwiau@tag{byw}%
    \chronos@gosodangor@tag{byw}%
    \chronos@gosodborder@tag{byw}%
    \IfExistTF \chronos@cynnwys@testun{%
      \let\chronos@cynnwys@dyddiadau\relax
      \let\chronos@cynnwys@enw\relax
    }{%
      \IfExistF \chronos@cynnwys@enw {%
        \def \chronos@cynnwys@enw {\chronos@enw@priflythrennu{\chronos@byw@enw}}%
      }%
      \IfExistTF \chronos@cynnwys@dyddiadau {%
        \pretocmd \chronos@cynnwys@dyddiadau {\\\chronos@byw@ffontdyddiad}{}{}%
      }{%
        \ifchronos@onlytext\let\chronos@cynnwys@dyddiadau\relax
        \else
          \ifchronos@bufarw\relax\else\def\chronos@byw@labelmarw{}\fi
          \chronos@dyddiadau@tag{byw}{geni}{geni}{marw}{marw}%
          \ifchronos@temp
            \def \chronos@cynnwys@dyddiadau {%
              \\\chronos@byw@ffontdyddiad\chronos@byw@labelmarw
            }%
          \else
            \def \chronos@cynnwys@dyddiadau {%
              \\\chronos@byw@ffontdyddiad\chronos@byw@labelgeni
              --\chronos@byw@labelmarw
            }%
          \fi
        \fi
      }%
      \def \chronos@cynnwys@testun {%
        {\chronos@byw@ffonttestun\chronos@cynnwys@enw}\chronos@cynnwys@dyddiadau
      }%
    }%
    \chronos@creu@llinell {byw}{\chronos@temph pt}{\chronos@tempk pt}{geni}{marw}{birth}{death}%
%    \end{macrocode}
% final coordinate accurate for x and y
%
% \changes{v0.9.3}{2025-07-10}{Adjust reference coordinate placement for additional line shift.}
% Subtract additional line shift so reference coordinate is offset by standard distance from timeline (0pt or \texttt{yshift}).
% For most styles, \cs{chronos@llinell@add@yshift}\ is \texttt{0pt}.
%    \begin{macrocode}
    \coordinate [yshift=-\chronos@llinell@add@yshift] (\chronos@byw@tikzname) at 
      ($(\chronos@byw@tikzname{} geni)!1/2!(\chronos@byw@tikzname{} marw)$);
%    \end{macrocode}
% creu cylcu ar y lein ; testun - prif node ; testun cylch ; prif gysylltiad
%    \begin{macrocode}
    \chronos@creu@testun@tag{}{byw}{\chronos@cynnwys@testun}%
    \ifchronos@byw@cysylltiadtheori
        \chronos@angorau@theori{testun \chronos@byw@tikzname}%
          {cysylltwr \chronos@byw@tikzname}{connector \chronos@byw@tikzname}%
          {/chronos/@cysylltwr@testun=\chronos@byw@lliw}%
%    \end{macrocode}
%^^A       }%
%    \begin{macrocode}
    \fi
    \ifchronos@every@byw@isod
      \global\chronos@byw@isodtrue
    \else\ifchronos@every@byw@uchod
        \global\chronos@byw@isodfalse
      \else
        \ifchronos@byw@isod
          \global\chronos@byw@isodfalse
        \else
          \global\chronos@byw@isodtrue
        \fi
      \fi
    \fi
    \chronos@ailosod@nodweddion
  \endgroup
}
%    \end{macrocode}
% \end{macro}%^^A >>>
% \begin{macro}{\digwyddiad}%^^A <<<
%   That is, \cs{chronosevent}.
%    \begin{macrocode}
\NewDocumentCommand\digwyddiad { m }{%
  \begingroup
    \Undefine\chronos@digwyddiad@angor
    \Undefine\chronos@digwyddiad@invanchor
    \Undefine\chronos@digwyddiad@at
    \Undefine\chronos@cynnwys@testun
    \Undefine\chronos@cynnwys@dyddiadau
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@cysylltwyr
    \chronos@digwyddiad@cysylltiadtheorifalse %^^A rhag ofn
%    \end{macrocode}
% oedd problem yn pasio every@digwyddiad i digwyddiad pan iddo fe'n cynnwys font=\cs{unrhywbeth}
% \textbar{} there was a problem passing every@digwyddiad to digwyddiad (event) when it included \texttt{font=\bs something}
%    \begin{macrocode}
    \tikzset{digwyddiad={enw={??},#1}}%
    \pgfmathsetmacro\chronos@temph{%
      (\thechronos@digdate-\thechronos@startdate)*\chronos@unit
    }%
%    \end{macrocode}
% temporary coordinate accurate only for x
%    \begin{macrocode}
    \coordinate (\chronos@digwyddiad@tikzname) at (\chronos@temph pt,0pt);
    \chronos@troilliwiau@tag{digwyddiad}%
    \chronos@gosodangor@tag{digwyddiad}%
    \chronos@gosodborder@tag{digwyddiad}%
    \ifchronos@eventdatessplit
      \ifchronos@onlytext\relax
        \IfExistF \chronos@cynnwys@testun {%
          \IfExistTF  \chronos@cynnwys@enw {%
            \def\chronos@cynnwys@testun {%
              \chronos@digwyddiad@ffonttestun
              \chronos@cynnwys@enw
            }
          }{%
            \def \chronos@cynnwys@testun {%
              \chronos@digwyddiad@ffonttestun
              \chronos@enw@priflythrennu{\chronos@digwyddiad@enw}%
            }%
          }%
        }%
      \else
        \IfExistF \chronos@cynnwys@testun {%
          \IfExistF \chronos@cynnwys@dyddiadau {%
            \def \chronos@cynnwys@dyddiadau {%
              \chronos@showdate@cs[chronos@digwyddiad@fformatdyddiad]{dig}%
            }%
          }%
          \IfExistTF  \chronos@cynnwys@enw {%
            \def\chronos@cynnwys@testun {%
              \chronos@digwyddiad@ffonttestun
              \chronos@cynnwys@enw
            }
          }{%
            \def \chronos@cynnwys@testun {%
              \chronos@digwyddiad@ffonttestun
              \chronos@enw@priflythrennu{\chronos@digwyddiad@enw}%
            }%
          }%
        }%
      \fi
    \else % not event date split
      \IfExistTF \chronos@cynnwys@testun {%
        \let\chronos@cynnwys@dyddiadau\relax
        \let\chronos@cynnwys@enw\relax
      }{%
        \IfExistF {\chronos@cynnwys@enw}{%
          \def \chronos@cynnwys@enw {%
            \chronos@enw@priflythrennu{\chronos@digwyddiad@enw}%
          }%
        }%
        \IfExistTF \chronos@cynnwys@dyddiadau {%
          \apptocmd \chronos@cynnwys@dyddiadau {\\}{}{}%
          \pretocmd \chronos@cynnwys@dyddiadau 
            {\chronos@digwyddiad@ffontdyddiad}{}{}%
        }{%
          \ifchronos@onlytext\let\chronos@cynnwys@dyddiadau\relax
          \else
            \def \chronos@cynnwys@dyddiadau {%
              \chronos@digwyddiad@ffontdyddiad
              \chronos@showdate@cs[chronos@digwyddiad@fformatdyddiad]{dig}\\%
            }%
          \fi
        }%
        \def \chronos@cynnwys@testun {%
          \chronos@cynnwys@dyddiadau
          \chronos@digwyddiad@ffonttestun
          \chronos@cynnwys@enw
        }%
      }%
    \fi
%    \end{macrocode}
% marcio digwyddiad ar y lein \textbar{} mark event on line
%    \begin{macrocode}
    \begin{scope}[/chronos/chronos@llinell@haenen]% finalise coordinate placement
      \path [/chronos/@llinell=\chronos@digwyddiad@lliw] ({\chronos@temph pt,0}
        |- \chronos@border@coord) -- +(0pt,\chronos@digwyddiad@border) 
        coordinate (\chronos@digwyddiad@tikzname);
      \ifchronos@eventdatessplit
        \path [/chronos/@llinell=\chronos@digwyddiad@lliw] 
          ({\chronos@temph pt,0} |- \chronos@border@coord@inv) -- 
          +(0pt,\chronos@digwyddiad@border@inv) coordinate 
          (\chronos@digwyddiad@tikzname-inv);      
      \fi
    \end{scope}%
%    \end{macrocode}
% creu cylch ar y lein ; testun - prif node ; testun cylch ; prif gysylltiad
% \textbar{} create circle (or other mark) on timeline ; text tag ; text tag circle (connector) ; main connection
%    \begin{macrocode}
    \ifchronos@eventdatessplit
%    \end{macrocode}
% don't use a group here or names won't survive tag creation
%    \begin{macrocode}
      \chronos@hollti@testun@tagtrue
      \chronos@creu@testun@tag{}{digwyddiad}{\chronos@cynnwys@dyddiadau}%^^A angen defnyddio  /chronos/event date split
      \chronos@hollti@testun@tagfalse
    \fi
    \chronos@creu@testun@tag{}{digwyddiad}{\chronos@cynnwys@testun}%
%    \end{macrocode}
% dyddiad arbennig \textbar{} special date
%    \begin{macrocode}
    \ifchronos@eventyearsonline
      \edef\chronos@tempa{none}%
      \edef\chronos@tempb{\chronos@specialdate}%
      \ifx\chronos@tempa\chronos@tempb
        \def\chronos@tempbd{%
          \chronos@showdate@cs[chronos@digwyddiad@fformatdyddiad]{dig}%
        }%
      \else
        \let\chronos@tempbd\chronos@specialdate\gdef\chronos@specialdate{none}%
      \fi
      \scoped[/chronos/chronos@llinell amser@haenen]{%
        \node [/chronos/event year on line] at (\chronos@temph pt,0pt)
          {\chronos@tempbd};%
      }%
    \fi
    \ifchronos@digwyddiad@cysylltiadtheori
        \chronos@angorau@theori{testun \chronos@digwyddiad@tikzname}%
          {cysylltwr \chronos@digwyddiad@tikzname}%
          {connector \chronos@digwyddiad@tikzname}%
          {/chronos/@cysylltwr@testun=\chronos@digwyddiad@lliw}%
%    \end{macrocode}
%^^A       }%
%    \begin{macrocode}
    \fi
    \ifchronos@every@digwyddiad@isod
      \global\chronos@digwyddiad@isodtrue
    \else\ifchronos@every@digwyddiad@uchod
        \global\chronos@digwyddiad@isodfalse
      \else
        \ifchronos@digwyddiad@isod
          \global\chronos@digwyddiad@isodfalse
        \else
          \global\chronos@digwyddiad@isodtrue
        \fi
      \fi
    \fi
    \chronos@ailosod@nodweddion
  \endgroup
}
%    \end{macrocode}
% \end{macro}%^^A >>>
% \begin{macro}{\parhad}%^^A <<<
%   That is, \cs{chronosperiod}.
%    \begin{macrocode}
\NewDocumentCommand\parhad { m }{%
  \begingroup
    \Undefine\chronos@parhad@labeldechrau
    \Undefine\chronos@parhad@labeldiwedd
    \Undefine\chronos@parhad@angor
    \Undefine\chronos@parhad@at
    \Undefine\chronos@parhad@invanchor
    \Undefine\chronos@cynnwys@testun
    \Undefine\chronos@cynnwys@dyddiadau
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@cysylltwyr
    \chronos@parhad@cysylltiadtheorifalse %^^A rhag ofn
    \tikzset{parhad={enw={??},diwedd={\year-\month-\day},gorffenedig=false,#1}}%
    \ifchronos@eventdatessplit
      \PackageInfo{chronos}{Setting split false for non-event.}%
      \chronos@eventdatessplitfalse
    \fi
    \pgfmathsetmacro\chronos@temph{%
      (\thechronos@thingdate-\thechronos@startdate)*\chronos@unit
    }%
    \pgfmathsetmacro\chronos@tempk{%
      (\thechronos@otherthingdate-\thechronos@startdate)*\chronos@unit
    }%
    \pgfmathsetmacro\chronos@templ{%
      (\chronos@temph+\chronos@tempk)*\chronos@unit/2%
    }%
%    \end{macrocode}
% temporary coordinates accurate only for x
%    \begin{macrocode}
    \coordinate (\chronos@parhad@tikzname) at (\chronos@templ pt,0pt);
%    \end{macrocode}
% \changes{v0.9.3}{2025-07-09}{Add helper coordinates for placing things relative to life/period lines, including provisional coordinates for getting \texttt{x} only.}
% These are exposed publicly, as they are useful, but they are only correct for \texttt{x} during \texttt{period} creation.
%    \begin{macrocode}
    \coordinate [alias=start \chronos@parhad@tikzname] (dechrau \chronos@parhad@tikzname) at (\chronos@temph pt,0pt);
    \coordinate [alias=end \chronos@parhad@tikzname] (diwedd \chronos@parhad@tikzname) at (\chronos@tempk pt,0pt);
    \chronos@troilliwiau@tag{parhad}%
    \chronos@gosodangor@tag{parhad}%
    \chronos@gosodborder@tag{parhad}%
    \IfExistTF \chronos@cynnwys@testun{%
      \let\chronos@cynnwys@dyddiadau\relax
      \let\chronos@cynnwys@enw\relax
    }{%
      \IfExistF \chronos@cynnwys@enw {%
        \def \chronos@cynnwys@enw {\chronos@enw@priflythrennu{\chronos@parhad@enw}}%
      }%
      \IfExistTF \chronos@cynnwys@dyddiadau {%
        \apptocmd \chronos@cynnwys@dyddiadau {\\}{}{}%
      }{%
        \ifchronos@onlytext\let\chronos@cynnwys@dyddiadau\relax
        \else
          \ifchronos@gorffenedig\relax\else\def\chronos@parhad@labeldiwedd{}\fi
          \chronos@dyddiadau@tag{parhad}{thing}{dechrau}{otherthing}{diwedd}%
          \ifchronos@temp
            \def \chronos@cynnwys@dyddiadau {\chronos@parhad@labeldechrau\\}%
          \else
            \def \chronos@cynnwys@dyddiadau {%
              \chronos@parhad@labeldechrau--\chronos@parhad@labeldiwedd\\}%
          \fi
        \fi
      }%
      \def \chronos@cynnwys@testun {%
        \chronos@parhad@ffontdyddiad
        \chronos@cynnwys@dyddiadau
        \chronos@parhad@ffonttestun
        \chronos@cynnwys@enw
      }%
    }%
    \chronos@creu@llinell {parhad}{\chronos@temph pt}{\chronos@tempk pt}{dechrau}{diwedd}{start}{end}%
%    \end{macrocode}
% final coordinate placement
%
% \changes{v0.9.3}{2025-07-10}{Adjust reference coordinate placement for additional line shift.}
% Subtract additional line shift so reference coordinate is offset by standard distance from timeline (0pt or \texttt{yshift}).
% For most styles, \cs{chronos@llinell@add@yshift}\ is \texttt{0pt}.
%    \begin{macrocode}
    \coordinate [yshift=-\chronos@llinell@add@yshift] (\chronos@parhad@tikzname) at 
      ($(\chronos@parhad@tikzname{} dechrau)!1/2!(\chronos@parhad@tikzname{} diwedd)$);
%    \end{macrocode}
% creu cylch ar y lein ; testun ; testun cylch ; prif gysylltiad
% \textbar{} create circle (or other mark) on timeline ; text tag ; text tag circle (connector) ; main connection
%    \begin{macrocode}
    \chronos@creu@testun@tag{}{parhad}{\chronos@cynnwys@testun}%
    \ifchronos@parhad@cysylltiadtheori
        \chronos@angorau@theori{testun \chronos@parhad@tikzname}%
          {cysylltwr \chronos@parhad@tikzname}{connector \chronos@parhad@tikzname}%
          {/chronos/@cysylltwr@testun=\chronos@parhad@lliw}%
    \fi
    \ifchronos@every@parhad@isod
      \global\chronos@parhad@isodtrue
    \else\ifchronos@every@parhad@uchod
        \global\chronos@parhad@isodfalse
      \else
        \ifchronos@parhad@isod
          \global\chronos@parhad@isodfalse
        \else
          \global\chronos@parhad@isodtrue
        \fi
      \fi
    \fi
    \chronos@ailosod@nodweddion
  \endgroup
}
%    \end{macrocode}
% \end{macro}%^^A >>>
% \begin{macro}{\theori}%^^A <<<
%   That is, \cs{chronostheory}.
%    \begin{macrocode}
\NewDocumentCommand\theori { m }{%
  \begingroup
    \Undefine\chronos@theori@angor
    \Undefine\chronos@theori@at
    \Undefine\chronos@theori@invanchor
    \Undefine\chronos@cynnwys@testun
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@cynnwys@dyddiadau
    \Undefine\chronos@cysylltwyr
    \chronos@theori@cysylltiadtheorifalse %^^A rhag ofn
    \tikzset{theori={enw={??},#1}}%
    \chronos@troilliwiau@tag{theori}%
    \IfExistTF \chronos@theori@angor{%
      \IfExistTF \chronos@cysylltwyr{%
        \pretocmd\chronos@cysylltwyr{\chronos@theori@angor,}{}{}%
      }{%
        \def\chronos@cysylltwyr{\chronos@theori@angor}%
      }%
    }{%
      \ifchronos@theori@isod
        \def\chronos@theori@angor{north}%
      \else
        \def\chronos@theori@angor{south}
      \fi
    }%
    \IfExistTF \chronos@cynnwys@testun {%
      \let\chronos@cynnwys@enw\relax
    }{%
      \IfExistF \chronos@cynnwys@enw {%
        \def \chronos@cynnwys@enw {\chronos@enw@priflythrennu{\chronos@theori@enw}}%
      }%
      \def \chronos@cynnwys@testun {\chronos@cynnwys@enw}%
    }%
%    \end{macrocode}
% creu testun \textbar{} text tag
%    \begin{macrocode}
    \chronos@creu@testun@tag{alias=\chronos@theori@tikzname}{theori}{%
      \chronos@theori@ffonttestun\chronos@cynnwys@testun}%
      \IfExistT \chronos@cysylltwyr{%
        \chronos@angorau@theori{\chronos@theori@enw}{%
          cysylltwr \chronos@theori@enw
        }{connector \chronos@theori@enw}{%
          /chronos/@cysylltwr@testun=\chronos@theori@lliw
        }%
      }%
    \chronos@ailosod@nodweddion
  \endgroup
}
%    \end{macrocode}
% \end{macro}%^^A >>>
% \begin{macro}{\chronos@angorau@theori}%^^A <<<
%   \changes{v0.9.3}{2025-07-18}{Remove unused variant of and use \cs{def}\ for internal macro \cs{chronos@angorau@theori}.}
%   That is, anchors for \cs{chronostheory}.
%    \begin{macrocode}
\protected\def \chronos@angorau@theori#1#2#3#4{% 
  % #1 enw y prif node ; 
  % #2 enw yr angor cyntaf ; 
  % #3 connector ;
  % #4 style
  \ifchronos@phantom
    \PackageWarning{chronos}{Phantom tags cannot have connectors }%
  \else
%    \end{macrocode}
% ateb Symbol 1: \url{https://tex.stackexchange.com/a/385953/}
%    \begin{macrocode}
    \begin{scope}[/chronos/middle anchorborder]
      \setcounter{chronos@theori@countanchors}{0}%
      \@for \xx:=\chronos@cysylltwyr \do {%
        \stepcounter{chronos@theori@countanchors}%
        \ifnum\value{chronos@theori@countanchors}=1%
          \node (#2) [%
            #4,%
            alias=#2\thechronos@theori@countanchors,%
            alias=#3,%
            alias=#3\thechronos@theori@countanchors
          ] at (#1.middle \xx) {};
        \else
          \node (#2\thechronos@theori@countanchors) [%
            #4, alias=#3\thechronos@theori@countanchors
          ] at (#1.middle \xx) {};
        \fi
      }%
    \end{scope}%
  \fi
}
%    \end{macrocode}
% \end{macro}%^^A >>>
% \begin{macro}{\cylchtheori}%^^A <<< - cylchau bychain yn lle bocses mawr
%   That is, \cs{theorycircle}.
%    \begin{macrocode}
\NewDocumentCommand \cylchtheori { m } {%
  \begingroup
    \Undefine\chronos@cylchtheori@at
    \Undefine\chronos@cynnwys@testun
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@cynnwys@dyddiadau
    \tikzset{cylch theori={enw={??},#1}}%
%    \end{macrocode}
%^^A  % ni all wneud y cam hwn a'r un nesaf gyda'i gilydd - wn i ddim yn siwr pam lai
%    \begin{macrocode}
    \coordinate [%
      /chronos/every@cylch cylch theori,%
      /utils/exec=\pgfkeysalsofrom{\chronos@cadw}%
    ] (\chronos@cylchtheori@tikzname1) at  (chronos@cylchtheori@at);
    \path [/chronos/every@cylch cylch theori] (\chronos@cylchtheori@tikzname1) 
      circle (\chronos@cylchtheori@bach) circle (\chronos@cylchtheori@mawr);
    \pgfmathsetlength\chronos@templgtha{\chronos@cylchtheori@bach+0.5pt}%
    \pgfmathsetlength\chronos@templgthc{\chronos@cylchtheori@mawr-0.5pt}%
    \pgfmathsetlength\chronos@templgthb{\chronos@cylchtheori@mawr+2pt}%
    \coordinate (\chronos@cylchtheori@tikzname2) at 
      ($(\chronos@cylchtheori@tikzname1) - (\chronos@templgtha,0)$);
    \coordinate (\chronos@cylchtheori@tikzname3) at 
      ($(\chronos@cylchtheori@tikzname1) - (\chronos@templgthc,0)$);
    \coordinate (\chronos@cylchtheori@tikzname4) at 
      ($(\chronos@cylchtheori@tikzname1) + (0,\chronos@templgthb)$);
    \coordinate (\chronos@cylchtheori@tikzname5) at 
      ($(\chronos@cylchtheori@tikzname1) - (0,\chronos@templgthb)$);
    \path [%
      /chronos/every@testun cylch theori/.expanded={%
        \ \chronos@cylchtheori@circletext@uchod\ %
      }%
    ] (\chronos@cylchtheori@tikzname2) arc (180:0:\chronos@templgtha);
    \path [%
      /chronos/every@testun cylch theori/.expanded={%
        \chronos@cylchtheori@circletext@isod
      }%
    ] (\chronos@cylchtheori@tikzname3) arc (180:360:\chronos@templgthc);
    \node (label above \chronos@cylchtheori@tikzname) [%
      anchor=south, /chronos/theori/cylchau/@label
    ] at (\chronos@cylchtheori@tikzname4) {\chronos@cylchtheori@label@uchod};
    \node (label below \chronos@cylchtheori@tikzname) [%
      anchor=north, /chronos/theori/cylchau/@label
    ] at (\chronos@cylchtheori@tikzname5) {\chronos@cylchtheori@label@isod};
    \node (\chronos@cylchtheori@tikzname) [%
      fit=(label below \chronos@cylchtheori@tikzname) 
        (label above \chronos@cylchtheori@tikzname) 
        (\chronos@cylchtheori@tikzname4) 
        (\chronos@cylchtheori@tikzname5)%
    ] {};
    \chronos@ailosod@nodweddion
  \endgroup
}
%    \end{macrocode}
% \end{macro}%^^A >>>
% \begin{macro}{\prideitl}%^^A <<< 
%   That is, \cs{chronosmaintitle}.
%    \begin{macrocode}
\NewDocumentCommand \prifdeitl {  m }
{% 
  \begingroup
    \Undefine\chronos@prifdeitl@at
    \Undefine\chronos@prifdeitl@angor
    \tikzset{prif={#1}}%
    \IfExistF\chronos@prifdeitl@angor{\def\chronos@prifdeitl@angor{center}}%
    \IfExistTF\chronos@prifdeitl@tikzname{%
      \pgfqkeys{/chronos}{@tempd/.style={alias=prif deitl,alias=main title}}%
    }{%
      \def\chronos@prifdeitl@tikzname{prif deitl}%
      \pgfqkeys{/chronos}{@tempd/.style={alias=main title}}%
    }%
    \IfFreeT {\chronos@prifdeitl@cynnwys}{%
      \def\chronos@prifdeitl@cynnwys{%
        \chronos@enw@priflythrennu{\chronos@prifdeitl@enw}%
      }%
    }%
    \draw node (\chronos@prifdeitl@tikzname) [%
      draw=none,%
      /chronos/@tempd,%
      /chronos/prif/@teitl,%
      anchor=\chronos@prifdeitl@angor,%
      /utils/exec=\pgfkeysalsofrom{\chronos@cadw}%
    ] at (chronos@prifdeitl@at) {\chronos@prifdeitl@cynnwys};
    \ifchronos@showcoords
      \begin{scope}[on chronos overlay layer]
        \draw [help lines, draw=chronos@lliw@node] 
          (\chronos@prifdeitl@tikzname.north east) -| 
          (\chronos@prifdeitl@tikzname.south west) -| cycle;
        \node [%
          /chronos/show coordinate={chronos show node colour}{0}{%
            \chronos@prifdeitl@tikzname
          }{10pt}{align=center}%
        ] at (\chronos@prifdeitl@tikzname.east) {};
      \end{scope}%
    \fi
  \endgroup
}
%    \end{macrocode}
% \end{macro}%^^A >>>
% \begin{macro}{\gwybodaeth}%^^A <<< 
%   That is, \cs{chronosinfo}.
%    \begin{macrocode}
\NewDocumentCommand \gwybodaeth { s m }{%
  \begingroup
    \Undefine\chronos@gwybodaeth@angor
    \Undefine\chronos@gwybodaeth@at
    \let\chronos@cynnwys@testun\@empty
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@gwybodaeth@capsiwn
    \tikzset{gwybodaeth={enw={??},#2}}%
    \IfExistF \chronos@gwybodaeth@angor{\def\chronos@gwybodaeth@angor{west}}%%
    \IfExistF \chronos@gwybodaeth@capsiwn {%
      \def \chronos@gwybodaeth@capsiwn {%
        \chronos@enw@priflythrennu{\chronos@gwybodaeth@enw}%
      }%
    }%
    \IfExistF \chronos@gwybodaeth@lliw {%
      \let\chronos@gwybodaeth@lliw\chronos@gwybodaeth@lliw@rhagosodedig
    }%
    \node (testun \chronos@gwybodaeth@tikzname) [%
      /chronos/@testun=\chronos@gwybodaeth@lliw,%
      anchor=\chronos@gwybodaeth@angor,%
      /chronos/.cd,%
      /utils/exec=\pgfkeysalsofrom{\chronos@cadw},%
      alias=tag \chronos@gwybodaeth@tikzname,%
      alias=text tag \chronos@gwybodaeth@tikzname,%
      alias=\chronos@gwybodaeth@tikzname
    ] at (\chronos@gwybodaeth@at) {\chronos@cynnwys@testun};
    \IfBooleanF {#1}{%
      \node (capsiwn \chronos@gwybodaeth@tikzname) [%
        /chronos/gwybodaeth/@label,%
        alias=enw \chronos@gwybodaeth@tikzname,%
        alias=name \chronos@gwybodaeth@tikzname,%
        alias=label \chronos@gwybodaeth@tikzname,%
        alias=caption \chronos@gwybodaeth@tikzname
      ] at (\chronos@gwybodaeth@tikzname.south) {\chronos@gwybodaeth@capsiwn};
    }%
    \edef\chronos@tempa{lliw \chronos@gwybodaeth@tikzname}%
    \edef\chronos@tempe{colour \chronos@gwybodaeth@tikzname}%
    \edef\chronos@tempf{color \chronos@gwybodaeth@tikzname}%
    \edef\chronos@tempb{\chronos@gwybodaeth@lliw}%
    \xglobal\colorlet{\chronos@tempa}{\chronos@tempb}%
    \xglobal\colorlet{\chronos@tempe}{\chronos@tempb}%
    \xglobal\colorlet{\chronos@tempf}{\chronos@tempb}%
    \colorlet{chronos current tag colour}{\chronos@tempb}%
    \colorlet{chronos current tag color}{\chronos@tempb}%
    \chronos@ailosod@nodweddion
  \endgroup
}
%    \end{macrocode}
% \end{macro}%^^A >>>
% \begin{macro}{\hawlfraint}%^^A <<< 
%   That is, \cs{chronoscopyright}.
%    \begin{macrocode}
\NewDocumentCommand \hawlfraint { m }
{%
  \begingroup
    \Undefine\chronos@hawlfraint@at
    \Undefine\chronos@hawlfraint@enw
    \def\chronos@hawlfraint@angor{north west}%
    \def\chronos@hawlfraint@cylchdroi{90}%
    \tikzset{hawlfraint={#1}}%
    \IfExistF{\chronos@hawlfraint@notis}{%
      \ifchronos@copyleft
        \def\chronos@hawlfraint@notis##1##2{Copyleft \textcopyleft{} ##1 ##2}%
      \else
        \def\chronos@hawlfraint@notis##1##2{Copyright \textcopyright{} ##1 ##2}%
      \fi
    }%
    \IfExistF{\chronos@hawlfraint@at}{%
      \def\chronos@hawlfraint@at{current bounding box.south west}%
      \PackageWarning{chronos}{Placing copyright notice at bottom left }%
    }%
    \IfExistF {\chronos@hawlfraint@cynnwys}{%
      \IfBooleanExprTF { 
        \CSFreeBoolean \chronos@hawlfraint@enw 
        || ! (\CSFreeBoolean \chronos@hawlfraint@awdur) 
        || ! (\CSFreeBoolean \chronos@hawlfraint@blwyddyn) 
      }{%
        \IfExistF {\chronos@hawlfraint@awdur}{%
          \IfExistTF {\svnauthor} {%
            \IfExistTF {\svnFullAuthor} {%
              \def\chronos@hawlfraint@awdur{\svnFullAuthor{\svnauthor}}%
            }{%
              \let\chronos@hawlfraint@awdur\svnauthor
            }%
          }{%
            \def\chronos@hawlfraint@awdur{Author}%
          }%
        }%
        \IfExistF {\chronos@hawlfraint@blwyddyn}{%
          \IfExistTF {\svnyear} {%
            \let\chronos@hawlfraint@blwyddyn\svnyear
          }{%
            \let\chronos@hawlfraint@blwyddyn\today
          }%
        }%
        \def\chronos@hawlfraint@cynnwys{%
          \chronos@hawlfraint@notis{%
            \chronos@hawlfraint@blwyddyn
          }{%
            \chronos@hawlfraint@awdur
          }%
        }%
      }{%
        \def\chronos@hawlfraint@cynnwys{%
          \chronos@hawlfraint@notis{\chronos@hawlfraint@blwyddyn}{%
            \chronos@enw@priflythrennu{\chronos@hawlfraint@enw}%
          }%
        }%
      }%
    }%
    \IfExistTF{\chronos@hawlfraint@tikzname}{%
      \pgfqkeys{/chronos}{@tempd/.style={%
        alias=hawlfraint,%
        alias=copyright,%
        alias=copyleft%
      }}%
    }{%
      \def\chronos@hawlfraint@tikzname{hawlfraint}%
      \pgfqkeys{/chronos}{@tempd/.style={alias=copyright,alias=copyleft}}%
    }%
%    \end{macrocode}
%^^A     \draw node (\chronos@hawlfraint@tikzname) [draw=none,/chronos/@tempd, /chronos/@hawlfraint, anchor=\chronos@hawlfraint@angor,rotate/.expand once=\chronos@hawlfraint@cylchdroi,/utils/exec=\pgfkeysalsofrom{\chronos@cadw}] at (chronos@hawlfraint@at) {\chronos@hawlfraint@cynnwys};
%    \begin{macrocode}
    \draw node (\chronos@hawlfraint@tikzname) [%
      draw=none,%
      /chronos/@tempd,%
      /chronos/@hawlfraint,%
      anchor=\chronos@hawlfraint@angor,%
      rotate=\chronos@hawlfraint@cylchdroi,%
      /utils/exec=\pgfkeysalsofrom{\chronos@cadw}%
    ] at (chronos@hawlfraint@at) {\chronos@hawlfraint@cynnwys};
    \ifchronos@showcoords
      \begin{scope}[on chronos overlay layer]
        \draw [help lines, draw=chronos@lliw@node] 
          (\chronos@hawlfraint@tikzname.north east) -| 
          (\chronos@hawlfraint@tikzname.south west) -| cycle;
        \node [%
          /chronos/show coordinate={chronos show node colour}{0}{%
            \chronos@hawlfraint@tikzname
          }{10pt}{align=center}%
        ] at (\chronos@hawlfraint@tikzname.east) {};
      \end{scope}%
    \fi
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\chronoscopyleft}
%   Variant of \cs{chronoscopyright}.
%    \begin{macrocode}
\NewDocumentCommand \chronoscopyleft { m }{%
  \begingroup
    \chronos@copylefttrue
    \hawlfraint {#1}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}%^^A >>>
% \begin{macro}{\chronos@dyddiadau@tag}%^^A <<< \chronos@dyddiadau@tag
%   Internal macro to figure out date format for tags.
% 
%   \#1 : tag e.g.~byw / parhad ;
%   \#2 first date counter e.g.~geni / thing ;
%   \#3 first label e.g.~geni / dechrau ;
%   \#4 second date counter e.g.~marw / otherthing ;
%   \#5 second label e.g.~marw / diwedd
%    \begin{macrocode}
\protected\def \chronos@dyddiadau@tag #1#2#3#4#5{%
  \IfCSExistTF{chronos@#1@label#3}{%
    \IfCSExistF{chronos@#1@label#5}{%
      \expandafter\def\csname chronos@#1@label#5\endcsname{%
        \chronos@showdate@cs[chronos@#1@fformat#5]{#4}%
      }%
    }%
  }{%
    \IfCSExistF{chronos@#1@label#5}{% creu label yr ail ddyddiad
      \expandafter\def\csname chronos@#1@label#5\endcsname{%
        \chronos@showdate@cs[chronos@#1@fformat#5]{#4}%
      }%
    }%
    \edef\tempa{}\edef\tempb{\csname chronos@#1@label#5\endcsname}%
    \ifx\tempa\tempb
      \expandafter\def\csname chronos@#1@label#3\endcsname{%
        \chronos@showdate@cs[chronos@#1@fformat#3@cyfnodau]{#2}%
      }%
    \else
      \expandafter\ifnum\csname chronos@#2year\endcsname<0
        \expandafter\ifnum\csname chronos@#4year\endcsname<0
          \expandafter\def\csname chronos@#1@label#3\endcsname{%
            \chronos@showdate@cs[chronos@#1@fformat#3@cyfnod]{#2}%
          }%
        \else
          \expandafter\def\csname chronos@#1@label#3\endcsname{%
            \chronos@showdate@cs[chronos@#1@fformat#3@cyfnodau]{#2}%
          }%
        \fi
      \else
        \expandafter\def\csname chronos@#1@label#3\endcsname{%
          \chronos@showdate@cs[chronos@#1@fformat#3@cyfnod]{#2}%
        }%
      \fi
    \fi
  }%
  \ifchronos@dimondblynyddoedd
    \edef\chronos@tempp{\csname chronos@#2year\endcsname}%
    \edef\chronos@tempq{\csname chronos@#4year\endcsname}%
    \ifnum\chronos@tempp=\chronos@tempq\relax 
      \chronos@temptrue
    \else
      \chronos@tempfalse
    \fi
  \else
    \ifnum\value{chronos@#2date}=\value{chronos@#4date}%^^A only catches identical blynyddoedd - dal i edrych yn dwp pan dim ond blynyddoedd yn cael eu dangos & maen' nhw'n yr un peth
      \chronos@temptrue
    \else
      \chronos@tempfalse
    \fi
  \fi
}
%    \end{macrocode}
% \end{macro}%^^A >>> \chronos@dyddiadau@tag
% \begin{macro}{\chronos@gosodborder@tag}%^^A <<< \chronos@gosodborder@tag
%   Internal macro to install connection point on timeline border.
%    \begin{macrocode}
\protected\def \chronos@gosodborder@tag#1{%
  \csname ifchronos@#1@isod\endcsname
    \ifchronos@yearsonline
      \def\chronos@border@coord{chronos base}%
      \def\chronos@border@coord@inv{chronos top}%
      \expandafter\setlength\csname chronos@#1@border\endcsname{%
        -\chronos@borderheight}%
      \expandafter\setlength\csname chronos@#1@border@inv\endcsname{%
        \chronos@borderheight}%
    \else
      \def\chronos@border@coord{chronos top}%
      \def\chronos@border@coord@inv{chronos base}%
      \expandafter\setlength\csname chronos@#1@border\endcsname{%
        -\chronos@height}%
      \expandafter\setlength\csname chronos@#1@border@inv\endcsname{%
        \chronos@height}%
    \fi
  \else
    \ifchronos@yearsonline
      \def\chronos@border@coord{chronos top}%
      \def\chronos@border@coord@inv{chronos base}%
      \expandafter\setlength\csname chronos@#1@border\endcsname{%
        \chronos@borderheight}%
      \expandafter\setlength\csname chronos@#1@border@inv\endcsname{%
        -\chronos@borderheight}%
    \else
      \def\chronos@border@coord{chronos base}%
      \def\chronos@border@coord@inv{chronos top}%
      \expandafter\setlength\csname chronos@#1@border\endcsname{%
        \chronos@height}%
      \expandafter\setlength\csname chronos@#1@border@inv\endcsname{%
        -\chronos@height}%
    \fi
  \fi
}
%    \end{macrocode}
% \end{macro}%^^A >>> \chronos@gosodborder@tag
% \begin{macro}{\chronos@troilliwiau@tag}%^^A <<< & configure isod/uchod 
%   Internal macro to rotate colours and configure below/above split, as applicable. 
%    \begin{macrocode}
\protected\def \chronos@troilliwiau@tag#1{%^^A <<<
  \IfCSExistTF {chronos@#1@at}{%
    \edef\chronos@tempj{\csname chronos@#1@at\endcsname}%
    \path (\chronos@tempj) ++(0pt,\chronos@yshift);
    \pgfgetlastxy{\chronos@templgtha}{\chronos@templgthb}%
    \ifdim\chronos@templgthb>0pt\relax
      \expandafter\global\csname chronos@#1@isodfalse\endcsname
    \else
      \ifdim\chronos@templgthb<0pt\relax
        \expandafter\global\csname chronos@#1@isodtrue\endcsname
      \fi
    \fi
    \def\chronos@yshift@inv{-\chronos@yshift}%
  }{%
    \ifchronos@tag@cysylltu
      \CSletCS {chronos@#1@at}{chronos@#1@tikzname}%^^A uses temporary coordinate at this point but will be aligned horizontally
    \else
      \expandafter\def\csname chronos@#1@at\endcsname{chronos origin}%
      \PackageWarning{chronos}{Aligning #1 text tag with (chronos origin). 
        Set at to avoid this}%
    \fi
    \ifdim\chronos@yshift>0pt\relax
      \expandafter\global\csname chronos@#1@isodfalse\endcsname
      \def\chronos@yshift@inv{-\chronos@yshift}%
    \else
      \ifdim\chronos@yshift<0pt\relax
        \expandafter\global\csname chronos@#1@isodtrue\endcsname
        \def\chronos@yshift@inv{-\chronos@yshift}%
      \else
        \ifdim\chronos@testun@yshift=0pt\relax
          \PackageWarning{chronos}{%
            Tag will be placed at the timeline's vertical centre. 
            Set non-zero yshift or text tag yshift or set at to avoid this%
          }%
        \fi
        \chronos@legacy@if{chronos@#1@isod}{% cheat!
          \pretocmd\chronos@cadw{yshift=-\chronos@testun@yshift,}{}{}%
          \def\chronos@yshift@inv{\chronos@testun@yshift}%
        }{%
          \pretocmd\chronos@cadw{yshift=\chronos@testun@yshift,}{}{}%
          \def\chronos@yshift@inv{-\chronos@testun@yshift}%
        }% if chronos@#1isod
      \fi % if yshift<0pt
    \fi % if yshift>0pt
  }%
  \IfCSFreeT{chronos@#1@lliw}{%^^A \ifcsunef is T even if cs is \relax (unlike \ifcsdef which is also T if cs is \relax)
    \expandafter\ifchronos@troilliwiau
      \csname ifchronos@#1@isod\endcsname
        \chronos@troilliwiau@isod{#1}
      \else
        \chronos@troilliwiau@uchod{#1}%
      \fi
    \else
      \CSletCS{chronos@#1@lliw}{chronos@#1@lliw@rhagosodedig}%
    \fi
  }%
  \edef\chronos@tempa{lliw \csname chronos@#1@tikzname\endcsname}%
  \edef\chronos@tempb{\csname chronos@#1@lliw\endcsname}%
  \edef\chronos@tempe{colour \csname chronos@#1@tikzname\endcsname}%
  \edef\chronos@tempf{color \csname chronos@#1@tikzname\endcsname}%
  \xglobal\colorlet{\chronos@tempa}{\chronos@tempb}%
  \xglobal\colorlet{\chronos@tempe}{\chronos@tempb}%
  \xglobal\colorlet{\chronos@tempf}{\chronos@tempb}%
  \colorlet{chronos current tag colour}{\chronos@tempb}%
  \colorlet{chronos current tag color}{\chronos@tempb}%
  \ifchronos@enwaulliwsyml
    \edef\chronos@tempg{\csname chronos@#1@tikzname\endcsname}%
    \xglobal\colorlet{\chronos@tempg}{\chronos@tempb}%
  \fi
}%^^A >>>
%    \end{macrocode}
% \end{macro}%^^A >>> \chronos@troilliwiau@tag
% \begin{macro}{\chronos@gosod@angor@tag}%^^A <<< 
%   Internal macro to add connector to tag anchors. 
%    \begin{macrocode}
\protected\def\chronos@gosodangor@tag#1{%i^^A <<<
  \IfCSExistTF{chronos@#1@angor}{%
    \expandafter\edef\expandafter\chronos@tempa\expandafter{%
      \csname chronos@#1@angor\endcsname
    }%
    \foreach \i/\j in {%
      north/south,%
      south/north,%
      east/west,%
      west/east,%
      north west/south east,%
      south east/north west,%
      north east/south west,%
      south west/north east%
    }{%
      \edef\chronos@tempb{\i}%
      \ifx\chronos@tempa\chronos@tempb
        \global\CSlet{chronos@#1@invanchor}\j\breakforeach
      \fi
    }%
  }{%
    \csname ifchronos@#1@isod\endcsname
      \expandafter\def\csname chronos@#1@angor\endcsname {north}%
      \expandafter\def\csname chronos@#1@invanchor\endcsname {south}%
    \else
      \expandafter\def\csname chronos@#1@angor\endcsname {south}%
      \expandafter\def\csname chronos@#1@invanchor\endcsname {north}%
    \fi
  }%
}%^^A >>>
%    \end{macrocode}
% \end{macro}%^^A >>>
% \begin{macro}{\chronos@creu@llinell}%^^A <<< parhad, byw
%   Internal macro to put new life or period on timeline. 
%
%   \#1 : tag e.g.~byw
%   \#2 : x dimen dechrau/geni
%   \#3 : x dimen diwedd/marw
%   \#4 : i greu enw cyntaf e.g.~dechrau/geni
%   \#5 : i greu'r ail enw e.g.~diwedd/marw
%   \#6 : i greu alias cyntaf e.g.~start/birth
%   \#7 : i greu'r ail alias e.g.~end/death
%    \begin{macrocode}
\protected\def \chronos@creu@llinell #1#2#3#4#5#6#7{%^^A <<< fill (fallai draw)} llinell ar y llinell amser am dymor estynedig
%    \end{macrocode}
%    \begin{macrocode}
  \expandafter\let\expandafter\chronos@tempa\csname chronos@#1@tikzname\endcsname
  \edef\chronos@tempd{\csname chronos@#1@tikzname\endcsname-inv}%
  \expandafter\let\expandafter\chronos@tempb\csname chronos@#1@border\endcsname
  \expandafter\let\expandafter\chronos@tempc\csname chronos@#1@border@inv\endcsname
  \advance\chronos@llinell@yshift by \chronos@llinell@add@yshift
  \begin{scope}[/chronos/chronos@llinell@haenen]
    \ifchronos@yearsonline
%    \end{macrocode}
%^^A       \IfFreeF\bagpuss{\pgfkeys{/chronos/@llinell/.show code}}
%    \begin{macrocode}
      \path [/chronos/@llinell/.expand once=\csname chronos@#1@lliw\endcsname] %
        ({#2,0} |- \chronos@border@coord) -- +(0pt,\chronos@tempb) coordinate %
        (\chronos@tempa{} #4) -| ({#3,0} |- \chronos@border@coord) coordinate %
        [midway] (\chronos@tempa{} #5) -- cycle;
    \else
      \path [/chronos/@llinell/.expand once=\csname chronos@#1@lliw\endcsname] %
        ({#2,0} |- \chronos@border@coord) ++(0pt,\chronos@tempb) %
        ++(0pt,\chronos@llinell@yshift) coordinate (\chronos@tempa{} #4) -- %
        ({#3,0} |- \chronos@tempa{} #4) coordinate  (\chronos@tempa{} #5);
    \fi
    \ifchronos@eventdatessplit
      \ifchronos@yearsonline
        \path [/chronos/@llinell/.expand once=\csname chronos@#1@lliw\endcsname] %
          ({#2,0} |- \chronos@border@coord@inv) -- +(0pt,\chronos@tempc) %
          coordinate (\chronos@tempd{} #4) -| ({#3,0} |- \chronos@border@coord@inv) %
          coordinate [midway] (\chronos@tempd{} #5) %
          -- cycle;
      \else
        \path [/chronos/@llinell/.expand once=\csname chronos@#1@lliw\endcsname] %
          ({#2,0} |- \chronos@border@coord@inv) ++(0pt,\chronos@tempc) %
          ++(0pt,-\chronos@llinell@yshift) coordinate (\chronos@tempd{} #4) -- %
          ({#3,0} |- \chronos@tempd{} #4) coordinate [midway] %
          (\chronos@tempd{} #5);
      \fi
    \fi
%    \end{macrocode}
% \changes{v0.9.3}{2025-07-09}{Add helper coordinates for placing things relative to life/period lines, including provisional coordinates for getting \texttt{x} only.}
% Re-define the start/end coordinates to correct \texttt{y}.
%    \begin{macrocode}
  \end{scope}%
  \coordinate [alias=#6 \chronos@tempa] (#4 \chronos@tempa) at (\chronos@tempa{} #4);
  \coordinate [alias=#7 \chronos@tempa] (#5 \chronos@tempa) at (\chronos@tempa{} #5);
}%^^A >>>
%    \end{macrocode}
% \end{macro}%^^A >>> \chronos@creu@llinell (parhad, byw)
% \begin{macro}{\chronos@creu@testun@tag}%^^A <<< 
%   Internal macro to create text tags. 
%   \changes{v0.9.3}{2025-07-18}{Use \cs{def}\ rather than \cs{NewDocumentCommand}\ to maybe  (or not) keep somebody or something happy in the unlikely event she, he, they or it should ever happen by.}
%    \begin{macrocode}
\protected\long\def \chronos@creu@testun@tag#1#2#3{%^^A <<< make text tag
  % #1 : allweddu ychwanegol | additional keys
  % #2 : tag e.g. byw
  % #3 : testun | text
  \ifchronos@phantom
    \relax
  \else
    \expandafter\let\expandafter\chronos@tempa\csname chronos@#2@tikzname\endcsname
    \expandafter\let\expandafter\chronos@tempb\csname chronos@#2@at\endcsname
    \ifchronos@hollti@testun@tag
      \edef\chronos@tempa{\csname chronos@#2@tikzname\endcsname-inv}%
      \expandafter\let\expandafter\chronos@tempc\csname chronos@#2@invanchor\endcsname
      \pgfqkeys{/chronos}{%
        chronos@tempa@style/.style={/chronos/event date split},% oedd yshcale=-1,...
        chronos@tempb@style/.style={yshift=2*\chronos@yshift@inv}}%
        \path (\chronos@tempb);
        \pgfgetlastxy {\chronos@templgtha}{\chronos@templgthb}%
        \ifdim\chronos@templgthb>0pt
          \coordinate (chronos@temp@coord) at (\chronos@templgtha,-\chronos@templgthb);
        \else
          \coordinate (chronos@temp@coord) at (\chronos@templgtha,\chronos@templgthb);
        \fi
    \else
      \expandafter\let\expandafter\chronos@tempc\csname chronos@#2@angor\endcsname
      \pgfqkeys{/chronos}{%
        chronos@tempa@style/.style={#1},
        chronos@tempb@style/.style={#1}}%
      \coordinate (chronos@temp@coord) at (\chronos@tempb);
    \fi
%    \end{macrocode}
% ateb Symbol 1: \url{https://tex.stackexchange.com/a/385953/}
%    \begin{macrocode}
    \scoped[/chronos/middle anchorborder]{% 
%    \end{macrocode}
% \verb|fill opacity=0 -> problem| ; \verb|fill=none -> dim problem|; beth sy'n digwydd?
%
% for some reason \verb|fill opacity=0| causes a problem, whereas \verb|fill=none| does not, but why?
%    \begin{macrocode}
      \node (testun \chronos@tempa) [%
        /chronos/@testun/.expand once=\csname chronos@#2@lliw\endcsname,%
        anchor=\chronos@tempc,%
        /chronos/.cd,/utils/exec=\pgfkeysalsofrom{\chronos@cadw},%
        /chronos/chronos@tempb@style,%
        /tikz/.cd,%
        alias=tag \chronos@tempa,%
        alias=text tag \chronos@tempa
    ] at (chronos@temp@coord) {#3};}%
    \ifchronos@tag@cysylltu
%    \end{macrocode}
% creu cylch ar y lein \textbar{} make circle on timeline
%    \begin{macrocode}
      \scoped[/chronos/chronos@cysylltiad@haenen]{%
        \node (cysylltwr chronos \chronos@tempa) [%
          /chronos/@cysylltwr@chronos/.expand once=\csname chronos@#2@lliw\endcsname,%
          alias=chronos connector \chronos@tempa,%
          alias=circle \chronos@tempa,%
          alias=cylch \chronos@tempa
        ] at (\chronos@tempa) {};%
      }%
%    \end{macrocode}
%  ateb Symbol 1: \url{https://tex.stackexchange.com/a/385953/}
%    \begin{macrocode}
      \begin{scope}[/chronos/middle anchorborder]%
%    \end{macrocode}
% creu cysylltwyr testun ar y node testun \textbar{} make text connectors on the text node
%    \begin{macrocode}
        \node (cysylltwr testun \chronos@tempa) [%
          /chronos/@cysylltwr@testun/.expand once=\csname chronos@#2@lliw\endcsname,%
          /chronos/@cysylltwr@testun@prif/.expand once=\csname chronos@#2@lliw\endcsname,%
          alias=text tag connector \chronos@tempa,%
          alias=prif gysylltwr \chronos@tempa,%
          alias=main connector \chronos@tempa,%
          alias=cysylltwr \chronos@tempa0,%
          alias=testun cylch \chronos@tempa,%
          alias=connector \chronos@tempa0
        ] at (testun \chronos@tempa.middle \chronos@tempc) {};
      \end{scope}%
      \path (cysylltwr testun \chronos@tempa);
      \pgfgetlastxy{\chronos@templgtha}{\chronos@templgthb}%
      \path (cysylltwr chronos \chronos@tempa);
      \pgfgetlastxy{\chronos@templgthc}{\chronos@templgthb}%
      \ifdim\chronos@templgtha=\chronos@templgthc
        \def\chronos@tempe{--}
      \else
        \def\chronos@tempe{|-}
      \fi
      \ifbool{chronos@#2@cysylltiad}{%
%    \end{macrocode}
% cysylltu llinell amser i node testun \textbar{} connect timeline to text node
%    \begin{macrocode}
        \scoped[/chronos/chronos@cysylltiad@haenen]{%
          \draw [%
            /chronos/@cysylltiad/.expand once=\csname chronos@#2@lliw\endcsname
          ] (cysylltwr chronos \chronos@tempa) \chronos@tempe 
          (cysylltwr testun \chronos@tempa) ;%
        }%% oedd .\chronos@tempc
      }{}% ifchronos@#2@cysylltiad
    \fi % \ifchronos@tag@cysylltu
  \fi
%    \end{macrocode}
%^^A   \edef\chronos@tempa{\csname chronos@#3@tikzname\endcsname}%
%^^A   \edef\chronos@tempb{lliw \csname chronos@#3@tikzname\endcsname}%
%^^A   \colorlet{chronos@temp@lliw}{\chronos@tempb}%
%^^A   \chronos@darparu@lliw{\chronos@tempa}{chronos@temp@lliw}%
%^^A   \draw (cylch \chronos@tempa) |- (cysylltwr testun \chronos@tempa.\chronos@tempc) ;
%    \begin{macrocode}
}%^^A >>>
%    \end{macrocode}
% \end{macro}%^^A >>> \chronos@creu@testun@tag
% \begin{macro}{\chronosevent,\chronoslife,\chronosperiod,\chronosinfo,\chronostheory,\chronostheorycircle,\chronosmaintitle,\chronoscopyright,\chronosshowpreset,\chronosshowcolor,\chronosshowfeatures}%^^A <<<  aliases & (globalised) defaults
%   Aliases and globalised defaults.
%   Note these are the documented forms.
%    \begin{macrocode}
\AtEndPreamble{%
  \@ifpackageloaded{memoize}{%
    \mmzset{%
      auto={chronos}{memoize},
    }%
  }{% nid yw hyn yn memoizable byth bynnag
    \pgfkeys{/handlers/.meaning to context/.code={}}%
  }%
  \ifchronos@byw@isod
    \chronos@byw@isod@rhagtrue
  \else
    \chronos@byw@isod@rhagfalse
  \fi
  \ifchronos@digwyddiad@isod
    \chronos@digwyddiad@isod@rhagtrue
  \else
    \chronos@digwyddiad@isod@rhagfalse
  \fi
  \ifchronos@parhad@isod
    \chronos@parhad@isod@rhagtrue
  \else
    \chronos@parhad@isod@rhagfalse
  \fi
  \chronos@lliwiau@cadw@rhag
  \IfExistF \chronosevent{\let\chronosevent\digwyddiad}%
  \IfExistF \chronoslife{\let\chronoslife\byw}%
  \IfExistF \chronosperiod{\let\chronosperiod\parhad}%
  \IfExistF \chronosinfo{\let\chronosinfo\gwybodaeth}%
  \IfExistF \chronostheory{\let\chronostheory\theori}%
  \IfExistF \chronostheorycircle{\let\chronostheorycircle\cylchtheori}%
  \IfExistF \chronosmaintitle{\let\chronosmaintitle\prifdeitl}%
  \IfExistF \chronoscopyright{\let\chronoscopyright\hawlfraint}%
  \IfExistF \chronosshowpreset{\let\chronosshowpreset\chronos@dangos@gosod}%
  \IfExistF \chronosshowcolor{\let\chronosshowcolor\chronosshowcolour}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\chronosshowfeatures}
%   Debugging.
%    \begin{macrocode}
  \ProvideDocumentCommand \chronosshowfeatures { o }{%
    \IfValueTF {#1} {%
      \chronos@dangos@nodweddion{#1}
    }{%
      \chronos@dangos@nodweddion@rhag
    }%
  }%
%    \end{macrocode}
% \end{macro}
%   Required colours for \cs{chronosshowfeatures}. 
%    \begin{macrocode}
  \providecolor{chronos show coordinate colour}{named}{chronos@lliw@coord}%
  \providecolor{chronos show node colour}{named}{chronos@lliw@node}%
  \providecolor{chronos show coordinate color}{named}{chronos@lliw@coord}%
  \providecolor{chronos show node color}{named}{chronos@lliw@node}%
%    \end{macrocode}
% \begin{macro}{\ceyearlabel,\bceyearlabel,\celabel,\bcelabel,\tlstyle,\plstyle,\sishape,\textsi,\uishape,\textui}
%   Globalised defaults.
%    \begin{macrocode}
  \IfExistF \ceyearlabel {\let\ceyearlabel\chronos@yearce}%
  \IfExistF \bceyearlabel {\let\bceyearlabel\chronos@yearbce}%
  \IfExistF \celabel {\let\celabel\chronos@ce}%
  \IfExistF \bcelabel {\let\bcelabel\chronos@bce}%
  \IfExistF \tlstyle {\let\tlstyle\upshape}%
  \IfExistF \plstyle {\let\plstyle\upshape}%
  \IfExistF \sishape {\DeclareRobustCommand\sishape{\itshape\scshape}}%
  \IfExistF \textsi {\DeclareTextFontCommand{\textsi}{\sishape}}%
  \IfExistF \uishape {\let\uishape\itshape}%
  \IfExistF \textui {\DeclareTextFontCommand{\textui}{\uishape}}%
}
%    \end{macrocode}
% \end{macro}%^^A >>> aliases & globalised defaults
%^^A END macros y ddogfen >>>
%    \begin{macrocode}
\chronos@presetfalse
%    \end{macrocode}
% ^^A >>> chronos (pkg)
% \iffalse
%</sty>
% \fi
% 
% 
% \iffalse
%<*sty-styles>
% \fi
% \section[chronos-lib-styles]{\lpack{chronos-lib-styles}}\label{sec:cod-styles}%^^A <<< (pkg)
% Styles.
% \changes{v0.9.2}{2025-03-15}{Fix info reported for \texttt{chronos-lib-styles.sty}.}
%    \begin{macrocode}
\RequirePackage{chronos}
\ProvidesPackageSVN[chronos-lib-styles.sty]{$Id: chronos-code.dtx 11797 2026-03-21 16:01:38Z cfrees $}[v0.9.4 \revinfo]
\pgfqkeys{/chronos}{%^^A BEGIN styles <<<
%    \end{macrocode}
% Styles come in three flavours: on-line, off-line and no-year.
% \subsubsection{On-line}\label{subsubsec:cod-styles-online}
%^^A  % BEGIN on line styles
% \begin{chronosstyle}{modern,lavender menace,serif on line,rainbow serif,sober judge}
% Years are marked on the timeline itself.
%    \begin{macrocode}
  modern/.style={% <<<
    /chronos/.cd,
    modern/.meaning to context,
    colour scheme=modern,
    no colour rotation,
    timeline={%
      dates=1500:1900,
      timeline years=on line,
      timeline line={chronos timeline background colour, opacity=1},
      timeline height'=5mm,
      timeline marks,
      timeline border height'=5pt,
      major step font=\sffamily\bfseries\small,
      minor step font=\sffamily\bfseries\footnotesize,
      eras font=\sffamily\bfseries,
      timeline mark={line width=.4pt, shorten <=-2pt, shorten >=0pt},
      timeline minor mark={line width=.2pt, shorten <=-2pt, shorten >=0pt},
    },
    every chronos connectors'=coordinate,
    every text tag connectors+={circle, anchor=center, draw=none,%
      fill=none, minimum size=\pgflinewidth},
    connections={draw=##1, {Triangle[width=0pt 3,reversed,length=0pt 1.5]}-%
      {Triangle[width=0pt 5,reversed,length=0pt 2.5]}},
    period/line={fill=chronos timeline foreground colour, blend mode=overlay},
    life/line={fill=chronos timeline foreground colour, blend mode=overlay},
    event/line={draw=chronos timeline foreground colour, thick, blend mode=overlay},
    every text tags={fill=chronos main background colour, text=####1,%
      fill opacity=.75, text opacity=1, draw=none, rounded corners,%
      align=center, font=\sffamily\footnotesize},
    only years,
    without eras,
    connections on=background,
    subheadings style={align=center, anchor=base, inner sep=0pt, outer sep=0pt,%
      text=chronos main colour!75!chronos main background colour, opacity=.8,%
      font=\sffamily\footnotesize},
    headings style={align=center, anchor=base, inner sep=0pt, outer sep=0pt,%
      text=chronos main colour!75!chronos main background colour, opacity=.8,%
      font=\sffamily\bfseries\small},
    main/frame={inner sep=5pt, ultra thick, draw=chronos main colour,%
      fill=none,},% oedd chronos@prifliw@cefndir
    main/title={/chronos/main/@frame, font=\sffamily\huge\bfseries, %
      text=chronos main colour, anchor=center, align=center,%
      draw=chronos main colour,ultra thick,drop shadow,%
      fill=chronos main background colour,fill opacity=1},
    headings drops'=10pt:10pt:7.5pt,
    bce year label=BCE,
    ce year label=CE,
    levels=3:3,
  },% >>>
  lavender menace/.style={% <<<
    /chronos/.cd,
    lavender menace/.meaning to context,
    modern,
    colour scheme=lavender,
    rotate all colours,
    every text tags+={draw=####1,sharp corners,text opacity=1,%
      fill opacity=1,draw opacity=1,drop shadow},
    period/line+={top color=chronosSilver,%
      bottom color=chronos timeline border outer colour,fill opacity=1},
    life/line+={top color=chronosSilver,%
      bottom color=chronos timeline border outer colour,fill opacity=1},
    main/title+={text=chronos main colour!75!chronosDarkGray},
  },% >>>
  serif on line/.style={% <<<
    /chronos/.cd,
    serif on line/.meaning to context,
    no colour rotation,
    colour scheme=default,
    text tag connectors'={fill=##1, opacity=1, circle, minimum size=2.5pt,%
      anchor=center, inner sep=0pt, outer sep=0pt},
    chronos connectors'={fill=##1, opacity=.75, circle, minimum size=2.5pt,%
      anchor=center, inner sep=0pt, outer sep=0pt},
    timeline ce label={CE},
    timeline bce label={BCE},
    special date=none,
    timeline={%
      start date={1800-01-01},
      end date={1900-01-01},
      timeline years=on line,
      timeline marks,
      timeline year={text=chronos timeline foreground colour, align=center},
      timeline mark={draw=chronos timeline foreground colour, thick, shorten >=2.5pt},
      timeline minor mark={draw=chronos timeline foreground colour,%
        thick, shorten >=3.5pt},
      timeline bare mark={draw=chronos timeline foreground colour,%
        semithick, shorten >=2pt, shorten <=2pt},
      minor years,
      step divisions=2,
      timeline line={chronos timeline background colour},
      major step font=\normalfont\bfseries,
      minor step font=\normalfont\bfseries\small,
      eras font=\normalfont\bfseries,
    },
    headings style={text=chronos main colour!75!chronos main background colour,%
      font=\footnotesize\uishape},
    subheadings style={font=\scriptsize\uishape,%
      text=chronos main colour!75!chronos main background colour},
    event/text tag+={font=\small\scshape},
    period/text tag+={font=\small\scshape},
    life/text tag+={font=\small\scshape},
    period/line+={fill=##1, fill opacity=.25},
    life/line+={fill=##1, fill opacity=.25},
    every text tags+={text=####1!75!black},%^^A add global default o/w ignored (ond nid eisiau inner sep=0pt)
    levels=3:3,
    main/title={font=\Large\bfseries,text=chronos main colour,draw=none},
    frame,
    main/frame={draw=chronos timeline background colour, ultra thick},
  },% >>>
  rainbow serif/.style={% <<<
    /utils/exec={\selectcolormodel{rgb}},
    /chronos/.cd,
    rainbow serif/.meaning to context,
    serif on line,
    colour scheme=xcolseries,
    rotate all colours,
    timeline={%
      dates=1500:2100,
      timeline mark eras,
      timeline bare marks=false,
    },
    only years,
    without eras,
  },% >>>
  sober judge/.style={% <<<
    /chronos/.cd,
    sober judge/.meaning to context,
    colour scheme=sobriety,
    timeline={%
      start date=1001-10-01,
      end date=1003-06-14,
      step years=1,
      step divisions=6,
      timeline minor marks,
      timeline bare marks,
    },
    ce year label=CE,
    levels=3:3,
    no colour rotation,
    every connections'={draw=####1,%
      -{Triangle[width=1.5pt, reversed, length=.75pt, fill=####1]}},
    every text tags'={fill opacity=.75,%
      fill=####1!25, draw=####1, rounded corners,%
      font=\footnotesize\sffamily, text=chronos timeline foreground colour},
    main/title={font=\sffamily\bfseries\LARGE, text=chronos main colour},
    main/frame={draw=chronos main colour, line width=1pt, rounded corners},
    headings style={font=\rmfamily\small\itshape,%
      text=chronos main colour!75!chronos main background colour},
    subheadings style={/chronos/@amseraumawr,font=\scriptsize\rmfamily\itshape},
    every lines+={fill=none,draw=none},
  },% >>>
%    \end{macrocode}
% \end{chronosstyle}
%^^A  % END on line styles
% \subsubsection{Off-line}\label{subsubsec:cod-styles-offline}
% Years are marked somewhere off the timeline e.g.\ just above or below.
% \begin{chronosstyle}{somewhat plain,contemporary 90,blues below,flipping blues,rotated 90,off line colour,off line colour alt,off line simple,simple arrow,event splitter}
%^^A  % BEGIN off line styles
%    \begin{macrocode}
  somewhat plain/.style={%^^A <<<
    /chronos/.cd,
    somewhat plain/.meaning to context,
    no colour rotation,
    colour scheme=default,
    timeline={%
      major step font=\normalfont\sffamily\small\bfseries,
      minor step font=\normalfont\sffamily\footnotesize,
      eras font=\normalfont\normalsize\sffamily,
      timeline width'=100mm,
      timeline years=above,
      timeline ce label={CE},
      timeline bce label={BCE},
      timeline margin'=12.5pt,
      minor years=false,
      start=-500,
      end=2050,
      timeline year={inner xsep=0pt},
    },
    special date=none,
    ce year label={CE},
    bce year label={BCE},
    text tag yshift'=-10pt,
    every text tags+={fill=chronos main background colour,fill opacity=.25,%
      text opacity=1,font=\sffamily\small},
    every connections+={draw=####1,%
      {Triangle[width=0pt 3,reversed,length=0pt 1.5]}-%
      {Triangle[width=0pt 3,reversed,length=0pt 1.5]}},
    every event below,
    every period below,
    every life below,
    levels=0:3,
    frame,
    headings style={font=\footnotesize\sffamily,%
      text=chronos main colour!75!chronos main background colour},
    subheadings style={/chronos/@amseraumawr,font=\scriptsize\sffamily},
    main/frame={draw=chronos main colour!75!chronos main background colour,semithick},
    main/title={/chronos/main/title lines={%
        draw=chronos main colour!50!chronos main background colour,%
        thick},%
      text=chronos main colour!75!chronos main background colour,%
      font=\Large\sffamily,},
    headings drops'=12pt:10pt:7.5pt,
    headings border'=30pt,
  },%^^A >>>
  contemporary 90/.style={%^^A <<<
    /chronos/.cd,
    contemporary 90/.meaning to context,
    colour scheme=contninety,
    every text tags+={text=####1,font=\sffamily},
    every lines+={line width=1pt},
    no colour rotation,
    timeline={%
      start date=2002-01-01,
      end date=2016-12-31,
      timeline arrow,
      conditional timeline arrow={%
        timeline/timeline width-=3pt+4.5\timelineht,
        timeline/timeline line+={shorten >={-3pt-4.5\timelineht}, -Stealth},
        before headings+={%
          \path (chronos post) -- +(3pt+4.5\timelineht,0pt);
        },
      }{},
      timeline marks,
      timeline minor marks,
      timeline mark={ultra thick},
      timeline minor mark={thick},
      step divisions=4,
      step major years=2,
      timeline year={fill=none},
      timeline margin'=5mm,
      timeline width'=90mm,
      timeline year={rotate=90},
      major step font=\sffamily\upshape\tlstyle\bfseries,
      minor step font=\sffamily\upshape\tlstyle,
      eras font=\sffamily\upshape\tlstyle\bfseries,
      timeline years=above,
      timeline years anchor=west,
    },
    without eras,
    every event below,
    every life below,
    every period below,
    levels=0:3,
    frame,
    headings style={font=\small\sffamily\plstyle,%
      text=chronos main colour!80!chronos main background colour},
    subheadings style={font=\footnotesize\sffamily\plstyle,%
      text=chronos main colour!60!chronos main background colour},
    main/frame={%
      double=chronos timeline foreground colour!25!chronos timeline background colour,%
      draw=chronos timeline foreground colour!75!chronos timeline background colour,%
      thin},
    main/title={font=\sffamily\upshape\plstyle\bfseries\huge,text=chronos main colour},
  },%^^A >>>
  blues below/.style={%^^A <<<
    /utils/exec={\selectcolormodel{rgb}},
    /chronos/.cd,
    blues below/.meaning to context,
    colour scheme=blues,
    rotate all colours,
    timeline={%
      timeline years=above,
      timeline marks,
      timeline minor marks,
      step minor year=50,
      step divisions=10,
      step major year=100,
      dates=1550:2050,
      timeline height'=3pt,
      timeline line={chronos timeline foreground colour,%
        double=chronos timeline background colour,%
        line width=\timelineht/3,double distance=\timelineht/3},
      timeline arrow,
      conditional timeline arrow={%
        timeline/timeline line+={Bar-Latex,shorten <=-\timelineht/3,%
          shorten >=-3pt-2.1\timelineht},
        timeline/timeline width-={3pt+2.43\timelineht},
        before headings+={\path (chronos post) -- ++(3pt+2.1\timelineht,0pt) %
          coordinate (chronos arrow tip) (chronos pre) -- %
          ++(-\timelineht/3,0pt) coordinate (chronos arrow tail);},
      }{},
      timeline mark={chronos timeline foreground colour,line width=.6pt,shorten >=-4pt},
      timeline minor mark={chronos timeline foreground colour,%
        line width=.5pt,shorten >=-3.5pt},
      timeline bare mark={%
        chronos timeline foreground colour,line width=.3pt,shorten >=-2.5pt},
      timeline year={fill=none,text=chronos timeline foreground colour,%
        rotate around={45:(chronos year \chronosyeari |- chronos top)}},
      major step font=\sffamily\footnotesize\tlstyle,
      timeline years anchor=south west,
      minor step font=\sffamily\scriptsize\tlstyle,
      timeline margin'=17.5pt,
    },
    minor year format={!Y},
    every event below,
    every life below,
    every period below,
    levels=0:3,
    headings style+={%
      text=chronos main colour!75!chronos main background colour,%
      font=\small\itshape\bfseries,%
    },
    subheadings style+={%
      text=chronos main colour!75!chronos main background colour,%
      font=\footnotesize\itshape,%
    },
    main/title+={%
      font=\LARGE,text=chronos timeline foreground colour,%
      draw=chronos timeline background colour,semithick,%
    },
    main/frame+={%
      thick,draw,chronos timeline foreground colour,%
      double=chronos timeline background colour,%
    },
    copyright={font=\footnotesize\sffamily, inner sep=0pt, outer sep=0pt,%
      text=chronos timeline foreground colour!50!chronos main background colour},
    copyright/rotate=90,
    copyright/tag anchor=north west,
  },%^^A >>>
  timeline year rotate/.code={%
  },
  flipping blues/.style={%^^A <<<
    /chronos/.cd,
    flipping blues/.meaning to context,
    blues below,
    timeline={%
      timeline years=below,
      timeline year={%
        fill=none,rotate around={-90:(chronos year \chronosyeari)},%
        text=chronos timeline foreground colour,%
      },
      timeline years anchor=north west,
    },
    every event above,
    every life above,
    every period above,
    levels=3:0,
  },%^^A >>>
  rotated 45/.style={%^^A <<<
    /chronos/.cd,
    rotated 45/.meaning to context,
    colour scheme=default,
    rotate all colours,
    timeline={%
      start date={{-25}-01-01},
      end date={20-01-01},
      step major years=5,
      timeline years=off line,
      timeline years=above,
      timeline marks,
      timeline font=\scriptsize,
      mark at era switch,
    },
    only text,
    year format={!Y !E},
    lines={draw=#1},
    every text tags+={rotate=-45},
    event/tag+={tag anchor=west},
    period/tag+={tag anchor=west},
    life/tag+={tag anchor=west},
    text tag yshift'=2.5pt,
    every event below,
    every period below,
    every life below,
    no connectors,
    no connections,
    lines on=foreground,
    frame,
    every text tags+={font=\sffamily},
    main/frame={draw=chronos main colour,rounded corners=10pt,thick},
    main/title={%
      draw=chronos main colour,rounded corners=3pt,%
      semithick,font=\sffamily\LARGE,%
    },
    headings style={%
      font=\itshape\small\bfseries,%
      text=chronos main colour!50!chronos main background colour,%
    },
    subheadings style={font=\itshape\small,%
      text=chronos timeline foreground colour!50!chronos timeline background colour},
  },%^^A >>>
  off line colour/.style={%^^A <<< ateb: https://tex.stackexchange.com/a/324106/
    /chronos/.cd,
    off line colour/.meaning to context,
    colour scheme=offlinebasic,
    rotate all colours,
    timeline={%
      timeline width'=120mm,
      timeline height'=3pt,
      start date={-3000}-01-01,
      end date={-2000}-01-01,
      timeline font=\sffamily\tiny,
      timeline year={text=chronos main colour},
      timeline arrow,
      conditional timeline arrow={%
        timeline/timeline width-=#1,
        timeline/timeline line+={%
          shorten >={-#1}, -{Triangle Cap[length=#1]},
        },
        before headings+={%
          \path (chronos post) -- +(#1,0pt);
        },
      }{},
      timeline border height'=0pt,
      step major years=100,
      step minor years=0,
      step divisions=0,
      timeline years=below,
      timeline marks,
      timeline minor marks=false,
      minor years=false,
      timeline bare marks=false,
    },
    every text tags+={%
      text=####1!75!black,font=\sffamily\scriptsize,%
      fill=chronos main background colour,fill opacity=.75,%
    },
    every connections+={%
      draw=####1,%
      {Triangle[width=0pt 3,reversed,length=0pt 1.5]}-%
      {Triangle[width=0pt 3,reversed,length=0pt 1.5]},%
    },
    event/line'={},
    year format={!q!Y},
    event/date format={!q!Y},
    main/title={font=\sffamily\Large,text=chronos timeline foreground colour},
    chronos tikz+={%
      \ifchronos@timeline@showyears
        \scoped[on chronos middle ground layer]{%
          \fill [chronos main background colour, fill opacity=.75] 
          (chronos pre) -| (chronos post |- chronos phantom year.south) -| cycle ;
        }
      \fi
    },
  },%^^A >>>
  off line colour/.default=20mm,
  off line color/.forward to=/chronos/off line colour,
  off line colour alt/.style={%^^A <<<
    /chronos/.cd,
    off line colour alt/.meaning to context,
    off line colour=#1,
%    \end{macrocode}
% use cronoleg colours
%    \begin{macrocode}
    colour scheme=offlinealt,
    rotate all colours,
    event/colours below from clist={lliwiau_byw_isod},
    event/colours above from clist={lliwiau_byw_uchod},
  },%^^A >>>
  off line colour alt/.default=20mm,
  off line color alt/.forward to=/chronos/off line colour alt,
  off line simple/.style={%^^A <<< https://tex.stackexchange.com/a/324106/
    /chronos/.cd,
    off line simple/.meaning to context,
    off line colour=#1,
    rotate no colours,
  },%^^A >>>
  off line simple/.default=20mm,
  simple arrow/.style={%^^A <<< https://tex.stackexchange.com/a/342699/
    /chronos/.cd,
    simple arrow/.meaning to context,
    timeline={%
      start date={1-01-01},
      end date={2000-01-01},
      step major years=250,
      timeline height'=2.5mm,
      timeline years=off line,
      timeline width'=200mm,
      timeline arrow,
      conditional timeline arrow={%
        timeline/timeline width-=#1,
        timeline/timeline line+={shorten >={-#1}, -{Triangle Cap[length=#1]}},
        before headings+={%
          \path (chronos post) -- +(#1,0pt);
        },
      }{},
      mark at era switch=false,
    },
    date format={!d/!m/!Y},
    every event below,
    every period below,
    every life below,
    no colour rotation,
    headings style={font=\footnotesize\itshape},
    subheadings style={font=\scriptsize\itshape},
  },%^^A >>>
  simple arrow/.default=10mm,
  event splitter/.style={%^^A <<< https://tex.stackexchange.com/a/325890/
    /chronos/.cd,
    event splitter/.meaning to context,
    no colour rotation,
    timeline={%
      start date=2014-01-13,
      end date=2014-02-22,
      timeline width'=150mm,
      timeline margin'=0pt,
      timeline era margin'=0pt,
      timeline years=none,
      timeline years=off line,
    },
    event/date format={!b !d \thinspace !Y},
    event dates split,
    text tag yshift'=3pt,
    event text tag={font=\sffamily\small},
    no connectors,
    every event below,
    main/title={font=\sffamily\Large},
    frame,
    main/frame={draw},
  },%^^A >>>
%    \end{macrocode}
% \end{chronosstyle}
%^^A  % END off line styles
% \subsubsection{No-year}\label{subsubsec:cod-styles-no-year}
% Years are not marked.
%^^A  % BEGIN no year styles
% \begin{chronosstyle}{date centric,lines on line,plain arrow}
%    \begin{macrocode}
  date centric/.style={%^^A <<<
    /chronos/.cd,
    date centric/.meaning to context,
    timeline={%
      timeline width'=150mm,
      timeline height'=5mm,
      start date=1935-01-01,
      end date=2010-12-31,
      timeline font=\sffamily\small,
      timeline border height'=5pt,
    },
    event/text tag+={font=\sffamily\scriptsize, fill=none},
    no colour rotation,
    event/default colour=chronos main colour,
    event years on line, 
    main/title+={%
      font=\sffamily\LARGE,text=chronos main colour,%
      /chronos/main/title lines={%
        draw=chronos timeline background colour,line width=1.5pt,%
      }%
    },
  },%^^A >>>
  lines on line/.style={%^^A <<< https://tex.stackexchange.com/a/324453/
    /chronos/.cd,
    lines on line/.meaning to context,
    rotate all colours,
    timeline={%
      timeline width'=120mm,
      timeline height'=#1,
      start date=01-01-01,
      end date=2016-12-31,
      timeline years=none,
      timeline years=above,
      timeline arrow,
      conditional timeline arrow={%
        timeline/timeline width'-=20mm,
        timeline/timeline line+={shorten >=-20mm, -{Triangle Cap[length=20mm]}},
        before headings+={%
          \path (chronos post) -- +(20mm,0pt);
        },
      }{},
    },
    only years,
    period/line+={line width=#1,draw=##1},
    life/line+={line width=#1,draw=##1},
    line yshift=.5*#1,
    event/line+={semithick},
    text tag yshift=2.5pt+.5*#1,
    every event above,
    every period below,
    every life below,
    headings style={font=\footnotesize\bfseries},
    subheadings style={font=\footnotesize},
  },%^^A >>>
  lines on line/.default=5mm,
  plain arrow/.style={%^^A <<< https://tex.stackexchange.com/a/324453/
    /chronos/.cd,
    plain arrow/.meaning to context,
    lines on line=#1,
    line yshift'=1pt,
    text tag yshift'=2.5pt,
    period/line+={line width=2pt,draw=##1},
    life/line+={line width=2pt,draw=##1},
  },%^^A >>>
  plain arrow/.default=5mm,
%    \end{macrocode}
% \end{chronosstyle}
%^^A  % END no year styles
%    \begin{macrocode}
}%^^A  % END styles >>>
%    \end{macrocode}
% ^^A >>> styles (pkg)
% \iffalse
%</sty-styles>
% \fi
% 
% \iffalse
%<*sty-colschemes>
% \fi
% \section[chronos-lib-colschemes]{\lpack{chronos-lib-colschemes}}\label{sec:cod-colours}%^^A <<< (pkg)
% Colour schemes.
% \changes{v0.9.2}{2025-03-15}{Fix info reported for \texttt{chronos-lib-styles.sty}.}
%    \begin{macrocode}
\RequirePackage{chronos}
\ProvidesPackageSVN[chronos-lib-colschemes.sty]{$Id: chronos-code.dtx 11797 2026-03-21 16:01:38Z cfrees $}[v0.9.4 \revinfo]
%    \end{macrocode}
% \begin{colscheme}{blues,contninety,offlinealt,xcolseries,lavender,modern,offlinebasic,sobriety}%^^A <<< BEGIN cylluniau lliwiau | colour schemes
% cylluniau lliwiau \textbar{} colour schemes 
%    \begin{macrocode}
\chronosnewcolourscheme[default]{blues}{%^^A <<<
  timeline foreground=chronosDodgerBlue4,
  timeline background=chronosDodgerBlue2,
  default below={%
    chronosCerulean!50!chronosDodgerBlue4,chronosCerulean!50!chronosDodgerBlue3,%
    chronosCerulean!50!chronosDodgerBlue2,chronosCerulean!50!chronosDodgerBlue1,%
    chronosCerulean},
  default above={chronosCerulean!50!chronosDodgerBlue4,%
    chronosCerulean!50!chronosDodgerBlue3,chronosCerulean!50!chronosDodgerBlue2,%
    chronosCerulean!50!chronosDodgerBlue1,chronosCerulean},
  foreground=chronosDodgerBlue4,
  background=white,
}%^^A >>>
\chronosnewcolourscheme[default]{contninety}{%^^A <<<
  foreground=chronosdarkgray,
  timeline foreground=chronosdarkgray,
}%^^A >>>
\chronosnewcolourscheme[cronoleg]{offlinealt}{%^^A <<<
  timeline foreground=blue!40,
}%^^A >>>
%    \end{macrocode}
% \lpack{xcolor} manual: 35
%    \begin{macrocode}
\definecolorseries{xcolor g2}{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}
\definecolorseries{xcolor s2}{hsb}{step}[hsb]{.575,1,1}{.11,-.05,0}
\resetcolorseries{xcolor g2}
\resetcolorseries{xcolor s2}
\chronosnewcolourscheme[default]{xcolseries}{%^^A <<<
  default above={%
    xcolor s2!![0],xcolor s2!![1],xcolor s2!![2],xcolor s2!![3],%
    xcolor s2!![4],xcolor s2!![5],xcolor s2!![6],xcolor s2!![7],%
    xcolor s2!![8],xcolor s2!![9],xcolor s2!![10],xcolor s2!![11],%
    xcolor s2!![12],xcolor s2!![13],xcolor s2!![14],xcolor s2!![15]},
  default below={%
    xcolor g2!![0],xcolor g2!![1],xcolor g2!![2],xcolor g2!![3],%
    xcolor g2!![4],xcolor g2!![5],xcolor g2!![6],xcolor g2!![7],%
    xcolor g2!![8],xcolor g2!![9],xcolor g2!![10],xcolor g2!![11],%
    xcolor g2!![12],xcolor g2!![13],xcolor g2!![14],xcolor g2!![15]},
  background=white,
  foreground=black,
  timeline foreground=white,
  timeline background=black,
  timeline border inner=white,
  timeline border outer=white,
  timeline border middle=black!80,
  life/default=chronosdarkgray,
  event/default=chronosdarkgray,
  period/default=chronosdarkgray,
  theory/default=chronosdarkgray,
  info/default=chronosdarkgray,
}%^^A >>>
\chronosnewcolourscheme[default]{lavender}{%^^A <<<
  timeline foreground=chronosLavenderBlush4,
  timeline background=chronosLavender,
  timeline border inner=chronosLavenderBlush3,
  timeline border middle=chronosLavenderBlush1,
  timeline border outer=chronosLavenderBlush4,
  foreground=chronosLavenderBlush4,
  background=chronosLavender,
  default above={%
    chronosLavenderBlush4!90!chronosMediumPurple!50!chronosDarkSlateGrey,%
    chronosLavenderBlush3!90!chronosMediumPurple!50!chronosDarkSlateGrey,%
    chronosLavenderBlush2!90!chronosMediumPurple!50!chronosDarkSlateGrey},
  default below={%
    chronosLavenderBlush2!90!chronosMediumPurple!50!chronosDarkSlateGrey,%
    chronosLavenderBlush3!90!chronosMediumPurple!50!chronosDarkSlateGrey,%
    chronosLavenderBlush4!90!chronosMediumPurple!50!chronosDarkSlateGrey},
}%^^A >>>
\chronosnewcolourscheme[default]{modern}{%^^A <<<
  timeline foreground=chronosSilver,
}%^^A >>>
\chronosnewcolourscheme[default]{offlinebasic}{%^^A <<<
  timeline foreground=blue!40,
  foreground=black,
  background=white,
}%^^A >>>
\chronosnewcolourscheme[default]{sobriety}{%^^A <<<
  foreground=gray,
  background=white,
  timeline background=gray!50,
  timeline foreground=black,
  life/default=gray,
  event/default=gray,
  period/default=gray,
  theory/default=gray,
  info/default=gray,
}%^^A >>>
%    \end{macrocode}
% \end{colscheme}%^^A >>> END cylluniau lliwiau | colour schemes
% ^^A >>> colurs (pkg)
% \iffalse
%</sty-colschemes>
% \fi
% 
% \loadgeometry{safonol}%
% 
% \fancyheadoffset[lh]{0pt}%
%\Finale
% 
%^^A vim: et:tw=0:sw=2:ts=2:foldmethod=marker:fmr=<<<,>>>:
