2

Hello guys I'm an undergraduate student and relatively new to LaTeX.

I am trying to draw a timing like this, where

  1. I can increase/decrease the size of the rectangles
  2. write without items
  3. to have a tick arrow.
  4. Eliminate the line linking the rectangles.

enter image description here

Here is my original code.

\doublespacing
\begin{figure}[h]
\caption{Timing.}
\tikzset{dataset/.style = {rectangle, draw, text width = 2in, minimum height=1in}}
\begin{tikzpicture}[auto, font={\scriptsize}]
\node [dataset] (tm) {\textbf{Date \emph{t} = 1} 
                        \begin{enumerate}[itemsep=0pt,partopsep=0pt,topsep=0pt,label=(\alph*)]  
                            \item{First-period contract is offered after the firm learns $\theta_1$.}
                            \item{The firm chooses whether to reveal $\bar{\theta_t}$.} 
                        \end{enumerate}\par};
\node [dataset, right of=tm, node distance=3in] (dmv) {\textbf{Date \emph{t} = 2} 
                        \begin{enumerate}[itemsep=0pt,partopsep=0pt,topsep=0pt,label=(\alph*)] 
                            \item{$\bar{\theta_t}$ becomes public.}  
                             \item{Tradeoff.}  
                        \end{enumerate}\par};

\path [-] (tm) edge node[above, sloped] {} (dmv);

\end{tikzpicture} \label{fig:dataset} \end{figure}

With the code I get this,

enter image description here

Many thanks.

PietroP
  • 105

1 Answers1

1

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 in {1/t=1,6/t=2}{
    \draw[line width=1pt, red] (\x,-2mm) node[below, black](a\x){\q} -- (\x,2mm);
}
\node [above=of a1, draw, blue, semithick, rounded corners, align=left, minimum width=1in, minimum height=2cm] {some sample text };
\node [above=of a6, draw, blue, semithick, rounded corners, align=left, minimum width=1in,minimum height=2cm] {some sample text};
\end{tikzpicture}
\caption{Time Line Diagram} \label{fig:M1}
\end{figure}
\end{document}

for breaking the text across new line add text width=....

else the box will auto expand to fit the test content as below

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 in {1/t=1,6/t=2}{
    \draw[line width=1pt, red] (\x,-2mm) node[below, black](a\x){\q} -- (\x,2mm);
}
\node [above=of a1, draw, blue, semithick, rounded corners, align=left, minimum width=1in, minimum height=2cm, text width=1in] {some sample text some sample text some sample text some sample text };
\node [above=of a6, draw, blue, semithick, rounded corners, align=left, minimum width=1in,minimum height=2cm] {some sample text some sample text};
\end{tikzpicture}
\caption{Time Line Diagram} \label{fig:M1}
\end{figure}
\end{document}
js bibra
  • 21,280