# tikz-feynman: Searching for the perfect tadpole

I'm plotting automatically generated and laid-out (by tikz-feynman's default spring layout) QED feynman diagrams.

I'm looking to improve the look of the "tadpoles" i.e the vertices where both fermion arcs are attached to the same vertex.

This image shows the options I'm aware of/have considered (the last one a "work in progress"):

Self-contained code to produce those is below (works with Debian 11's texlive's lualatex).

The first row shows use of loop. Which I'm not sure is actually part of tikz-feynman as its not mentioned in the documentation and I've just seen it used in other people's examples. That can look good when oriented opposite the photon arc, but so far as I know it needs the angles to be set manually... is there any way of automatically getting the loop to be opposite the incoming photon, bearing in mind I'm not controlling the positioning of anything explicitly and leaving it up to tikz-feynman's layout?

The second row shows simply setting the tadpole vertex to an empty circle. That'd actually be pretty good if I could make the circle a bit bigger and put an arrowhead on it somewhere.

The third row is the start of an attempt to do just that, by defining a tadpole style for a vertex.

Here's the code to produce the above plot. What I'm ideally looking for is what I should be filling out the \tikzfeynmanset{tadpole/.style={... with to get a white-filled black circle with no text label, a specified size and an arrowhead somewhere on it. However at this point I'm completely out of my depth with tikz and how this stuff interacts with tikz-feynman. Thanks for any help or pointers.

Code for above plot:

\documentclass[a4paper]{minimal}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,decorations,backgrounds,calc,er,patterns}

\usepackage[compat=1.1.0]{tikz-feynman}

% First groping towards a custom "tadpole" style.
\tikzfeynmanset{
/tikz/shape=circle,
/tikz/minimum size=5mm,
/tikz/draw=black,
/tikz/fill=white,
/tikz/decoration={name=none}
}
}

% Tweak table appearance
\setlength{\tabcolsep}{1cm}
\renewcommand{\arraystretch}{2.0}

\begin{document}

\begin{center}
\begin{tabular}{ccc}

\parbox{3cm}{Using \texttt{loop}:\\Looks reasonable, but needs manual orientation.}

&

\parbox{3cm}{
\resizebox{!}{3cm}{
\begin{tikzpicture}
\begin{feynman}
\diagram[small,vertical=out to in]{
in [desired at={(0,-1)}],
in -- [fermion] a [dot],
a [dot] -- [photon] b [dot],
b [dot] -- [out=315,in=45,loop] b [dot],
a [dot] -- [fermion] out,
out [desired at={(0,1)}]
};
\end{feynman}
\end{tikzpicture}
}
}

&

\parbox{3cm}{
\resizebox{!}{3cm}{
\begin{tikzpicture}
\begin{feynman}
\diagram[small,vertical'=out to in]{
in [desired at={(0,-1)}],
in -- [fermion] a [dot],
a [dot] -- [photon] b [dot],
b [dot] -- [out=315,in=45,loop] b [dot],
a [dot] -- [fermion] out,
out [desired at={(0,1)}]
};
\end{feynman}
\end{tikzpicture}
}
}

\\ & & \\

\parbox{3cm}{Using \texttt{empty dot}:\\Would be better if bigger, and with an arrow.}

&

\parbox{3cm}{
\resizebox{!}{3cm}{
\begin{tikzpicture}
\begin{feynman}
\diagram[small,vertical=out to in]{
in [desired at={(0,-1)}],
in -- [fermion] a [dot],
a [dot] -- [photon] b [empty dot],
a [dot] -- [fermion] out,
out [desired at={(0,1)}]
};
\end{feynman}
\end{tikzpicture}
}
}

&

\parbox{3cm}{
\resizebox{!}{3cm}{
\begin{tikzpicture}
\begin{feynman}
\diagram[small,vertical'=out to in]{
in [desired at={(0,-1)}],
in -- [fermion] a [dot],
a [dot] -- [photon] b [empty dot],
a [dot] -- [fermion] out,
out [desired at={(0,1)}]
};
\end{feynman}
\end{tikzpicture}
}
}

\\ & & \\

\parbox{3cm}{Attempting to use a custom \texttt{tadpole} style:\\I've idea how to control the size and suppress label.}

&

\parbox{3cm}{
\resizebox{!}{3cm}{
\begin{tikzpicture}
\begin{feynman}
\diagram[small,vertical=out to in]{
in [desired at={(0,-1)}],
in -- [fermion] a [dot],
a [dot] -- [photon] b [tadpole],
a [dot] -- [fermion] out,
out [desired at={(0,1)}]
};
\end{feynman}
\end{tikzpicture}
}
}

&

\parbox{3cm}{
\resizebox{!}{3cm}{
\begin{tikzpicture}
\begin{feynman}
\diagram[small,vertical'=out to in]{
in [desired at={(0,-1)}],
in -- [fermion] a [dot],
a [dot] -- [photon] b [tadpole],
a [dot] -- [fermion] out,
out [desired at={(0,1)}]
};
\end{feynman}
\end{tikzpicture}
}
}

\end{tabular}
\end{center}

\end{document}


\documentclass[tikz, border=1cm]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\usetikzlibrary{arrows.meta}

\tikzset{
circle,
inner sep=0,
append after command={
\pgfextra
\endpgfextra
}}}

\begin{document}

\begin{tikzpicture}
\begin{feynman}
\diagram[small,vertical=out to in]{
in [desired at={(0,-1)}],
in -- [fermion] a [dot],
a [dot] -- [photon] b [tadpole],
a [dot] -- [fermion] out,
out [desired at={(0,1)}]
};
\end{feynman}
\end{tikzpicture}

\begin{tikzpicture}
\begin{feynman}
\diagram[small,vertical'=out to in]{
in [desired at={(0,-1)}],
in -- [fermion] a [dot],
a [dot] -- [photon] b [tadpole],
a [dot] -- [fermion] out,
out [desired at={(0,1)}]
};
\end{feynman}
\end{tikzpicture}

\end{document}


Edit:

If the loop is a fermion, you should change the arrow tip to Triangle to mimic tikz-feynman arrows. But why not use the packages own notation like this:

\documentclass[tikz, border=1cm]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}

\begin{document}

\begin{tikzpicture}
\begin{feynman}
\diagram[small, vertical=out to in]{
in [desired at={(0,-1)}],
in -- [fermion] a [dot],
a [dot] -- [photon] b  -- [half left] bm -- [fermion, half left] b,
a [dot] -- [fermion] out,
out [desired at={(0,1)}]
};
\end{feynman}
\end{tikzpicture}

\end{document}


Edit: For completeness, here is the tadpole style without label:

\documentclass[tikz, border=1cm]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\usetikzlibrary{arrows.meta, bending}

\tikzset{
particle={},
circle,
inner sep=0,
append after command={
\pgfextra
\endpgfextra
}}}

\begin{document}

\begin{tikzpicture}
\begin{feynman}
\diagram[small,vertical=out to in]{
in [desired at={(0,-1)}],
in -- [fermion] a [dot],
a [dot] -- [photon] b [tadpole],
a [dot] -- [fermion] out,
out [desired at={(0,1)}]
};
\end{feynman}
\end{tikzpicture}

\end{document}


• I do not know if the "b" should be there or not. If not, you can add particle={} to the tadpole style. Sep 17 at 8:28
• Thanks; just tried that second idea first... it simply hadn't occurred to me to just introduce an "extra" vertex to build the loop onto! It works quite well and the loops feel well integrated... they just seem a bit too big for what they are though - examples at i.imgur.com/IsixiLr.png and i.imgur.com/5UoY7QR.png . Unless there's some way of shrinking them relative to the other structure (that keeps them reasonably circular) my instinct is the other approach will work better; I'm more just looking for something which "caps" otherwise dangling photons. Will try that next... Sep 17 at 12:39
• Try \diagram[small, vertical=out to in]{ in [desired at={(0,-1)}], in -- [fermion] a [dot], a [dot] -- [photon] b -- [half left] bm[xshift=5mm] -- [fermion, half left] b, a [dot] -- [fermion] out, out [desired at={(0,1)}] };  Sep 17 at 13:15
• Interesting, but the effect of that depends on the orientation of the loop and I have loops with all sorts of orientations (see the linked .png in previous comment) laid out automatically. It seems to me that's what's really needed is a way of specifying that the natural distance b -- bm should be say half or a third of what it normally is for other links... but it's not clear to me if that can somehow be passed through to the underlying tikz graph or spring layout algorithm. Sep 17 at 16:01
• Ask a new question about that - I will be happy to look into it. Also remember to accept this answer. Sep 17 at 16:03