Open 70akaline opened 5 years ago
Labeling vertex as their respective internal names gives us more info. In the package document, vertices i1 and i2 are both at the left side of a -- b
; but this is not true in your output, nor in my local output.
According to the document of tikz-feynman
, the only constraint in this example is that, groups of vertices i1 f1 a
and i2 f2 b
are positioned closer together (by using [draw=none]
). However, the default behavior of whether vertices i1 and i2 are both at the same side of a -- b
or not, is determined by the undergoing positioning algorithm. Therefore your output and the output in doc may both be ok.
I am not capable of finding the real cause of this difference, but currently "reversing the drawing routine of group consisting i2, f2 and b" could be a workaround.
% workaround
\begin{tikzpicture}
\begin{feynman}
\diagram[vertical=a to b] {% change from flipped `vertical'` to normal `vertical`
i1 [particle=\(e^{-}\)]
-- [fermion] a
-- [draw=none] f1 [particle=\(e^{+}\)],
a -- [photon, edge label'=\(p\)] b,
% draw reversely
f2 [particle=\(e^{-}\)]
-- [draw=none] b
-- [anti fermion] i2 [particle=\(e^{+}\)],
};
\diagram* {
(a) -- [fermion] (f2),
(b) -- [anti fermion] (f1),
};
\end{feynman}
\end{tikzpicture}
Thanks for your checking, but since you change the codes, the feynman diagram is not the same as the document. For a Feynman diagram, the arrow direction is very important, in your case, the left side incoming piston should have a reversed arrow. I think my problem may discussed from this link: https://github.com/u-fischer/luaotfload/issues/6
As you discussed with me before, maybe this luacode helps, but I don't know will this luacode works my case?
maybe this luacode helps, but I don't know will this luacode works my case?
I am afraid not. That luacode resolver "is just for fonts", but not positioning. In my local latex installation with some lua-related packages updated, inserting that resolver is a necessary to using \usegdlibrary{circular}
, which is loaded internally by tikz-feynman
. And, after that resolver, I produced the same vertex-partly reversed output as you.
In TeXPad, maybe the package version is freezing, so that you can use tikz-feynman
normally without introducing the resolver.
I will try reading the document of tikz-feynman
carefully, to see if I can find something helpful. Maybe an issue should be opened under JP-Ellis/tikz-feynman.
Update messages:
The reported pgf bug #493, resulted from u-fischer/luaotfload#6, is fixed in commit [afd7e8] 5 days ago. See diff here.
I have manually used the new version, and your problem persists.
This question on TeX.SX denotes the same question, under which the author of tikz-feynman
has participated in discussions. I have not found this until posted a new question on TeX.SX.
I have met this problem as well, see another question on TeX.SX. Solution is to change the lua code as they do.
However, it seems using luacode
from TeX code didn't work for me, so I directly hacked the original lua code.
@Liam0205 Please consider to add a tag like Lua
or LuaTeX
.
@Stone-Zeng Sounds a good idea, I'll handle it.
@Stone-Zeng I have met this problem as well, see another question on TeX.SX. Solution is to change the lua code as they do.
However, it seems using
luacode
from TeX code didn't work for me, so I directly hacked the original lua code.
Denote
The accepted answer of question 1 does not solve the problem described by question 2, as the EXTRA INFORMATION part of question 2 has mentioned. Since this issue and the question 2 seem similar, your suggestion does not solve this issue either. And I have experimented to verify this.
The comments, posted in Oct 2018, of the un-solved question 2 provides a dangerous but effective solution: update luatex
from v1.07.0 (with lua
v5.2) to v1.09.0 (with lua
v5.3).
Here are the steps:
luatex
v1.09.0. In case you prefer to build from source, see here.luatex
and luajittex
. Execute luatex --version
to test.fmtutil-sys --byengine luatex
.math.random(1, spring_length)
in line 217 of file TEXMFDIST/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringHu2006.lua
to
math.random(1, math.floor(spring_length))
. (since the incompatibility introduced by lua
v5.3)Delete the auxiliary files of .tex
file and then recompile. Now you get the expected vertex positioning, the same as the package doc shows.
I have little experience in using luatex, let alone the source code level of luatex and/or lua. This comment is just a record of what I just tried.
Some update from TeX.SX
Denote, as before,
- the question Fresh install of TL2018: no tikz graph drawing libraries found as question 1, and
- the one Updated lualatex vs. tikz-feynman as question 2.
As the accepted answer of question 2 stated, updating to the latest luatex
(v1.09.0) and pgf
(no older than commit [de79f5]) solves the original problem. Hence the question posted later by myself is flagged duplicate. However, users may still take care using graph drawing function of pgf
with Lua 5.3, as the accepted answer complains.
How to update luatex
is introduced in my previous comment, and I personally recommend installing
dev version of pgf
into TEXMFHOME
TDS tree. One can use kpsewhich -var-value TEXMFHOME
to get the actual directory of TEXMFHOME
.
Note: Before the release of TeX Live 2019 (accompanying with luatex
v1.10.0), there won't be updates of luatex
in TeX Live 2018.
This was a bug in PGF which is fixed by these two commits: https://github.com/pgf-tikz/pgf/commit/afd7e8de65cf70dab4a2152b9c9a8910b8ba2e86 https://github.com/pgf-tikz/pgf/commit/73ca6bed1874f33eefc58005cd80fbcfd647b575 The next PGF release contains these fixes and will be distributed in the coming days via CTAN.
Here is a screenshot from LuaTeX 1.07.0 with PGF 3.1
@hmenke
Using PGF 3.1 downloaded from pgf-tikz/pgf/zip/3.1 with LuaTeX 1.07.0, I still get wrong output, the same as the original poster got. My .tex
file is the one posted by OP.
Maybe the listed info is not capable of "discovering the truth", and I can provide more info on request.
Updating PGF to 3.1 from tlmgr
, the wrong output remains using LuaTeX 1.07.0.
I can't reproduce on Linux with neither LuaTeX 1.07.0 nor LuaTeX 1.09.0 and PGF 3.1. I don't have access to a computer with Mac OS X, so I can't debug it.
Unfortunately, the problem is reproducible with overleaf's texlive 2019 to 2021. See a simpler example in JP-Ellis/tikz-feynman#73.
Dear All, I met a problem when compiling codes with TikZ-Feynman package, my codes is shown below
When I compile this with LuaTeX in TeXPad, the diagram shown is not the same as the example from document:
Mine:
Document example
How can I compile this file properly?