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.

I am attempting to do this, but I cannot seem to find the correct syntax for it in LaTeX.

Here is what I have:

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage{tikz}

\usetikzlibrary{graphdrawing}
\usetikzlibrary{positioning,graphs}
\usegdlibrary{layered}
\begin{document}
\begin{tikzpicture}[baseline]
                \begin{graph}[layered layout,nodes={draw,circle, node distance=10cm}]
                    {1->[edge label=bob, node distance=3cm]2};
                \end{graph}
            \end{tikzpicture}
\end{document}

None of the node distance commands seem to have an impact

Any ideas?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

The layered layout ignores node distance; however, you can use level sep (and possibly sibling sep if necessary):

\documentclass[12pt]{article} 
\usepackage[english]{babel} 
\usepackage{tikz}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{positioning,graphs}
\usegdlibrary{layered}

\begin{document}
\begin{tikzpicture}[baseline]
                \begin{graph}[layered layout,nodes={draw,circle},level sep=2cm]
                    {1->[edge label=bob]2};
                \end{graph}
            \end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
So a combination of level sep and sibling sep will force it to be that distance at least between nodes? –  soandos Feb 9 at 3:58
    
As an aside, how can I represent a self loop on one of these nodes? –  soandos Feb 9 at 4:01
    
@soandos those values will set the distance between the center of the nodes from one level to the nodes on the next level (level sep) and between siblings (sibling sep); but, in fact, it is weird that node distance is having no effect. –  Gonzalo Medina Feb 9 at 4:08
    
@soandos for the loop, question, an example: \begin{tikzpicture}[baseline] \begin{graph}[layered layout,nodes={draw,circle}] {1->[edge label=bob]2->[loop right]2}; \end{graph} \end{tikzpicture} –  Gonzalo Medina Feb 9 at 4:09
    
So the fact that node distance is not having an affect is a bug? –  soandos Feb 9 at 4:11

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.