0

Hi I am a beginner to LaTex. I would like to know how to draw a timeline like this please.

Many thanks.

enter image description here

1 Answers1

2

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta}
\begin{document}
    \begin{figure}
        \centering
\begin{tikzpicture}
  \draw[->] (0,0) to  (10,0);
  \foreach \x/\q/\w in {1/Text1,4/Text2,6/Text3,9/Text4}{
    \draw[line width=1pt, red] (\x,-2mm) node[below, black](\x){\q} -- (\x,2mm);
}
    \draw[dashed, blue, semithick]   (5,2)  node[left, xshift=-2.5cm]{Period1} node[right, xshift=2.5cm]{Period2}  --(5,-2);

\end{tikzpicture} \caption{Time Line Diagram} \label{fig:M1} \end{figure} \end{document}

EDIT in response to OP question

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta}
\begin{document}
    \begin{figure}
        \centering
\begin{tikzpicture}
  \draw[->] (0,0) to  (10,0);
  \foreach \x/\q/\w in {1/Text1,4/Text2,6/Text3,9/Text4}{
    \draw[line width=1pt, red] (\x,-2mm) node[below, black](\x){\q} -- (\x,2mm);
}
    \draw[dashed, blue, semithick]   (5,2)  node[left, xshift=-2.5cm, yshift=-1cm]{Period1} node[right, xshift=2.5cm]{Period2}  --(5,-2);

\end{tikzpicture} \caption{Time Line Diagram} \label{fig:M1} \end{figure} \end{document}

js bibra
  • 21,280
  • I shall thank you for your patience. Exactly the solution. As a final question, may I ask you how to put "period 1" and "period 2" further down? Thank you again. –  May 28 '21 at 01:24
  • 1
    I have done it for one side -- can you repeat it for the other side-- have a look at the edit above – js bibra May 28 '21 at 01:28
  • Thank you for your patience. I have used "text 1" only for simplicity. Actually, I have large texts to include and with curly brackets I cannot use \ to start a new line. Could you help me? –  May 28 '21 at 01:44