2

How to globally set insertion style using tikzfeynmanset?

I tried

\tikzfeynmanset{
    every insertion/.style={
        /insertion/style={thick},
    },
}

but it won't work.

MWE:

This is what effect I expect:

\documentclass{standalone}
\usepackage{tikz-feynman}
\begin{document}
\begin{tikzpicture}[baseline=($(a)!0.5!(b)$)]
    \begin{feynman}
        \vertex (a);
        \vertex[right=1cm of a] (b);
        \diagram*{ (a) --[insertion={[style=thick]0.5}] (b);};
    \end{feynman}
\end{tikzpicture}
\end{document}

and this is the code I expect without adding style=thick in every occurrence of insertion:

\documentclass{standalone}
\usepackage{tikz-feynman}
\tikzfeynmanset{
    every insertion/.style={
        /insertion/style={thick},
    },
}
\begin{document}
\begin{tikzpicture}[baseline=($(a)!0.5!(b)$)]
    \begin{feynman}
        \vertex (a);
        \vertex[right=1cm of a] (b);
        \diagram*{ (a) --[insertion=0.5] (b);};
    \end{feynman}
\end{tikzpicture}
\end{document}

and it doesn't work.

  • Could you please add a complete MWE, i.e. a document that starts with \documentclass, ends with \end{document}, can be compiled and illustrates your point? I guess you need to say \tikzfeynmanset{ every insertion/.style={ thick }, }, but I am not in the mood to cook up an MWE and check that. – user121799 Nov 2 '18 at 13:54
  • @marmot MWE added. – Turgon Nov 3 '18 at 18:54
2

I think that there is no predefined way of doing this, but if you are willing to slightly redefine the insertion@@ style, you could do

\documentclass{standalone}
\usepackage{tikz-feynman}
\makeatletter
\tikzfeynmanset{  insertion@@/.style args={[#1]#2}{
    /tikz/decoration={
      markings,
      mark=at position #2 with {
        \tikzfeynmanset{insertion/.cd,#1}
        \draw [/tikzfeynman/every insertion,\tikzfeynman@insertion@style] (-\tikzfeynman@insertion@size, -\tikzfeynman@insertion@size) -- (\tikzfeynman@insertion@size, \tikzfeynman@insertion@size);
        \draw [/tikzfeynman/every insertion,\tikzfeynman@insertion@style] (-\tikzfeynman@insertion@size, \tikzfeynman@insertion@size) -- (\tikzfeynman@insertion@size, -\tikzfeynman@insertion@size);
      },
    },
    /tikz/postaction={
      /tikz/decorate=true,
    }  
}}
\makeatother    

\begin{document}
\tikzfeynmanset{every insertion/.style={thick,red}}
\begin{tikzpicture}[baseline=($(a)!0.5!(b)$)]
    \begin{feynman}
        \vertex (a);
        \vertex[right=1cm of a] (b);
        \diagram*{ (a) --[insertion={0.5}] (b);};
    \end{feynman}
\end{tikzpicture}
\end{document}

enter image description here

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.