# Error using TikzFeynman, fermion loop never close

This is my first time writing here (and also I'm not native speaker) so please be indulgent.

I'm new to LateX so if you could also keep your answer as simple as possible, it would be very nice. So here is mmy problem: I'm tiping my report and I need to draw lots of feynman diagrams. I read the documentation about tikzpicture / tikz feynman etc and succesfully drawn lots of picture but I have a recurrent problem trying to draw fermion loop. I attached a picture so that it will be clear what the problem is. As you can see, the loop doesn't close. Here is my code which seems pretty good from my point of view. I succesfully dodge this bug once doing some weird/absurd manipulations but I couldn't manage to fix it since.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{bbold}
\usepackage[10pt]{extsizes}
\usepackage{geometry}
\geometry{hmargin=1.5cm,vmargin=1.5cm}
\geometry{top=2.0cm,bottom=2.5cm}
\usepackage{graphicx}
\usepackage{sidecap}
\usepackage{slashed}
\usepackage{multicol}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{tikz}
\usepackage[compat=1.1.0]{tikz-feynman}
\usepackage{minitoc}
\usepackage{hyperref}
\usepackage{mathtools, bm}
\usepackage{amssymb, bm}
\usepackage{dsfont}
\usepackage{array}
\usepackage{xspace}
\newcommand{\ket}[1]{\ensuremath{|#1\rangle}\xspace}
\newcommand{\bra}[1]{\ensuremath{\langle #1|}\xspace}
\newcommand{\psh}[2]{\ensuremath{\langle #1|#2\rangle}\xspace}
\setlength{\columnsep}{2cm}

\begin{document}

...(My report) ...

$$\begin{tikzpicture}[baseline=-\the\dimexpr\fontdimen22\textfont2\relax] \begin{feynman} \vertex (a){}; \vertex[right=1.5cm of a] (b){}; \vertex[right=0.4cm of b] (c){}; \vertex[right=1.5cm of c] (d){}; \diagram*{ (a) -- [gluon, momentum=$$k$$] (b), (b) -- [fermion,momentum=$$p+k$$,half left, looseness=1.6] (c), (c) -- [fermion, momentum=$$p$$, half left, looseness=1.6] (b), (c) -- [gluon,momentum=$$k$$] (d), }; \end{feynman} \end{tikzpicture}$$

... (report) ...

\end{document}


Thank you all for helping me, I hope it's just an obvious thing that I've been missing for so long.

NB: I'm using overleaf online as well as LuaLateX compilator

• Have you seen the guide to pag. 21 at the bottom? arxiv.org/ftp/arxiv/papers/1601/1601.05437.pdf – Sebastiano Jul 19 at 12:03
• I've read it indeed, I didn't notice anything that could help me here :/ , I've seen many examples on internet with the same syntax than me and their codes were working – Lloyy Jul 19 at 12:49

The loop is closed if you use the layered layout. But this requires lualatex:

\documentclass{article}

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

\begin{document}

...(My report) ...

$$\begin{tikzpicture}[baseline=-\the\dimexpr\fontdimen22\textfont2\relax] \begin{feynman} \vertex (a){}; \vertex[right=1.5cm of a] (b){}; \vertex[right=0.4cm of b] (c){}; \vertex[right=1.5cm of c] (d){}; \diagram*[layered layout,, horizontal=b to c] { a -- [gluon, momentum=$$k$$] b, b -- [fermion,half left, looseness=1.6,momentum=$$k$$, ] c, c -- [fermion, half left, looseness=1.6,momentum=$$k-p$$, ] b, c -- [gluon,momentum=$$k$$] d, }; \end{feynman} \end{tikzpicture}$$

... (report) ...

\end{document}


• Thank you very very much for my advice into chat. Thank you again for to help this user. – Sebastiano Jul 19 at 21:40
• Thanks a lot ! I did not know I could use layered in tikz-feynman ! – Lloyy Jul 22 at 21:16