我正在用 制作一排三张费曼图tikz-feynman
。我在对齐方面遇到了一些问题。
首先,我使用subcaptionbox
垂直对齐的子标题(看这里)。其次,我使用scalebox
来缩小它们(看这里),这样这三个就适合排成一行。
这是代码:
\documentclass[12pt,a4paper]{article}
% LuaLaTeX is used
\usepackage{tikz}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\begin{figure}
\subcaptionbox{The left}{\scalebox{1}{
\begin{tikzpicture}
\begin{feynman}
\vertex (a) {\(g\)};
\vertex[right=1cm of a] (b);
\vertex[below right=1cm of b] (c);
\vertex[below left=1cm of c] (d);
\vertex[left=1cm of d] (e) {\(g\)};
\vertex[right=1cm of b] (f) {\(t\)};
\vertex[right=1cm of c] (g) {\(H\)};
\vertex[right=1cm of d] (h) {\(\overline{t}\)};
\diagram*{
(a) -- [gluon] (b),
(b) -- [anti fermion] (c),
(c) -- [anti fermion] (d),
(d) -- [gluon] (e),
(b) -- [fermion] (f),
(c) -- [scalar] (g),
(d) -- [anti fermion] (h),
};
\end{feynman}
\end{tikzpicture}
}}
\hfill
\subcaptionbox{The left}{\scalebox{1}{
\begin{tikzpicture}
\begin{feynman}
\vertex (a) {\(g\)};
\vertex[below right=1cm of a] (b);
\vertex[below left=1cm of b] (c) {\(g\)};
\vertex[right=1cm of b] (d);
\vertex[above right=1cm of d] (e);
\vertex[below right=1cm of d] (f) {\(\overline{t}\)};
\vertex[above right=1cm of e] (g) {\(t\)};
\vertex[below right=1cm of e] (h) {\(H\)};
\diagram*{
(a) -- [gluon] (b),
(c) -- [gluon] (b),
(b) -- [gluon, edge label=\(g\)] (d),
(d) -- [fermion, edge label=\(t\)] (e),
(d) -- [anti fermion] (f),
(e) -- [fermion] (g),
(e) -- [scalar] (h),
};
\end{feynman}
\end{tikzpicture}
}}
\hfill
\subcaptionbox{The left}{\scalebox{1}{
\begin{tikzpicture}
\begin{feynman}
\vertex (a) {\(q\)};
\vertex[below right=1cm of a] (b);
\vertex[below left=1cm of b] (c) {\(\overline{q}\)};
\vertex[right=1cm of b] (d);
\vertex[above right=1cm of d] (e);
\vertex[below right=1cm of d] (f) {\(\overline{t}\)};
\vertex[above right=1cm of e] (g) {\(t\)};
\vertex[below right=1cm of e] (h) {\(H\)};
\diagram*{
(a) -- [fermion] (b),
(c) -- [anti fermion] (b),
(b) -- [gluon, edge label=\(g\)] (d),
(d) -- [fermion, edge label=\(t\)] (e),
(d) -- [anti fermion] (f),
(e) -- [fermion] (g),
(e) -- [scalar] (h),
};
\end{feynman}
\end{tikzpicture}
}}
\caption{Feynman diagrams.}
\end{figure}
\end{document}
输出如下:
我需要三个图垂直对齐。我搜索了一些解决方案,但我仍然不知道如何解决这个问题。
答案1
该表格结构将使子图的中心对齐。
(已\fbox
添加 2 个进行检查。)
\documentclass[12pt,a4paper]{article}
% LuaLaTeX is used
\usepackage{tikz}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\begin{figure}
\begin{tabular}{ccc}
\fbox{%
\begin{subfigure}{0.33\textwidth}
\begin{tikzpicture}
\begin{feynman}
\vertex (a) {\(g\)};
\vertex[right=1cm of a] (b);
\vertex[below right=1cm of b] (c);
\vertex[below left=1cm of c] (d);
\vertex[left=1cm of d] (e) {\(g\)};
\vertex[right=1cm of b] (f) {\(t\)};
\vertex[right=1cm of c] (g) {\(H\)};
\vertex[right=1cm of d] (h) {\(\overline{t}\)};
\diagram*{
(a) -- [gluon] (b),
(b) -- [anti fermion] (c),
(c) -- [anti fermion] (d),
(d) -- [gluon] (e),
(b) -- [fermion] (f),
(c) -- [scalar] (g),
(d) -- [anti fermion] (h),
};
\end{feynman}
\end{tikzpicture}
\end{subfigure}%
}
&
\fbox{%
\begin{subfigure}{0.33\textwidth}
\begin{tikzpicture}
\begin{feynman}
\vertex (a) {\(g\)};
\vertex[below right=1cm of a] (b);
\vertex[below left=1cm of b] (c) {\(g\)};
\vertex[right=1cm of b] (d);
\vertex[above right=1cm of d] (e);
\vertex[below right=1cm of d] (f) {\(\overline{t}\)};
\vertex[above right=1cm of e] (g) {\(t\)};
\vertex[below right=1cm of e] (h) {\(H\)};
\diagram*{
(a) -- [gluon] (b),
(c) -- [gluon] (b),
(b) -- [gluon, edge label=\(g\)] (d),
(d) -- [fermion, edge label=\(t\)] (e),
(d) -- [anti fermion] (f),
(e) -- [fermion] (g),
(e) -- [scalar] (h),
};
\end{feynman}
\end{tikzpicture}
\end{subfigure}%
}
&
\begin{subfigure}{0.33\textwidth}
\begin{tikzpicture}
\begin{feynman}
\vertex (a) {\(q\)};
\vertex[below right=1cm of a] (b);
\vertex[below left=1cm of b] (c) {\(\overline{q}\)};
\vertex[right=1cm of b] (d);
\vertex[above right=1cm of d] (e);
\vertex[below right=1cm of d] (f) {\(\overline{t}\)};
\vertex[above right=1cm of e] (g) {\(t\)};
\vertex[below right=1cm of e] (h) {\(H\)};
\diagram*{
(a) -- [fermion] (b),
(c) -- [anti fermion] (b),
(b) -- [gluon, edge label=\(g\)] (d),
(d) -- [fermion, edge label=\(t\)] (e),
(d) -- [anti fermion] (f),
(e) -- [fermion] (g),
(e) -- [scalar] (h),
};
\end{feynman}
\end{tikzpicture}
\end{subfigure} \\%
(a) The left& (b) The center & (c) The right
\end{tabular}
\caption{(a) shows XX while (b) and (c) exemplify YYY.}\label{fig:all}
\end{figure}
\end{document}
答案2
使用(版本 1.3subfloat
中定义)和库:subcaption
quotes
\documentclass[12pt,a4paper]{article}
% LuaLaTeX is used
\usepackage{caption}
\usepackage{subcaption}
\usepackage[compat=1.1.0]{tikz-feynman}
\usetikzlibrary{positioning, quotes}
\begin{document}
\begin{figure}
\subfloat[The left \label{subfig:left}]
{
\begin{tikzpicture}
\begin{feynman}[node distance=9.5mm and 8mm]
\vertex (a) {\(g\)};
\vertex[right=10mm of a] (b);
\vertex[below right=of b] (c);
\vertex[below left=of c] (d);
\vertex[left =of d] (e) {\(g\)};
\vertex[right=of b] (f) {\(t\)};
\vertex[right=of c] (g) {\(H\)};
\vertex[right=of d] (h) {\(\overline{t}\)};
\diagram*{
(a) -- [gluon] (b) -- [anti fermion] (c)
-- [anti fermion] (d) -- [gluon] (e),
(b) -- [fermion] (f),
(c) -- [scalar] (g),
(d) -- [anti fermion] (h),
};
\end{feynman}
\end{tikzpicture}
}
\hfill
\subfloat[The center \label{subfig:center}]
{
\begin{tikzpicture}
\begin{feynman}[node distance=8mm and 8mm]
\vertex (a) {\(g\)};
\vertex[below right=of a] (b);
\vertex[below left=of b] (c) {\(g\)};
\vertex[right=of b] (d);
\vertex[above right=of d] (e);
\vertex[below right=of d] (f) {\(\overline{t}\)};
\vertex[above right=of e] (g) {\(t\)};
\vertex[below right=of e] (h) {\(H\)};
\diagram*{
(a) -- [gluon] (b) -- [gluon] (c),
(b) -- [gluon, "$g$"] (d) -- [fermion, "$t$"] (e)
-- [fermion] (g),
(d) -- [anti fermion] (f),
(e) -- [scalar] (h),
};
\end{feynman}
\end{tikzpicture}
}%
\hfill
\subfloat[The right \label{subfig:right}]
{
\begin{tikzpicture}
\begin{feynman}[node distance=8mm and 8mm]
\vertex (a) {\(g\)};
\vertex[below right=of a] (b);
\vertex[below left=of b] (c) {\(\bar{q}\)};
\vertex[below left=of c] (d);
\vertex[right=of b] (d);
\vertex[above right=of d] (e);
\vertex[below right=of d] (f) {\(\overline{t}\)};
\vertex[above right=of e] (g) {\(t\)};
\vertex[below right=of e] (h) {\(H\)};
\diagram*{
(a) -- [fermion] (b) -- [fermion] (c),
(b) -- [gluon, "\(g\)"] (d) -- [fermion,"\(t\)"] (e)
-- [fermion] (g),
(d) -- [anti fermion] (f),
(e) -- [scalar] (h),
};
\end{feynman}
\end{tikzpicture}
}%
\caption{Feynman diagrams.}
\label{sugf:all}
\end{figure}
See Feyman diagrams \ref{subfig:left}, \ref{subfig:center} and \ref{subfig:right}.
\end{document}