Graphics, Figures & TablesDirekted Graph with tikz does not work

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
KingOnline1
Posts: 4
Joined: Sun Mar 15, 2015 7:36 pm

Direkted Graph with tikz does not work

Post by KingOnline1 »

Hallo community,

I'm new here and I don't know, if I'm in the right section. In that case: I'm sorry and I need advice.

Ok, now my problem:
I want to try to make some graphs in \latex. Especially a directed graph. I've found a example, which I thought to use and adabt to my problem. I've tried so much and done a lot of research, but I've found nothing, which is realy helpfully.

The Example I used is the followed

Code: Select all

% Drawing a graph using the PG 3.0 graphdrawing library
% Author: Mark Wibrow
\documentclass[tikz,border=10pt]{standalone}
\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}
This code does not work in my case.

The error:

Code: Select all

Package pgf Error: You need to run LuaTeX to use the graph drawing library.
[...n LuaTeX to use the graph drawing library}]
I don't now what to do.
Need Help, please?

I use MikTex and Win 8.1.

If you have some other solutions which work better, I'm welcome every idea.

Thank you very much for your help.
Last edited by Stefan Kottwitz on Sun Mar 15, 2015 8:23 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Direkted Graph with tikz does not work

Post by Stefan Kottwitz »

Welcome to the forum!

The error message shows, that you did not use the required LaTeX compiler. I guess you used pdfLaTeX. You need to change your editor setting to run LuaLaTeX.

Stefan
LaTeX.org admin
KingOnline1
Posts: 4
Joined: Sun Mar 15, 2015 7:36 pm

Re: Direkted Graph with tikz does not work

Post by KingOnline1 »

Hello Stefan_K,

thank you very much for your quick reply.
But I don't know how to change that. I use Sublime3 to create my pdfs.
KingOnline1
Posts: 4
Joined: Sun Mar 15, 2015 7:36 pm

Re: Direkted Graph with tikz does not work

Post by KingOnline1 »

Hello Stefan_K,

I've found it yet. I used TexStudio. Now it works.
Thaaaaaanks a lot
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Direkted Graph with tikz does not work

Post by Stefan Kottwitz »

Great, that it works!

By the way, we are big friends of TikZ, so let us know if you got further questions.

Stefan
LaTeX.org admin
KingOnline1
Posts: 4
Joined: Sun Mar 15, 2015 7:36 pm

Direkted Graph with tikz does not work

Post by KingOnline1 »

Hi Stefan_K,

you are great. Do you speak german?
I want to go more familiar with it. Do you have some good turtorials for the beginning?

Buuuuut, indeed, I've got another question :)

My code is as followed:

Code: Select all

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\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]
 		{
 			$\lor$ -> { 
 				$\forall x$ -> { 
 					$\exists y$ -> {
 						$\lor$ -> {
 					    	$\land$ -> {
 					        	$P$,
 						    	$\neg$ -> {$Q$}
 						    },
 						    $\forall z$ -> {
 						    	$\neg$ -> {$P$}
 						    }
 						}
 					} 
 				},
	 			$\exists w$ -> {
	 				$\neg$ -> {$Q$}
 				}
 			}
 		};
 	\end{tikzpicture}
\end{document}
I get an error when I compile it. Now I use TexStudio.

Error:
Zeile 30: Missing \endcsname inserted. }
Zeile 30: Missing \endcsname inserted. }

... (this occures a lot of times)

I guess it is because I use mathematical expressions. Numbers and letters work.

Thanks a lot for your help, again.
Last edited by Stefan Kottwitz on Sun Mar 15, 2015 9:23 pm, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Direkted Graph with tikz does not work

Post by Stefan Kottwitz »

KingOnline1 wrote:Do you speak german?
Yes, I do. We could also continue in German at our German partner site TeXwelt.de. We do much TikZ there. See: examples.
KingOnline1 wrote:I want to go more familiar with it. Do you have some good turtorials for the beginning?
The TikZ manual contains some tutorials, I don't know others. But you can learn by doing and working together on code on TeXwelt.de oder here. Same mantainer. ;-)

I can take a look at the code of your previous post, it just takes some minutes until I'm on the computer again.

Stefan
LaTeX.org admin
Post Reply