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

5
  • how to edit? my posts are completely not understandable until editing.how to do that? Commented Mar 10, 2018 at 11:15
  • Select the code, then click the button marked {} above the text field (or use the keyboard shortcut Ctrl + K). Commented Mar 10, 2018 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. Commented Mar 10, 2018 at 11:35
  • oh yes.sorry. my bad.i just wrote the inner code without the header files.thanks Commented Mar 10, 2018 at 13:15
  • there there,i edited myself..:D.thank you for your kind help. Commented Mar 10, 2018 at 13:24

1 Answer 1

2

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}
0

You must log in to answer this question.

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