3

I'm trying to draw a simple graph with arrows. But when I compile my file, latex draws 2 tips, one at the beginning of the arrow, the other at the end, like so:

example

here is the code I used :

\documentclass{article}

\usepackage{tikz,pgf}
\usetikzlibrary{calc,tikzmark,shapes,decorations.pathmorphing,decorations.pathreplacing,decorations.text,decorations,shapes.symbols,arrows,positioning}

\begin{document}
\begin{tikzpicture}
  \node (heure) {Heures};
  \node[right=2cm of heure] (minute) {Minutes};
  \node[right=2cm of minute] (seconde) {Secondes};
  \draw[-stealth] (heure.north) edge[bend left] node[midway,above] {\times 60} (minute.north);
  \draw[-stealth] (minute.north) edge[bend left] node[midway,above] {\times 60} (seconde.north);
  \path[-stealth] (minute.south) edge[bend left] node[midway,below] {\times 60} (heure.south);
  \draw[-stealth] (seconde.south) edge[bend left] node[midway,below] {\times 60} (minute.south);
\end{tikzpicture}
\end{document}

Compiled with lualatex on texlive2016. Can someone tell me what the problem is? Thanks

2

The main problem is that you are using edge instead of to. edge creates an extra path. In addition your labels should be in math mode, and it would help to shorten a couple of the arrows. I have removed unnecessary libraries for this example, but the code also works with all the libraries you use.

Sample output

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}
  \node (heure) {Heures};
  \node[right=2cm of heure] (minute) {Minutes};
  \node[right=2cm of minute] (seconde) {Secondes};
  \draw[-stealth,shorten >= 2pt] (heure.north) to[bend left] node[midway,above] {$\times 60$} (minute.north);
  \draw[-stealth] (minute.north) to[bend left] node[midway,above] {$\times 60$} (seconde.north);
  \draw[-stealth] (minute.south) to[bend left] node[midway,below] {$\times 60$} (heure.south);
  \draw[-stealth,shorten >= 2pt] (seconde.south) to[bend left] node[midway,below] {$\times 60$} (minute.south);
\end{tikzpicture}

\end{document}
1

Ok, solved the problem by changing the draw command to the path command. If someone can explain the difference between those 2, it would be super appreciated, thanks

  • Good that you found a workaround. This is probably better as a remark at the end of your original question given that you have now changed what you are asking. – Andrew Aug 8 '16 at 10:28
0

One more solution:

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{positioning, quotes}

\begin{document}
    \begin{tikzpicture}
\node (heure) {Heures};
\node[right=2cm of heure]   (minute)    {Minutes};
\node[right=2cm of minute]  (seconde)   {Secondes};
%
\draw[-stealth,shorten >=1mm, shorten <=1mm] 
    (heure.north)   edge [bend left,"$\times 60$"] (minute.north) 
    (minute.north)  edge [bend left,"$\times 60$"] (seconde.north)
    (minute.south)  edge [bend left,"$\times 60$"] (heure.south) 
    (seconde.south)  to  [bend left,"$\times 60$"] (minute.south);
    \end{tikzpicture}
\end{document}

As you can see, in last path I use to instead edge. Also is employed quotes library for writing of edge labels.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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