我正在使用 绘制费曼图tikz-feynman
。当我画的时候
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\title{feynds}
\author{ts342139 }
\date{October 2023}
\usepackage{tikz}
\usetikzlibrary{fit}
\usepackage{xcolor}
\usepackage[compat=1.0.0]{tikz-feynman}
\usetikzlibrary{calc}
\usepackage{nicematrix}
\tikzfeynmanset{plain/.style=}
\usepackage{wrapfig}
\begin{document}
\scalebox{0.6}{
\begin{tikzpicture}
\begin{feynman}
\vertex (a1);
\vertex[right= of a1] (a2);
\vertex[above right= of a2](a3);
\vertex[below right= of a2](a4);
\vertex[below right= of a3] (a5);
\vertex[right= of a5] (d);
\diagram* {
(a1) -- [plain, edge label=$q$] (a2),
(a2)-- [plain, quarter left] (a3),
(a2)--[plain,quarter right] (a4),
(a3)--[plain, quarter left] (a5),
(a4)--[plain, quarter right] (a5),
(a5)--[plain, edge label=$q$] (d),
(a3)--[plain, very thick] (a4),
};
\end{feynman}
\end{tikzpicture}
}
\scalebox{0.45}{
\begin{tikzpicture}
\begin{feynman}
\vertex (a);
\vertex[below right=1.0cm of a] (b);
\vertex[below right=1.3cm of b] (c);
\vertex[below right=1.3cm of c] (d);
\vertex[right= 2.0cm of d] (e);
\vertex[below left=1.3cm of d] (f);
\vertex[below left=1.3cm of f] (g);
\vertex[below left=1.0cm of g] (h);
\diagram*{
(a)-- [plain, edge label=$p_1$] (b),
(b)-- [plain] (c),
(c)-- [plain] (d),
(d)-- [plain, edge label=$q$] (e),
(d)--[plain] (f),
(f)--[plain] (g),
(g)--[plain, edge label=$p_2$] (h),
(c)--[plain, very thick] (f),
(f)--[plain] (b),
};
\end{feynman}
\end{tikzpicture}
}
\end{document}
具体来说,我希望水平线处于同一水平。如何使它们处于同一水平?
答案1
你应该做两件事:
- 不要将
tikzpicture
s 放在 es 内\scalebox
,而是使用scale
选项。对于tikz-feynman
图表,您需要transform shape
另外使用以确保缩放正常工作。您可以取消缩放节点,以确保两个图表中的字体大小相同。我创建了一个可以自动执行此操作的自定义.style
。 - 使用该
baseline
选项来引用要为两个图设置基线的节点。我为两个图选择了最右边的坐标。
梅威瑟:
\documentclass{article}
\usepackage[compat=1.1.0]{tikz-feynman}
\tikzset{
feynman scale/.style={
transform shape,
scale={#1},
every node/.append style={
scale={1/#1}
},
}
}
\begin{document}
\begin{tikzpicture}[feynman scale=0.6, baseline=(d)]
\begin{feynman}
\vertex (a1);
\vertex[right=of a1] (a2);
\vertex[above right=of a2](a3);
\vertex[below right=of a2](a4);
\vertex[below right=of a3] (a5);
\vertex[right=of a5] (d);
\diagram* {
(a1) -- [plain, edge label=$q$] (a2),
(a2) -- [plain, quarter left] (a3),
(a2) -- [plain, quarter right] (a4),
(a3) -- [plain, quarter left] (a5),
(a4) -- [plain, quarter right] (a5),
(a5) -- [plain, edge label=$q$] (d),
(a3) -- [plain, very thick] (a4),
};
\end{feynman}
\end{tikzpicture}%
\begin{tikzpicture}[feynman scale=0.45, baseline=(e)]
\begin{feynman}
\vertex (a);
\vertex[below right=1.0cm of a] (b);
\vertex[below right=1.3cm of b] (c);
\vertex[below right=1.3cm of c] (d);
\vertex[right=2.0cm of d] (e);
\vertex[below left=1.3cm of d] (f);
\vertex[below left=1.3cm of f] (g);
\vertex[below left=1.0cm of g] (h);
\diagram*{
(a) -- [plain, edge label=$p_1$] (b),
(b) -- [plain] (c),
(c) -- [plain] (d),
(d) -- [plain, edge label=$q$] (e),
(d) --[plain] (f),
(f) --[plain] (g),
(g) --[plain, edge label=$p_2$] (h),
(c) --[plain, very thick] (f),
(f) --[plain] (b),
};
\end{feynman}
\end{tikzpicture}
\end{document}