2
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{tikz-feynman}
\begin{document}
\begin{align*}
\feynmandiagram [inline=(b.base), horizontal=f1 to f2, layered layout] {
f1 [particle=\(p\)] -- [fermion] b [blob] -- [fermion] f2 [particle=\(p\)]
};
&=
\vcenter{\hbox{%
    \begin{tikzpicture}
\begin{feynman}
\vertex (a1) at (-1,0) {\(p\)};
\vertex (a3) at (1,0) {\(p\)};
\diagram* {
(a1) -- [fermion] (a3),
};
\end{feynman}
\end{tikzpicture}
}}
+ 
\vcenter{\hbox{%
\begin{tikzpicture}
\begin{feynman}
\vertex (a1) {\(p\)};
\vertex[right=1cm of a1] (a2);
\vertex[right=0.5cm of a2] (a3);
\vertex[right=0.25cm of a3] (a4);
\vertex[right=1cm of a4] (a5) {\(p\)};
\diagram* {
{
(a1) -- [fermion] (a2) -- (a3) --  (a4) -- [fermion] (a5),
},
(a2) -- [photon, out=90, in=90, looseness=2.0] (a4)
};
\end{feynman}
\end{tikzpicture}
}}
\end{align*}
\end{document}

I would like to have the equal and the plus signs vertically aligned with the fermion lines. With the code above I get this: enter image description here

which is okay for the one in the middle but not for the other two.

2
  • Unrelated but you declare an align* environment and end it with align. Do you really need the align environment or would it be ok to write everything in a single tikzpicture? – SebGlav May 8 at 9:37
  • align instead of align* was a typo. I need the align environment because I have = and + – Lorenzo B. May 8 at 9:44
4

Probably the following is closer to the expected output:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{tikz-feynman}
\begin{document}
\begin{align*}
\feynmandiagram [inline=(f1.base), horizontal=f1 to f2, layered layout] {
f1 [particle=\(p\)] -- [fermion] b [blob] -- [fermion] f2 [particle=\(p\)]
};
&=
    \begin{tikzpicture}[baseline=(a1.base)]
\begin{feynman}[inline=(a1.base)]
\vertex (a1) at (-1,0) {\(p\)};
\vertex (a3) at (1,0) {\(p\)};
\diagram* {
(a1) -- [fermion] (a3),
};
\end{feynman}
\end{tikzpicture}
+ 
\begin{tikzpicture}[baseline=(a1.base)]
\begin{feynman}[inline=a1.base)]
\vertex (a1) {\(p\)};
\vertex[right=1cm of a1] (a2);
\vertex[right=0.5cm of a2] (a3);
\vertex[right=0.25cm of a3] (a4);
\vertex[right=1cm of a4] (a5) {\(p\)};
\diagram* {
{
(a1) -- [fermion] (a2) -- (a3) --  (a4) -- [fermion] (a5),
},
(a2) -- [photon, out=90, in=90, looseness=2.0] (a4)
};
\end{feynman}
\end{tikzpicture}
\end{align*}
\end{document}
1
  • Much better, thank you! What's the difference between baseline and inline? – Lorenzo B. May 8 at 9:54
2

I, on the other hand, took a different path from the competent user @leandriis. In fact I have used feyn package, off-topic, with the tag, even if the language used is cryptic, you can create a more restricted code. I remind you that feyn package is its own package created to create equations with Feynmann diagrams.

\documentclass[a4paper,12pt]{article}
\usepackage{feyn}
\begin{document}
\begin{eqnarray}
p\,\feyn{fsafspfsafs}\,p &=& p\,\feyn{faf}\,p + p\,\feyn{{fA}fglf{fA}}\,p
\end{eqnarray}
\end{document}

enter image description here

PS: Look the arrows and the alignment with + and =.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.