I have some problem with a graph packet in LaTeX. http://www.texample.net/tikz/examples/drawing-graphs/ is the package I'm using.

It worked fine for me to compile the example from the webbpage but the graph looks very bad when I copied it to my thesis document. I am using the template idamasterthesis.cls in my document with can be downloaded from https://www.ida.liu.se/edu/templates/latex/idamallar-latest.tar


\documentclass[cropmarks, frame, english]{idamasterthesis}


\S\ This is the abstract.





\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 }

\caption{this is the text for the img}


This is the picture of how the graph looks in my thesis:

enter image description here

Please note that the graph libary needs to be compiled by lualatex!

  • Please give us a MWE of your code showing your problem.
    – AboAmmar
    Commented Apr 15, 2015 at 21:17
  • Sorry, but what is "MWE"?
    – Bojack
    Commented Apr 15, 2015 at 21:18
  • Minimal working example (MWE)
    – egreg
    Commented Apr 15, 2015 at 21:20
  • A Minimal Working Example (MWE) is a small peace of code which produces the error or unexpected behavior
    – AboAmmar
    Commented Apr 15, 2015 at 21:20
  • Ok, I got it! I made an edit.
    – Bojack
    Commented Apr 15, 2015 at 21:27

1 Answer 1


You missed the \usegdlibrary{trees}.

enter image description here

For the inputenc error, if you only need English, you can remove lines 88 and 130 of the class file and make sure you change all non-English letters, like ö, in the class file also. For a more elegant solution to this, you can use the etoolbox package, which provides commands like \pretocmd with which you can temporarily change some parts of the class file without actually changing any thing in the class file.

The syntax is simple:

\patchcmd{<command>}{<code to replace>}{<code>}{<success>}{<failure>}
  • I feel so stupid now. Have wasted so long time on this stupid problem. Thank you so much! Could I ask you if also get the inputenc error that Johannes_B got? I get it as well(but I guess that is of topic...
    – Bojack
    Commented Apr 15, 2015 at 21:45
  • If I use etoolbox, can I keep the non-english letters?
    – Bojack
    Commented Apr 15, 2015 at 22:17

You must log in to answer this question.

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