2

This question already has an answer here:

I want to draw this using tikz package of latex.enter image description here

I already write down the code for that. But the problem is that how could I input the sentence Happing Now within the picture.

My code is

\begin{frame}{Frame Title}
\begin{figure}
  \centering
  \begin{tikzpicture}
 \draw[thick][->](0,0) to (4,0);
  \draw[thick][->](2,1.5) to (4,0.5);
  \draw[thick][loosely dotted](4,0) to (5,0);
  \end{tikzpicture}
  \caption{Timeline}
  \label{fig:my_label1}
\end{figure}

\end{frame}

marked as duplicate by hpekristiansen, Stefan Pinnow, Sebastiano, Henri Menke tikz-pgf Dec 13 '18 at 1:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    palce a node at the starting point of the arrow. Read A very minimal introduction to TikZ for more. – nidhin Dec 12 '18 at 18:50
  • please show us mwe (minimal working example), which produce your arrows. – Zarko Dec 12 '18 at 18:52
  • \draw[thick][->] (2,1.5) node[anchor=east]{Happing Now} to (4,0.5); – hpekristiansen Dec 12 '18 at 18:56
  • @hpekristiansen: The possible duplicate question is about placing text at arbitrary positions, which would be used in this case as well (but would require specifying the coordinate twice). However, I think that that is different than this case as this is about placing text relative to a particular \draw. – Peter Grill Dec 12 '18 at 19:07
4

You can place a node at the appropriate point, if you replace the to syntax with a --:

enter image description here

Notes:

  • You don't need to use [] for each option.

Code:

\documentclass{article}
\usepackage{tikz}

\begin{document}
 \begin{tikzpicture}
 \draw[thick, ->] (0,0) to (4,0);
  \draw[thick, ->]  (2,1.5) -- (4,0.5) node [pos=0, anchor=east] {Happening Now};
  \draw[thick, loosely dotted] (4,0) to (5,0);
  \end{tikzpicture}
\end{document}
4

You can put a node at the beginning of the upper arrow.

\documentclass{article}
\usepackage{tikz}

\begin{document}

  \begin{tikzpicture}
  \draw[thick, ->] (0,0) to (4,0) ;
  \draw[thick, ->]  (2,1.5) node [anchor=east] {Happing Now}  to (4,0.5);
  \draw[thick, loosely dotted](4,0) to (5,0);
  \end{tikzpicture}

  \end{document}

enter image description here

2

As suggested by @nidhin:

\documentclass[tikz,border=0.5cm]{standalone}
\begin{document}
 \begin{tikzpicture}
 \draw[thick][->](0,0) to (4,0);
  \draw[thick][->](2,1.5)node[left]{Happing now} to (4,0.5);
  \draw[thick][loosely dotted](4,0) to (5,0);
  \end{tikzpicture}
\end{document}
2

Using one command as my previous answer. Don't use a to path if you don't have different angles for in and out, just -- or edge.

\documentclass{article}
\usepackage{tikz}    
\begin{document}

\begin{tikzpicture}[thick]
 \path[->] (0,0) edge (4,0) (2,1.5)node[label=left:Happening Now]{} edge (4,0.5) (4,0) edge[loosely dotted,-] (5,0);
\end{tikzpicture}

\end{document}

enter image description here

2

based on answer on the your previous question:

\documentclass[12pt,a4paper]{article}
\usepackage{tikz}

\begin{document}

\begin{figure}
 \centering
 \begin{tikzpicture}[thick]
 \draw[->]  (0,0) edge (4,0)
            (2,3) node[left] {Happing Now} -- (4,1);
 \draw[thick][loosely dotted] (4,0) -- (5,0);
 \end{tikzpicture}
 \caption{Timeline}
 \label{fig:my_label1}
\end{figure}

\end{document}

enter image description here

  • I think you spelled "Happening Now" wrong? :-). There is a a reference to [![enter image description here][1]][1] in the answer. I think you intended to delete that? – Peter Grill Dec 12 '18 at 19:11
  • @PeterGrill, thank you to pointing me on this mistake. I still have problems with new interface for loading images ... i delete it, hopefully now is all correct. – Zarko Dec 12 '18 at 20:04

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