有没有办法使用 chronos.sty 包来创建使用一天或几天内的时间的时间线?

有没有办法使用 chronos.sty 包来创建使用一天或几天内的时间的时间线?

有一个非常棒的时间线包。我试图用它来制作从前一天(晚上)某个部分到第二天的时间线。所以几天内的时间。有办法吗?

chronos.sty 包

MWE(更多在非工作方面)

\documentclass[tikz,multi,border=10pt]{standalone}
\usepackage{datenumber}
\usetikzlibrary{arrows.meta}
\newcounter{chronosstartdate}
\newcounter{chronosenddate}
\newcounter{chronosstartyear}
\newcounter{chronosendyear}
\newcounter{chronosyeardate}
\newcounter{chronosthingdate}
\pgfkeys{/pgf/number format,
    int detect,
    set thousands separator={},
}
\tikzset{
    chronos/.code={% https://tex.stackexchange.com/a/159856/ - Claudio Fiandrino
        \tikzset{%
            align=center,
            anchor=mid,
            /chronos/.cd,
            #1
        }%
        \setstartyear{\chronosstartyear}%
        \setmydatenumber{chronosstartdate}{\chronosstartyear}{\chronosstartmonth}{\chronosstartday}%
        \setmydatenumber{chronosenddate}{\chronosendyear}{\chronosendmonth}{\chronosendday}%
        \pgfmathsetmacro\chronosunit{(\chronoswidth-20pt)/(\thechronosenddate-\thechronosstartdate)}%
        \draw [line width=\chronosheight] (-10pt,0) coordinate (chronos pre) -- +(\chronoswidth,0) coordinate (chronos post);
        \coordinate (chronos start) at (0,0);
        \coordinate (chronos end) at ([xshift=-10pt]chronos post);
        \setcounter{chronosstartyear}{\chronosstartyear}%
        \setcounter{chronosendyear}{\chronosendyear}%
        \def\tempa{01}%
        \ifx\chronosstartmonth\tempa
        \ifx\chronosstartday\tempa
        \else\stepcounter{chronosstartyear}%
        \fi
        \else\stepcounter{chronosstartyear}%
        \fi
        \def\tempa{12}%
        \def\tempb{31}%
        \ifx\chronosendmonth\tempa
        \ifx\chronosendday\tempb
        \stepcounter{chronosendyear}%
        \fi
        \fi
        \foreach \i in {\thechronosstartyear,...,\thechronosendyear} {%
            \setmydatenumber{chronosyeardate}{\i}{01}{01}%
            \node [above, anchor=south] at ({(\thechronosyeardate-\thechronosstartdate)*\chronosunit pt},0) {\i}; }
    },
    chronos date/.code args={#1-#2-#3}{%
        \tikzset{%
            /chronos/.cd,
            thing year={#1},
            thing month={#2},
            thing day={#3},
        }%
        \setmydatenumber{chronosthingdate}{\chronosthingyear}{\chronosthingmonth}{\chronosthingday}%
    },
    /chronos/.search also={/tikz},
    /chronos/.cd,
    start year/.store in=\chronosstartyear,
    start month/.store in=\chronosstartmonth,
    start day/.store in=\chronosstartday,
    end year/.store in=\chronosendyear,
    end month/.store in=\chronosendmonth,
    end day/.store in=\chronosendday,
    thing year/.store in=\chronosthingyear,
    thing month/.store in=\chronosthingmonth,
    thing day/.store in=\chronosthingday,
    start date/.style args={#1-#2-#3}{%
        start year={#1},
        start month={#2},
        start day={#3},
    },
    end date/.style args={#1-#2-#3}{%
        end year={#1},
        end month={#2},
        end day={#3},
    },
    width/.store in=\chronoswidth,
    height/.store in=\chronosheight,
    start date=2023-06-01,
    end date=2023-06-02,
    width=100mm,
    height=1pt,
    chronos date=1850-01-01,
}
\begin{document}
    \begin{tikzpicture}
        [chronos]
        \foreach \i/\j/\k in {{2023-06-01}/{No fireworks}/20pt,{2023-06-01}/{No fireworks}/80pt,{2023-06-01}/{May Day}/50pt,{2023-06-01}/{Summer Solstice}/10pt}
        {%
            \path [postaction={draw=gray, -{Triangle[width=1.5pt,reversed,length=.75pt,fill=gray]}}, chronos date/.expanded={\i}] ({(\thechronosthingdate-\thechronosstartdate)*\chronosunit pt},0) -- +(0,-\k) node [anchor=north, fill opacity=.75, fill=gray!25, draw=gray, rounded corners, font=\footnotesize\sffamily] {\chronosthingday/\chronosthingmonth/\chronosthingyear\\\j};
        }
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容