JP-Ellis / tikz-feynman

Feynman Diagrams with TikZ
http://www.jpellis.me/projects/tikz-feynman
Other
148 stars 20 forks source link

Internal vertex label #31

Closed pseth closed 8 years ago

pseth commented 8 years ago

Hello,

Thanks for the package, it is great! I am trying to create a very simple bubble diagram where I wish to give the (internal) vertices labels that appear below a dot. However, I can't seem to get this to work. I can get either the dot, or the label name in place of the dot (which, as you point out in the notes, breaks the lines).

I have tried both of the following thinking this API seemed reasonable:

\feynmandiagram [layered layout, horizontal=a to b] {
    a [particle={$t_1$},dot] -- [fermion, half left] b [dot]
    -- [fermion, half left] a,
};  

\begin{tikzpicture}
  \begin{feynman}
    \vertex[dot] (a) {$t_1$};
    \vertex[right= of a, dot] (b) {$t_2$};
    \diagram* {
        (a) -- [fermion, half left] (b),
        (b) -- [fermion, half left] (a),
    };
  \end{feynman}
\end{tikzpicture}

However, neither works. In the second example, the dot simply becomes bigger. Is there a way to do this?

Thanks!

JP-Ellis commented 8 years ago

Hi,

I'm glad you're finding Ti_k_Z-Feynman useful!

As you have noticed, the particle and dot style are mutually exclusive because they modify the shape of the vertex itself. If you want an annotated dot, you can use the label directive:

\documentclass[tikz, border=5pt]{standalone}

\usepackage[compat=1.1.0]{tikz-feynman}

\begin{document}
\feynmandiagram [layered layout, horizontal=a to b] {
  a [dot, label=180:\(t_{1}\)]
  -- [fermion, half left] b [dot, label=0:\(t_{2}\)]
  -- [fermion, half left] a,
};  

\begin{tikzpicture}
  \begin{feynman}
    \vertex[dot, label=180:\(t_{1}\)] (a) {};
    \vertex[right=of a, dot, label=0:\(t_{2}\)] (b) {};
    \diagram* {
        (a) -- [fermion, half left] (b),
        (b) -- [fermion, half left] (a),
    };
  \end{feynman}
\end{tikzpicture}
\end{document}

pseth-1

I hope that helps!

pseth commented 8 years ago

Brilliant, thanks!