1

enter image description here

So I'm trying to draw the following in Latex but I'm having trouble, I tried the following but no good:

\begin{tikzpicture}
\draw[latex-latex] (-3.5,0) -- (3.5,0) ; %edit here for the axis
\foreach \x in  {-3,-2,-1,0,1,2,3} % edit here for the vertical lines
\draw[shift={(\x,0)},color=black] (0pt,3pt) -- (0pt,-3pt);
\foreach \x in {x_{1/2},x_{3/2},...,x_{i-1/2},x_{i+1/2},...,x_{N+1/2}} % edit here for the numbers
\draw[shift={(\x,0)},color=black] (0pt,0pt) -- (0pt,-3pt) node[below] 
{$\x$};
\end{tikzpicture}
  • 1
    https://tex.stackexchange.com/questions/618148/how-to-draw-a-time-diagram/618188#618188 – js bibra Nov 29 '22 at 01:55
  • https://tex.stackexchange.com/questions/585896/how-to-draw-horizontal-curly-braces-under-a-timeline/585898#585898 – js bibra Nov 29 '22 at 01:56
  • https://tex.stackexchange.com/questions/584471/how-draw-multiple-timelines-one-after-another/584581#584581 – js bibra Nov 29 '22 at 01:57
  • https://tex.stackexchange.com/questions/553107/how-to-convert-this-annual-timeline-to-semi-annual-timeline/553135#553135 – js bibra Nov 29 '22 at 01:58

1 Answers1

1

Welcome to TEX -See if the answer satisfies your requirement

\documentclass[tikz, margin=1cm]{standalone}
\usepackage{siunitx, makecell}
\usetikzlibrary{positioning,calc, arrows.meta}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}

\begin{tikzpicture} \draw[latex-latex] (-3.5,0) -- (3.5,0) ; %edit here for the axis

\foreach \x [count=\i] in  {-3,-2,-1,0,1,2,3} % edit here for the vertical lines
\draw[shift={(\x,0)},color=red, line width=1pt] (0pt,3pt) node(X\i){}-- (0pt,-3pt);

\node[below=1pt of X1] (a) {a};
\node[below=1pt of X7] (b) {b}; 

\node[below=1em of X1] (x1) {\tiny$X_{1/2}$};   
\node[below=1em of X2] (x2) {\tiny$X_{2/2}$};   

\node[yshift=1pt](1)at ($(X1)!0.5!(X2)$){\tiny 1};

\end{tikzpicture} \end{document}

enter image description here

js bibra
  • 21,280