LuaLaTeX \documemtclass{standalone} 编译错误

时间:2023-03-08 20:10:09

最近在学习用LaTeX中的TikZ包画图 (graph), 必须要用LuaLaTeX编译. 然而却出现了奇怪的错误.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphdrawing, graphs}
\usegdlibrary{trees, layered, force} \begin{document}
\begin{tikzpicture}[rounded corners]
\graph[layered layout, nodes={circle, draw}]
{
2->{3->{4->{6, 5}}, 5 };
5->{1->3, 6, 4};
6->{3};
};
\end{tikzpicture}
\end{document}

错误信息

! Undefined control sequence.
\sa@placebox ->\newpage \global \pdfpagewidth
=\wd \sa@box \global \pdfpageh... l.16 \end{document}

看起来很奇怪, 貌似是LuaLaTeX不支持standalone.

我用的LuaTeX的版本是

$ lualatex --version
This is LuaTeX, Version 0.95.0 (TeX Live 2016/Debian)

查了一下, 解决办法是在源文件开头加上一行

RequirePackage{luatex85}

详情请见此链接.