Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The following is one example to illustrate my point. The two edges differs in the '-latex' option. How come this option will affect the direction. As I understand it, this option just change how the arrow tips are rendered. The result is this: enter image description here

Is it a bug or a feature?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\begin{center}
\begin{tikzpicture}[scale=6, transform shape]
\tikzstyle{every node} = [circle, fill=gray!30]
    \node (a) at (0, 0) {A};
    \node (b) at +(0: 1.5) {B}
        edge [<-, green,dashed, -latex, bend left=30] (a)
        edge [<-, green,dashed, bend right=30] (a)
        ;
\end{tikzpicture}
\end{center}
\end{document}

Edit: My intention is just to change the arrrow tip style, which is achieved in this. The accepted answer explains how it works.

This is the final code, which only changes the style of arrow tips, using >=latex:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\begin{center}
\begin{tikzpicture}[scale=6, transform shape]
\tikzset{>=latex}
\tikzset{every node/.style={circle, fill=gray!30}}
    \node (a) at (0, 0) {A};
    \node (b) at +(0: 1.5) {B}
        edge [<-, red,dashed, bend left=30] (a)
        edge [<-, red,dashed, bend right=30] (a)
        ;
\end{tikzpicture}
\end{center}
\end{document}
share|improve this question
    
It's a feature: use edge [<-, green,dashed, latex-, bend left=30] (a)... –  Gonzalo Medina May 30 '13 at 19:19
add comment

1 Answer

up vote 10 down vote accepted

It's a feature; the string latex in -latex has the same syntactic behaviour as the > in ->:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\begin{center}
\begin{tikzpicture}[scale=6, transform shape]
\tikzset{every node/.style={circle, fill=gray!30}}
    \node (a) at (0, 0) {A};
    \node (b) at +(0: 1.5) {B}
        edge [latex-, red,dashed, bend left=30] (a)
        edge [<-, red,dashed, bend right=30] (a)
        ;
\end{tikzpicture}
\end{center}
\end{document}

enter image description here

Just to expand a little: the syntax -arrowtip puts arrowtip at the end of the path; arrowtip- puts arrowtip at the beginning of the path, and arrowtip1-arrowtip2 puts arrowtip1 at the beginning of the path and arrowtip2 at the end of the path.

If you want to change only the arrow tip without affecting its placement, you can use the >=arrowtip syntax. A little example:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\begin{center}
\begin{tikzpicture}[scale=6, transform shape,line width=3pt]
\tikzset{every node/.style={circle, fill=gray!30}}
    \node (a) at (0, 0) {A};
    \node (b) at +(0:1.5) {B}
        edge [->, blue,dashed, bend right=45] (a)
        edge [<-, red,dashed, bend right=30] (a)
        edge [latex->, orange,dashed, bend right=15] (a)
        edge [<-, >=latex, magenta,dashed, bend left=15] (a)
        edge [<-, blue,dashed, bend left=30] (a)
        edge [latex-, red,dashed, bend left=45] (a)
        ;
\end{tikzpicture}
\end{center}
\end{document}

enter image description here

Not related to the question, but I also changed the old \tikzstyle to \tikzset.

share|improve this answer
    
Thanks for the info. We should remove <-, since the two are the same, resulting into edge [latex-, red,dashed, bend left=30] (a) –  Albert Netymk May 30 '13 at 19:38
    
@AlbertNetymk Yes. I've edited my code accordingly. –  Gonzalo Medina May 30 '13 at 19:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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