Closed linwaytin closed 8 years ago
I'm glad you find Ti_k_Z-Feynman useful!
You can use the layered layout
option to produce straight lines. The default spring layout
is much more optimized for layouts that branch out more, whereas the layered layout
imposes a much more rigid structure.
For example:
\documentclass[tikz, border=10pt, convert]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\feynmandiagram [layered layout, horizontal=a to b] {
a -- [boson] b -- [fermion] c -- [gluon] d,
};
\end{document}
produces:
The documentation has examples of more complicated diagrams which also use the layered layout
, and otherwise you can also have a look at the TikZ Manual for a more thorough explanation of the layered layout
algorithm.
Thank you for your answer.
In fact, my problem is a little tricky. I need to put some self-energy lines on the horizontal line.
\documentclass[tikz, border=10pt, convert]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\feynmandiagram [layered layout, horizontal=b to c] {
a -- [fermion] b -- [fermion] c -- [fermion] d,
e -- [scalar] b,
e -- [scalar] c,
};
\end{document}
I want to make a, b, c, and d on a horizontal line. The above code can't do that.
Is that what you want?
\documentclass[tikz, border=10pt, convert]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\feynmandiagram [layered layout, horizontal=b to c] {
a -- [fermion] b -- [fermion] c -- [fermion] d,
c -- [scalar, half left] b,
};
\end{document}
Not exactly. I want a vertex and two straight edges. It seems I have to specify positions of all points?
I'm not sure why you want a vertex there, unless it attaches to other things. Anyway, it probably is easiest to add this extra vertex manually as follows:
\documentclass[tikz, border=10pt, convert]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\begin{tikzpicture}
\begin{feynman}
\diagram [layered layout, horizontal=b to c] {
a -- [fermion] b -- [fermion] c -- [fermion] d,
};
\vertex (s) at ($(b)!0.5!(c) - (0, 1cm)$);
\draw [scalar] (b) -- (s) -- (c);
\end{feynman}
\end{tikzpicture}
\end{document}
This graph is used in my research. Indeed, it is unusual.
Thank you so much for answering my question.
Hi,
I must say this package is amazing! It makes things much easier than other packages.
I have several nodes and I want to put them on a horizontal line. If there are only two, I know I can use the option
horizontal=a to b
. But I actually have more than 2. Is there any easy way to handle this?Thank you, Wei