# Scaling of tikzpicture inside tikz-feynman seems not working

Consider the following code:

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-feynman}

\begin{document}
$$\begin{tikzpicture}[scale=0.5, baseline=(current bounding box.center)] \begin{feynman} \vertex (x); \vertex[right=of x] (y); \vertex[above left=of x] (a); \vertex[below left=of x] (b); \vertex[above right=of y] (c); \vertex[below right=of y] (d); \diagram*{ (x) --[fermion, half left] (y), (x) --[anti fermion, half right] (y), (a) --[charged scalar] (x), (x) --[charged scalar] (b), (y) --[anti fermion] (c), (y) --[fermion] (d), }; \end{feynman} \end{tikzpicture}$$
\end{document}


Although I put scale=0.5 option in the tikzpicture environment, it seems that the scaling does not work. How can I fix this problem?

• scale=0.5 only affects the coordinates. Try scale=0.5, transform shape... (and by the way, do not use : tex.stackexchange.com/questions/503/why-is-preferable-to) – Rmano Jul 8 at 13:40
• @Rmano That works, thanks! By the way, is there a way to 'globally' set scale=0.5, transform shape option? – eigenvalue Jul 8 at 14:08

The key scale will act only on coordinates, not the size of nodes. If you use scale=0.5, transform shape also the nodes will be scaled. If you want to apply it to every picture, you can use

\tikzset{every picture/.style={
scale=0.5, transform shape,
}}


Notice however that the arrows and linewidths are not scaled with the picture (they go with the linewidth); the solution to this is not simple.

If you want a seamless scaling, the best option is perhaps to use \scalebox.

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-feynman}

\newcommand{\diagram}{%
\begin{tikzpicture}[baseline=(current  bounding  box.center)]
\begin{feynman}
\vertex (x);
\vertex[right=of x] (y);
\vertex[above left=of x] (a);
\vertex[below left=of x] (b);
\vertex[above right=of y] (c);
\vertex[below right=of y] (d);
\diagram*{
(x) --[fermion, half left] (y),
(x) --[anti fermion, half right] (y),
(a) --[charged scalar] (x),
(x) --[charged scalar] (b),
(y) --[anti fermion] (c),
(y) --[fermion] (d),
};
\end{feynman}
\end{tikzpicture}%
}

\begin{document}

Normal:

$\diagram$

\begingroup %this will make the changes to every picture local
\tikzset{every picture/.style={
,scale=0.5, transform shape
}}
Scale and transform shape:
$\diagram$
\endgroup

Using \texttt{scalebox}:
$\scalebox{0.5}{\diagram}$

\end{document}


Please notice however the following warning:

Package tikz-feynman Warning: Consider loading TikZ-Feynman with \usepackage[co
mpat=1.1.0]{tikz-feynman} so that you can be warned if TikZ-Feynman changes. on
input line 26.