2

I have question about automatic graphs drawing with latex. So I want to use

\usegdlibrary

To generate my graphs layout automatically without my interruption where to put states and nodes. Is it possible to use this library with xelatex? Or I should use Luatex. Where you offer to get luatex and what is the difference between luatex and xelatex?

\documentclass{article}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{trees}
\begin{document}
\begin{tikzpicture}[>=stealth, every node/.style={circle, draw, minimum size=0.75cm}]
\graph [tree layout, grow=down, fresh nodes, level distance=0.5in, sibling distance=0.5in]
    {
        4 -> { 
          3 -> { 1 -> { 5, " " }, 2,2 },
          3 -> { 1, 2, 2 },
          3 -> { 1, 2, 2 }
        } 
    };
\end{tikzpicture}
\end{document}

Thanks in advance.

5
  • your question is completely unclear, \usegdlibrary is not a standard command so presumably it is defined in some package somewhere, you should at least state that much and preferably fix the example so people can test any answers. Mar 31, 2016 at 7:55
  • I am at thinking phase, where to start, but okey I have one example.
    – Mantas
    Mar 31, 2016 at 7:57
  • The new example just makes ! Undefined control sequence. <recently read> \usetikzlibrary Mar 31, 2016 at 8:00
  • @DavidCarlisle For example I would like to use \usegdlibrary{force}, with code: \tikz \graph [random seed=10, spring layout] { a -- {b, c, d} -- e -- f -- {g,h} -- {a,b,e}; } , But it is throwing errors for unknown command.
    – Mantas
    Mar 31, 2016 at 8:31
  • If you want to ask about an error make an example that makes that error and post the exact error that you get, The example as posted still just makes an error that \usetikzlibrary is not defined. Your initial version didn't even give any indication that you were using tikz at all. Mar 31, 2016 at 8:37

1 Answer 1

5

If you run your example (after adding \usepackage{tikz}) you get a pretty clear error message:

! Package pgf Error: You need to run LuaTeX to use the graph drawing library.

You cannot use xelatex. That library uses a lot of Lua code I think, so you need to run lualatex.

Running the code with lualatex gives

enter image description here

3
  • When I run LuaTex it is generating me only text, not graph :) Maybe something is wrong with my LuaTex?
    – Mantas
    Mar 31, 2016 at 8:06
  • I added the output I get to my answer. You did add \usepackage{tikz} at the start of the preamble? Mar 31, 2016 at 8:13
  • Okey, I found my mistake I was using Luatex, not Lualatex :)
    – Mantas
    Mar 31, 2016 at 8:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .