ORIGINAL QUESTION: I have major problems compiling Feynman diagrams produced with the tikz-feynman
package with lualatex
. To make it less likely that I am just sloppy, I copied the example from this nice answer.
\documentclass[tikz, border=10pt]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\begin{tikzpicture}
\begin{feynman}
\diagram [vertical'=a to b, edges={red}] {
i1 -- [fermion] a -- [fermion] f1,
a -- [photon] b,
i2 -- [fermion] b -- [fermion] f2,
};
\vertex [above right=of f1] (k1);
\vertex [below right=of f1] (p1);
\vertex [below right=of f2] (k2);
\vertex [above right=of f2] (p2);
\diagram* {
(f1) -- [fermion] (k1),
(f1) -- [photon] (p1),
(f2) -- [fermion] (k2),
(f2) -- [photon] (p2),
};
\end{feynman}
\end{tikzpicture}
\end{document}
Given that this the accepted answer, it is probably safe to assume that there was a time when this could be compiled. However, when I compile it on my updated TeXLive2018 distribution with lualatex
, I get the error message
! Package pgf Error: Graph drawing library 'circular' not found.
EXTRA INFORMATION: This question was marked as a duplicate (by myself) of this question. Indeed, if one uses the accepted answer to fix it, one may arrive at
\documentclass[tikz, border=10pt]{standalone}
\usepackage{luacode}
\usepackage{tikz}
\usetikzlibrary{graphdrawing}
\begin{luacode*}
function pgf_lookup_and_require(name)
local sep = package.config:sub(1,1)
local function lookup(name)
local sub = name:gsub('%.',sep)
if kpse.find_file(sub, 'lua') then
require(name)
elseif kpse.find_file(sub, 'clua') then
collectgarbage('stop')
require(name)
collectgarbage('restart')
else
return false
end
return true
end
return
lookup('pgf.gd.' .. name .. '.library') or
lookup('pgf.gd.' .. name) or
lookup(name .. '.library') or
lookup(name)
end
\end{luacode*}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\begin{tikzpicture}
\begin{feynman}
\diagram [vertical'=a to b, edges={red}] {
i1 -- [fermion] a -- [fermion] f1,
a -- [photon] b,
i2 -- [fermion] b -- [fermion] f2,
};
\vertex [above right=of f1] (k1);
\vertex [below right=of f1] (p1);
\vertex [below right=of f2] (k2);
\vertex [above right=of f2] (p2);
\diagram* {
(f1) -- [fermion] (k1),
(f1) -- [photon] (p1),
(f2) -- [fermion] (k2),
(f2) -- [photon] (p2),
};
\end{feynman}
\end{tikzpicture}
\end{document}
The good news is that the error is gone. However, the output looks really different from the output of the original answer
in that the photon vertex on the top right has move to the left. When I marked my answer as a duplicate, I did not carefully check that the output is OK. Now I did, and realized that the output produced using Henri's fix produces unexpected results. Therefore, I'd like to reopen the question.
texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.code.tex
into the current direcroty and try the following: change line 1093if resolvers then
toif false then
rand()
function, whereas Lua 5.3 uses the POSIXrandom()
function. Therefore you get entirely different random numbers even with the same seed.