[Tex/LaTex] Changing font size, style and orientation of momentum labels and/or vertex labels in tikz-feynman

fontsfontsizetikz-feynman

I would like my momenta labels to be smaller and to be placed along the momentum arrows (e.g. $k_1+k_2$). Also, is it possible to make vertex labels bold and larger (z…)? (\mathbf does the job,but I didn't manage to combine it with the resizing). Here is my code:

\documentclass[tikz, border=10pt]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}

\begin{document}
\begin{tikzpicture}
\begin{feynman}

\vertex (a1)[blob,label=180:\(J\)] {};
\vertex(a2)[right=1.8cm of a1,dot, label=90:\(z_1\)]{} ;
\vertex(a3)[right=1.5cm of a2, dot,label=90:\(z_2\)]{} ;
\vertex(a4)[right=1cm of a3, dot,label=90:\(z\)]{} ;
\vertex[right=2cm of a4](a5){};
\vertex(a6)[below=1.5cm of a2, crossed dot]{};
\vertex(a7)[below=1.5cm of a3, crossed dot]{};
\vertex(a8)[above right=3cm of a4]{};
\node[text width=3cm] at (1.8,0.25) {$z_0$} ; 

\diagram* {
(a1) -- [gluon, momentum={[arrow shorten=0.3] \( p+k_1+k_2-q_1-q_2\)}] (a2) -- [gluon,  momentum={[arrow shorten=0.3] \(p+k_1+k_2-q_2\)}] (a3) -- [gluon,  momentum={[arrow shorten=0.3] \(p+k_1+k_2\)}] (a4)--[gluon, momentum= {[arrow shorten=0.3]\(p\)}](a5) ,
(a4)--[gluon, momentum= {[arrow shorten=0.3]\(k_1+k_2\)}](a8),
(a6) -- [gluon,  momentum={[arrow shorten=0.3] \(\vec{\bf{q_1}}\)}](a2) ,
(a7) -- [gluon,  momentum={[arrow shorten=0.3] \(\vec{\bf{q_2}}\)}](a3) ,
};
\end{feynman}
\end{tikzpicture}
\end{document}

And this is what I get:
enter image description here

Best Answer

Nice use of TikZ-Feynman (CTAN)!

Indeed with all the momentum arrows and all the labels, you definitely want everything to be small. The simplest is to just add one of the font size commands within the momentum label:

momentum={\tiny\(p + k\)}

In your case though, even that doesn't work as the resulting label is still too wide. As a result, the only option seems to be stacking the momentum labels. This can be achieved with the {subarray} environment which will both stack and use a smaller font (it is designed to stack options under \sum for example).

Here's what I've done:

\RequirePackage{luatex85}
\documentclass[tikz, border=10pt]{standalone}

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

\begin{document}
\begin{tikzpicture}
  \begin{feynman}
    %% Convenience command to allow stacks in momentum labels
    \def\stack#1{\begin{subarray}{c}#1\end{subarray}}

    %% Main sequence of gluons
    \vertex[blob, label=180:\(J\), label=-15:\(z_{0}\)] (a1) {};
    \vertex[dot, right=1.8cm of a1, label=-45:\(z_1\)] (a2) {} ;
    \vertex[dot, right=of a2, label=-45:\(z_2\)] (a3) {} ;
    \vertex[dot, right=of a3, label=-90:\(z\)] (a4) {} ;

    %% Final gluons to the right
    \vertex[right=2cm of a4] (a5);
    \vertex[above right=2cm and 2cm of a4] (a8) {};

    %% Incoming gluons
    \vertex[crossed dot, below=of a2] (a6) {};
    \vertex[crossed dot, below=of a3] (a7) {};

    \diagram* [edges={gluon}] {
      (a1)
        -- [momentum={\(\stack{p+k_1+k_2 \\ -q_1-q_2}\)}] (a2)
        -- [momentum={\(\stack{p+k_1+k_2 \\ -q_2}\)}] (a3)
        -- [momentum={\(\stack{p \\ + k_1 +k_2}\)}] (a4)
        -- [momentum'={\(p\)}] (a5),

      (a4) -- [momentum={\(k_1+k_2\)}] (a8),
      (a6) -- [momentum={\(q_1\)}] (a2),
      (a7) -- [momentum={\(q_2\)}] (a3),
    };
  \end{feynman}
\end{tikzpicture}
\end{document}

output

As you can see, I've defined a \stack command which creates a {subarray} environment. You could just write the {subarray} environment every time, but that's quite cumbersome hence why I defined the function.

I also removed a lot of the explicit distances since TikZ-Feynman tries to have quite sane defaults to begin with. In the case of the blob, the distance is left as the larger size of the blob makes the edge look a lot smaller.

Lastly, since the top part of the diagram is quite text-heavy with all the momentum labels, I have placed the 'z' labels of the vertices on the bottom.

Related Question