2

I would appreciate if someone could answer a few questions of mine regarding TikZ library "timeline" (source code is here: https://github.com/cfiandra/timeline). Here is MWE:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{timeline}

\begin{document}
 \begin{tikzpicture}[timespan={},timeline width=25]
 \timeline[custom interval=true]{September 2021, October 2021, November 2021, December 2021, January 2022}
\begin{phases}
\initialphase{involvement degree=2cm}
\phase{between week=1 and 2 in 0.5,involvement degree=2.5cm}
\end{phases}
\addmilestone{at=phase-0.90,direction=90:1cm,text={\textbf{Submission of the Grant Appliction}},text options={above}}
\addmilestone{at=phase-1.280,direction=320:3cm,text={\textbf{The Team of Skilled Researchers will have been assembled.}},text options={below}}
\end{tikzpicture}
\end{document}

Here is the screenshot of the output:enter image description here

I have following questions:

  1. How can I add a line break to the text in the milestone? Some annotations are too long for one line, so I would like to split them into two lines.
  2. Is it possible to change distance between the left edge of the black timeline and the word "September"?

Thank you!

2
  • 1
    Have you tried adding \\? If that does not work, since it is TikZ based, I'd say try setting up the node alignment key (tex.stackexchange.com/a/31100/81905) and then linebreaking. Aug 13 '21 at 11:41
  • @Guilherme Zanotelli -- yes, I have tried both \\ and \linebreak. Neither works, unfortunately. Thank you for the suggestion!
    – user136555
    Aug 14 '21 at 4:01
2

You can add options text width and align into text options. It seems that they are remembered in following uses, but you can insert new ones.

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{timeline}

\begin{document}
 \begin{tikzpicture}[timespan={},timeline width=25]
 \timeline[custom interval=true]{September 2021, October 2021, November 2021, December 2021, January 2022}
\begin{phases}
\initialphase{involvement degree=2cm}
\phase{between week=1 and 2 in 0.5,involvement degree=2.5cm}
\end{phases}
\addmilestone{at=phase-0.90,direction=90:1cm,text={\textbf{Submission of the Grant Application}},text options={above, text width=2cm, align=center}}
\addmilestone{at=phase-1.280,direction=320:3cm,text={\textbf{The Team of Skilled Researchers will have been assembled.}},text options={below, text width=4cm, align=left}}
\end{tikzpicture}
\end{document}

enter image description here

1

You could put it in a parbox I guess

\begin{tikzpicture}[timespan={},timeline width=25]
 \timeline[custom interval=true]{September 2021, October 2021, November 2021, December 2021, January 2022}
\begin{phases}
\initialphase{involvement degree=2cm}
\phase{between week=1 and 2 in 0.5,involvement degree=2.5cm}
\end{phases}
\addmilestone{at=phase-0.90,direction=90:1cm,text={\textbf{Submission of the Grant Appliction}},text options={above}}
\addmilestone{at=phase-1.280,direction=320:3cm,text={\parbox{50mm}{\raggedright\textbf{The Team of Skilled\\Researchers will have\\been assembled.}}},text options={below}}
\end{tikzpicture}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.