TransWikia.com

Strange label with TikZ-Feymann package and difficulty in math-mode

TeX - LaTeX Asked on January 1, 2021

Starting from a recent answer

enter image description here

with this MWE:

documentclass[a4paper,12pt]{article}
usepackage{amssymb,amsmath}

usepackage{tikz-feynman}
tikzfeynmanset{compat=1.1.0}
newcommand{virgola}{smash{raisebox{0.1ex}{,}}}
begin{document}
feynmandiagram [layered layout, horizontal=b to c] {
a -- [boson,edge label'=(pvirgola a),charged boson] b
-- [fermion, half left, looseness=1.5,edge label'=(scriptstyle q+frac{p}{2})] c
-- [fermion, half left, looseness=1.5, edge label'=(scriptstyle q-frac{p}{2})] b,
c -- [boson,edge label'=(pvirgola a),charged boson] d,
};

end{document}

I have encountered these difficulties:

  1. I am not able to put the label of every fermion to outside of the graph. I read the manual and there is only the option of placing under boson, photon, etc.. I think that is exist only this option: edge label';
  2. Into the label can I put only symbols? For example I have created a comma "virgola" in math-mode. If I do not adopt this solution I get errors.

What are the solutions?

One Answer

In edge label', the ' means "move label to the other side of the line", so use edge label instead of edge label'.

Regarding the comma, the problem is that the option list is a comma separated list, so if you have a comma in one of the entries you need to protect it with braces. In other words, use foo={bar, baz} instead of foo=bar,baz, otherwise the parser is confused by the comma. In your case, edge label'={(p, a)}.

enter image description here

documentclass[a4paper,12pt]{article}
usepackage{amssymb,amsmath}
usepackage{tikz-feynman}
tikzfeynmanset{compat=1.1.0}
begin{document}
feynmandiagram [layered layout, horizontal=b to c] {
a -- [boson,edge label'={(p, a)},charged boson] b
-- [fermion, half left, looseness=1.5,edge label=(scriptstyle q+frac{p}{2})] c
-- [fermion, half left, looseness=1.5, edge label=(scriptstyle q-frac{p}{2})] b,
c -- [boson,edge label'={(p,a)},charged boson] d,
};

end{document}

Correct answer by Torbjørn T. on January 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP