5

When I increase the size of my diagram with "scale" the gap between the particle label and the external line increases too.

\documentclass[12pt]{book}
\usepackage{luatex85} 
\def\pgfsysdriver{pgfsys-pdftex.def} 
\usepackage{tikz}
\usepackage{pgfkeys}
\usepackage[compat=1.1.0]{tikz-feynman}

\begin{document}

\begin{center}
\feynmandiagram [scale=2.5][horizontal=a to b] {
i1 [particle=$e^{-}$] -- [fermion] a -- [fermion] i2 [particle=\(e^{+}\)],
a -- [photon] b,
f1 [particle=\(\mu^{+}\)] -- [fermion] b -- [fermion] f2 [particle=\(\mu^{-}\)],
};
\end{center}

However if I use the "large" option the gap remains the same but "large" option is still not large enough for me.

\begin{center}
\feynmandiagram [large, horizontal=a to b] {
i1 [particle=$e^{-}$] -- [fermion] a -- [fermion] i2 [particle=\(e^{+}\)],
a -- [photon] b,
f1 [particle=\(\mu^{+}\)] -- [fermion] b -- [fermion] f2 [particle=\(\mu^{-}\)],
};
\end{center}

\end{document}

So how can I resolve the gap problem by still using the "scale" option (or another option which guarentees the same size) ?

4

There are two main ways in which you can achieve that in TikZ-Feynman (CTAN).

Defining an extra large style

Just like large and small are defined in TikZ-Feynman, you can define new styles. In particular, you can adapt the style from large and make you own extra large style. The large style is (essentially) defined to be:

\tikzfeynmanset{
  large/.style={
    /tikz/node distance=2cm,
    /graph drawing/node distance=2.5cm,
    /graph drawing/level distance=2cm,
    /graph drawing/sibling distance=3cm,
    /tikz/graphs/edges={thick},
    /tikzfeynman/every dot@@/.append style={/tikz/minimum size=2mm},
    /tikzfeynman/every crossed dot@@/.append style={/tikz/minimum size=4mm},
    /tikzfeynman/every blob@@/.append style={/tikz/minimum size=1cm},
    /tikzfeynman/arrow size=1.6pt,
    /tikzfeynman/insertion/size=4pt,
  }
}

So taking all the distances and doubling them:

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

\tikzfeynmanset{
  extra large/.style={
    /tikz/node distance=4cm,
    /graph drawing/node distance=5cm,
    /graph drawing/level distance=4cm,
    /graph drawing/sibling distance=6cm,
    /tikz/graphs/edges={very thick},
    /tikzfeynman/every dot@@/.append style={/tikz/minimum size=4mm},
    /tikzfeynman/every crossed dot@@/.append style={/tikz/minimum size=8mm},
    /tikzfeynman/every blob@@/.append style={/tikz/minimum size=2cm},
    /tikzfeynman/arrow size=3.2pt,
    /tikzfeynman/insertion/size=8pt,
  },
}

\begin{document}
\feynmandiagram [extra large, horizontal=a to b] {
  i1 [particle=$e^{-}$] -- [fermion] a -- [fermion] i2 [particle=\(e^{+}\)],
  a -- [photon] b,
  f1 [particle=\(\mu^{+}\)] -- [fermion] b -- [fermion] f2 [particle=\(\mu^{-}\)],
};
\end{document}

output

The problem here is that the lines are becoming comically large compared to the size of the text. The font size can be adjusted by adding /tikz/node font=\huge to the style in which case the output becomes a lot more reasonable:

enter image description here

The issue is still that the photon line is quite small which I don't really like. You can keep modifying the extra large style to fix this, but you'll have to do this for the gluons, the scalars, etc.

Using \scalebox

An alternative is to use a scale box around the diagram which scales all of the content by the specified scale factor:

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

\begin{document}
\scalebox{2}{
  \feynmandiagram [horizontal=a to b] {
    i1 [particle=$e^{-}$] -- [fermion] a -- [fermion] i2 [particle=\(e^{+}\)],
    a -- [photon] b,
    f1 [particle=\(\mu^{+}\)] -- [fermion] b -- [fermion] f2 [particle=\(\mu^{-}\)],
  };
}
\end{document}

output

In this instance, everything is scaled by a factor of 2 including the text and the size of the sine wave in the photon line.

  • Thank you so much, it works perfectly well and thank you for TikZ-Feynman, this is absolutely great. – ketherok Mar 30 '17 at 20:16

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.