Why usegdlibrary and graphdrawing fail under pdfLaTeX, how to switch Overleaf to LuaLaTeX, and DrawFig layout + TikZ export without the graph engine.
\usegdlibrary error? graphdrawing requires LuaLaTeX! Undefined control sequence.
l.xx \usegdlibrary{layered}
Or anything involving \usetikzlibrary{graphdrawing}. Searches like “tikz usegdlibrary error” and “graphdrawing needs lualatex” point to the same fact: the graph auto-layout engine runs only on LuaTeX — default pdfLaTeX will not compile it.
📌 All TikZ compile pitfalls: 7-category TikZ failure guide
\usetikzlibrary{graphs, graphdrawing}
\usegdlibrary{layered, force, circular}
and the tikzpicture uses automatic layout (layout=layered, layout=force, etc.), you must compile with LuaLaTeX.
lualatex main.tex
\node at (x,y) or positioning's right=of (needs the positioning library).\includegraphics in a pdfLaTeX main document.\usegdlibrary.| Myth | Reality |
|---|---|
| “Latest TeX Live is enough” | Wrong engine → same error |
| “XeLaTeX works too” | graphdrawing wants LuaLaTeX, not XeLaTeX |
“The typo is on the \usegdlibrary line” |
Root cause is the compiler, not spelling |
\usegdlibrary / graphdrawing → LuaLaTeX.