2

I am trying to plot a graph G= on a slide and write some text under and over it but the graph is on its own page(and that page is much smaller then a normal one)

How can I get the graph flow in the text?

My document:

   % Drawing a graph using the PG 3.0 graphdrawing library
   % Author: Mark Wibrow
   \documentclass[tikz,border=10pt]{standalone}
   %%%<
   \usepackage{verbatim}
   %%%>

   \usetikzlibrary{graphdrawing}
   \usetikzlibrary{graphs}
   \usegdlibrary{trees}

   \begin{document}

   hekejehjejhjkhejkhhjke
   \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]
    {
        A -> {
          B -> { A -> {C}, C -> {D} ,D },
          C -> { A, B -> {C  ,D} },
          D -> { C }
        }
    };

\end{tikzpicture}

ijklsjjkkjdkljkjl

\end{document}

compile with lualatex filename.tex

3
  • 1
    Replace the standalone class by a standard class (article for example). That implies not keeping the options tikz and border=10pt, of course. Apr 14, 2015 at 12:23
  • \documentclass[]{article} or \documentclass{article} gives me ! Undefined control sequence. l.21 \usetikzlibrary {graphdrawing} ? ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... followed by more errors!
    – Bojack
    Apr 14, 2015 at 12:37
  • You should load tikz as a separate package now: \usepackage{tikz}. Apr 14, 2015 at 12:47

1 Answer 1

1

Run with LuaLaTeX because of graphdrawing and change the \documentclass to some thing like article (as also suggested by fpast). The standalone was meant to be used for a single picture for example and not a running text.

\documentclass{article}
\usepackage{tikz}
\usepackage{verbatim}
\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{trees}

\begin{document}

Some text above.

\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]
    {
        A -> {
          B -> { A -> {C}, C -> {D} ,D },
          C -> { A, B -> {C  ,D} },
          D -> { C }
        }
    };
\end{tikzpicture}

Some other text below.

\end{document}

The result:

enter image description here

You must log in to answer this question.

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