1

I'm doing a row of three Feynman diagrams made with tikz-feynman. I'm having some problems with alignments.

First, I use subcaptionbox to have a vertical alignment of the subcaptions (see here). Second, I use scalebox to make them smaller (see here) so the three fit in the row.

This is the code:

\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}

Here is the output:

enter image description here

I need the three diagrams to be vertically aligned. I searched some solutions, but still I don't know how to solve this.

2 Answers 2

2

This tabular structure will align the center of the subfigures.

(With 2 \fbox added to check it out.)

c

\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}
4
  • I think I wrote wrong the question. Your code aligns the subfigures from the bottom, I would like it to be aligned from the center... I mean, the subfigure's centers must be aligned. (b) and (c) are aligned, but not (a). Apr 30, 2022 at 21:08
  • @Abel Gutiérrez Thank you for your feedback. Please see the updated the answer. May 1, 2022 at 14:31
  • Thanks @SimonDispa , however I find two problems in your solution: 1) subcaptions are not real subcaptions \\ 2) subcaptions are not aligned (you can check with \underline) (this is why I used \subcaptionbox at first) May 2, 2022 at 8:38
  • 1
    @Abel Gutiérrez The subtitles are baseline aligned. See updated figure. The underline will not certify this alignment since its position will depend on the presence of descendants (such as g). This approach allows you to decouple the subfigure from its caption text to have two independent alignments (center and baseline) Labels cannot be used with these "sub-captions". This is usually not a problem, since the comparison or explanation of the subfigures is done in the main caption of the figure and not later in the text. Even so the reference will be the full figure. May 2, 2022 at 13:49
0

With use of subfloat (as is defined in subcaption version 1.3) and quotes library:

\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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .