3

I input $p+p'=q+q'$ as the label of the momentum, then TeX returns me the error below

Missing $ inserted.
<inserted text> 
$

Missing } inserted.
<inserted text> 
}

Extra }, or forgotten $.
\pgfdecoratedinputsegmentlinetocode ...tyle ] {$q}

Package tikz: Giving up on this path. Did you forget a semicolon?.

Errors

I guess that it maybe the tikz-feynman package scan the = symbol after the word like "momentum", and it misrecognized the = symbol in math mode, but I don't know how to fix it.

\documentclass{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\feynmandiagram [large, vertical=b to d]
{
    a [particle=$\mu^+$] -- [fermion, reversed momentum=$k'$] b -- [anti fermion, momentum=$k$] c [particle=$\mu^-$],
    b -- [photon, reversed momentum=$q=p+p'=k+k'$] d,
    e [particle=$e^+$] -- [anti fermion, momentum'=$p'$] d -- [anti fermion, reversed momentum'=$p$] f [particle=$e^-$];
};
\end{document}

1 Answer 1

5

To avoid confusing the key-value handling of TikZ, you can wrap the whole label in {...}:

% !TeX TS-program = lualatex
\documentclass{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\feynmandiagram [large, vertical=b to d]
{
    a [particle=$\mu^+$] -- [fermion, reversed momentum=$k'$] b -- [anti fermion, momentum=$k$] c [particle=$\mu^-$],
    b -- [photon, reversed momentum={$q=p+p'=k+k'$}] d,
    e [particle=$e^+$] -- [anti fermion, momentum'=$p'$] d -- [anti fermion, reversed momentum'=$p$] f [particle=$e^-$];
};
\end{document}

enter image description here

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .