# Tikzfeynman in beamer frame not where I want

As you can see in the immage I attached, the code produces the diagram correctly, yet not where I'd like it to be, i.e. below the first line of text (the second line was just a test)

\documentclass[lualatex]{beamer}

\usepackage{graphicx}
\usepackage{tikz-feynman}

\begin{frame}

\frametitle{Involved Feynman diagrams}

At LO in $\alpha$ there is only one diagram:

\begin{figure}[!h]
\begin{tikzpicture}
\feynmandiagram[horizontal=a to b]{
i1 [particle=$$e^{-}$$] -- [fermion] a -- [fermion] i2  [particle=$$e^{+}$$],
a -- [photon] b,
f1 [particle=$$\mu^{-}$$] -- [fermion] b -- [fermion] f2  [particle=$$\mu^{+}$$],
};
\end{tikzpicture}
\end{figure}

prova

\end{frame}


Any help would be much appreciated. Thank you.

Edit: possibly useful information, compiling with lualatex

• Welcome to TeX.SX! Remove \begin{figure} and \end{figure} Jan 27, 2021 at 14:18
• Thank you for the answer! Originally, I didn't enclose it in a figure environment, and I had the exact same problem. That's why I tried with figure. Jan 27, 2021 at 14:23
• Also remove \begin{tikzpicture}...\end{tikzpicture}. \feynmandiagram is already a tikzpicture Jan 27, 2021 at 14:29

Remove the tikzpicture environment. The command feynmandiagram already includes tikzpicture. From the docs:

Feynman diagrams can be declared with the \feynmandiagram command. It is analogous to the \tikz command from TikZ and requires a final semi-colon (;) to finish the environment.

\documentclass{beamer}
\usepackage{tikz-feynman}
\begin{document}

\begin{frame}

\frametitle{Involved Feynman diagrams}

At LO in $\alpha$ there is only one diagram:
\begin{center}
\feynmandiagram[horizontal=a to b]{
i1 [particle=$$e^{-}$$] -- [fermion] a -- [fermion] i2  [particle=$$e^{+}$$],
a -- [photon] b,
f1 [particle=$$\mu^{-}$$] -- [fermion] b -- [fermion] f2  [particle=$$\mu^{+}$$],
};
\end{center}
prova

\end{frame}
\end{document}

• Yup, this solved it. Thank you very much. Jan 27, 2021 at 14:34
• figure environment doesn't harm and is not cause of OP problem, it only has similar effect as center environment -- center the Feynman diagram ( +1 ) Jan 27, 2021 at 14:36
• @Zarko Sure, but why introduce a float and tie it to the spot? In presentations, captions also don't make much sense, since everyone can see that it's a figure, and numbering figures and referencing them later doesn't make much sense in a presentation (the audience neither remembers the figure nor can skip back). Jan 27, 2021 at 14:38
• figure in beamer not float. It is always where is inserted, so use of its positioning option, for example [!h] as OP do, is nosens. It for sure not cause OP problems but nesting of tikzpictures, as you clearly stated. Jan 27, 2021 at 14:45
• @Zarko Thanks for the explanation, never used figure in beamer, but it makes sense ... Jan 27, 2021 at 15:19