1

I want to name the left and right hand vertex x and y.but it is not working.

\usepackage{tikz-feynman}
\usepackage[compat=1.1.0]{tikz-feynman} 
\usepackage{simpler-wick}
\usetikzlibrary{calc}
\begin{document}
\feynmandiagram[horizontal=a to b, layered layout]{
   a[dot]--[fermion,half left,edge label=\(p_1\)]b[dot],a--[fermion,half right,edge label'=\(p_2\)]b[dot],
   a--[out=135,in=-135,loop,min distance=2cm,anti fermion,edge label'=\(p_3\)]a,
   b--[fermion,out=45,in=-45,loop,min distance=2cm,edge label=\(p_4\)]b
    };

\feynmandiagram[horizontal=a to b, layered layout]{
 a[particle=\(x\)]--[fermion,half left,edge label=\(p_1\)]b[particle=\(y\)],a--[fermion,half right,edge label'=\(p_2\)]b[dot],
   a--[out=135,in=-135,loop,min distance=2cm,anti fermion,edge label'=\(p_3\)]a,
   b--[fermion,out=45,in=-45,loop,min distance=2cm,edge label=\(p_4\)]b
    };
\end{document}

these codes generate this result. but I cant have both.how i can do that 2 in 1? thank you. :)

enter image description here

  • how to edit? my posts are completely not understandable until editing.how to do that? – jowadul kader Mar 10 '18 at 11:15
  • Select the code, then click the button marked {} above the text field (or use the keyboard shortcut Ctrl + K). – Torbjørn T. Mar 10 '18 at 11:24
  • Can you turn your snippet into a complete, compilable example? (Including documentclass, the necessary packages and definitions.) You also seem to have forgotten a \feynmandiagram[... line. – Torbjørn T. Mar 10 '18 at 11:35
  • oh yes.sorry. my bad.i just wrote the inner code without the header files.thanks – jowadul kader Mar 10 '18 at 13:15
  • there there,i edited myself..:D.thank you for your kind help. – jowadul kader Mar 10 '18 at 13:24
1

A vertex cannot be both particle and dot, but you can add a label next to a dot, with dot,label=right:text.

Note also that when you have defined b once, then using b[dot] when you draw a line from a to b throws an error. Therefore I removed [dot] two places in your code, indicated by comments.

output of code

\documentclass{article}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\feynmandiagram[horizontal=a to b, layered layout]{
 a[particle=\(x\)]--[fermion,half left,edge label=\(p_1\)]
 b[particle=\(y\)],
   a--[fermion,half right,edge label'=\(p_2\)] b, % removed [dot] after b here
   a--[out=135,in=-135,loop,min distance=2cm,anti fermion,edge label'=\(p_3\)]a,
   b--[fermion,out=45,in=-45,loop,min distance=2cm,edge label=\(p_4\)]b
 };

\feynmandiagram[horizontal=a to b, layered layout]{
   a[dot,label=right:\(x\)] % added label=right:\(x\)
    --[fermion,half left,edge label=\(p_1\)]
    b[dot,label=left:\(y\)], % similarly here
   a --[fermion,half right,edge label'=\(p_2\)] b, % removed [dot] after b here as well
   a --[out=135,in=-135,loop,min distance=2cm,anti fermion,edge label'=\(p_3\)] a,
   b --[fermion,out=45,in=-45,loop,min distance=2cm,edge label=\(p_4\)] b
    };

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.