# Feynman diagrams using tikz-feynman package

I am using the following piece of code to draw a Feynman diagram using the tikz-feynman package.

\begin{equation*}
\feynmandiagram[layered layout, medium, horizontal=a to b] {
a [particle=$$H$$] -- [scalar] b [dot] -- [photon] f1 [particle=$$W^{\pm}$$],
b -- [boson, edge label=$$W^{\mp}$$] c [dot],
c -- [fermion] f2 [particle=$$f$$],
c -- [anti fermion] f3 [particle=$$\bar{f}'$$],
};
\end{equation*}


The output comes out correctly, but the code is always highlighted in red to indicate that there might be some fault with the code.

I was wondering if there is some fault with this piece of code.

• If your editor (I'm guessing TeXStudio?) highlights the code as bad, but it doesn't produce any warnings/errors, and the output is as expected, then the problem is not the code, but that the editor doesn't know about the syntax of tikz-feynman. – Torbjørn T. Feb 18 '17 at 23:22
• this is sharelatex. how do I turn off the highlighting? – nightmarish Feb 18 '17 at 23:41
• – Torbjørn T. Feb 18 '17 at 23:49

What this means is that the editor's syntax checking isn't always reliable, so you should put more trust in the .log file (and the output). If you don't get any warnings or errors, and the output looks as it should, then there's no reason to think that anything is wrong.
To turn off this type of checks for ShareLaTeX, see https://www.sharelatex.com/learn/Code_Check: It can be turned off globally in the settings, or for a specific document by adding %%novalidate at the start of the file.