TikZ“时间线”库-如何格式化文本?

TikZ“时间线”库-如何格式化文本?

如果有人能回答我关于 TikZ 库“ ”的几个问题,我将不胜感激timeline(源代码在这里:https://github.com/cfiandra/timeline)这是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}

以下是输出的屏幕截图:在此处输入图片描述

我有以下问题:

  1. 如何在里程碑中的文本中添加换行符?有些注释太长,一行写不完,所以我想将它们分成两行。
  2. 是否可以改变黑色时间线左边缘和单词“九月”之间的距离?

谢谢你!

答案1

您可以将选项text width和添加align到中text options。它们似乎在后续使用中被记住了,但您可以插入新的。

\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}

在此处输入图片描述

答案2

我想你可以把它放在 parbox 里

\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}

在此处输入图片描述

相关内容