在图片上方插入文本

在图片上方插入文本

我有以下内容:

\documentclass[border=3mm]{standalone}
\usepackage{tikz-feynman}
\usetikzlibrary{shapes.geometric}
\usepackage{amsmath}

\begin{document}
% ~~~ some variations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


\raisebox{9.5ex}{(a)}

\begin{tikzpicture}
    \begin{feynman}
    \node[text width=2cm, anchor=west, right] at (5,3)
{$\gamma \gamma \to \pi^+ \pi^-$};
        \node[shape=circle,fill=black,inner sep=0pt,minimum size=20pt] (m) at ( 0, 0) {};
        \vertex (a) at ( 225:2cm) {};% <<< changed y-coordinate
        \vertex (b) at ( -45:2cm) {};%<<< switched to polar: -60 deg, 1 cm radius
        \vertex (c) at (135:2cm) {};
        \vertex (d) at (45:2cm) {};
        \diagram* {
            (a) -- [photon,color=red,edge label'=$q_2$] (m) % <<< funny bend
                -- [photon,color=red,edge   label'=$q_1$] (c),
            (b) -- [plain,edge label=$p_2$] (m) %<<< some color
                -- [plain, edge label=$p_1$] (d),
          };
    \end{feynman}
    
\end{tikzpicture}

 \raisebox{9.5ex}{=}


\begin{tikzpicture}
   \begin{feynman}
        \node[shape=circle,draw=black, inner sep=0pt,minimum size=20pt] (m) at ( 0, 0) {};
        \vertex (a) at ( 225:2cm) {};% <<< changed y-coordinate
        \vertex (b) at ( -45:2cm) {};%<<< switched to polar: -60 deg, 1 cm radius
        \vertex (c) at (135:2cm) {};
        \vertex (d) at (45:2cm) {};
        \diagram* {
            (a) -- [photon,color=red] (m) % <<< funny bend
                -- [photon,color=red] (c),
            (b) -- [plain] (m) %<<< some color
                -- [plain] (d),
          };
    \end{feynman}   
\end{tikzpicture}

\raisebox{9.5ex}{+}

\begin{tikzpicture}
\begin{feynman}
\node[shape=circle,draw=black,inner sep=0pt,minimum size=20pt] (m) at (0, 0) {};
\node[shape=rectangle,fill=black,draw=black] (n) at (3.1, 0) {\rule{0.5cm}{0.5cm}};
\vertex (a) at (225:2cm) {};
\vertex (b) at (-45:2cm) {};
\vertex (c) at (135:2cm) {};
\vertex (d) at (45:2cm) {};
\vertex (e) at ($(n) + (-45:2cm)$) {};
\vertex (f) at ($(n) + (45:2cm)$) {};

\diagram*{
(a) -- [photon,color=red] (m)
-- [photon,color=red] (c),
(n) -- [bend left=45, edge label=$\pi^-(K^-)$] (m)
-- [bend left=45, edge label=$\pi^+(K^+)$] (n),
(e) -- (n) -- (f),
};
\end{feynman}
\end{tikzpicture}
\end{document}

这使:

在此处输入图片描述

我需要在图片上方添​​加公式 $\gamma \gamma \to \pi^+ \pi^-$;为此,我将其定义为节点。但是,这会扭曲图片并在第一张图和第二张图之间产生空白。我该如何解决这个问题?

答案1

  • 方程应该在图片之外和图片上方
  • 您应该在standalone选项中添加选项varwidth=141mm
\documentclass[border=3mm, varwidth=141mm]{standalone}
\usepackage{tikz-feynman}

\begin{document}
\[
\gamma\gamma\to\pi^+\pi^-
\]

(a)
\begin{tikzpicture}[baseline]
    \begin{feynman}
        \node[shape=circle,fill=black,inner sep=0pt,minimum size=20pt] (m) at ( 0, 0) {};
        \vertex (a) at ( 225:2cm) {};% <<< changed y-coordinate
        \vertex (b) at ( -45:2cm) {};%<<< switched to polar: -60 deg, 1 cm radius
        \vertex (c) at (135:2cm) {};
        \vertex (d) at (45:2cm) {};
        \diagram* {
            (a) -- [photon,color=red,edge label'=$q_2$] (m) % <<< funny bend
                -- [photon,color=red,edge   label'=$q_1$] (c),
            (b) -- [plain,edge label=$p_2$] (m) %<<< some color
                -- [plain, edge label=$p_1$] (d),
          };
    \end{feynman}
\end{tikzpicture}
=
\begin{tikzpicture}[baseline]
   \begin{feynman}
        \node[shape=circle,draw=black, inner sep=0pt,minimum size=20pt] (m) at ( 0, 0) {};
        \vertex (a) at ( 225:2cm) {};% <<< changed y-coordinate
        \vertex (b) at ( -45:2cm) {};%<<< switched to polar: -60 deg, 1 cm radius
        \vertex (c) at (135:2cm) {};
        \vertex (d) at (45:2cm) {};
        \diagram* {
            (a) -- [photon,color=red] (m) % <<< funny bend
                -- [photon,color=red] (c),
            (b) -- [plain] (m) %<<< some color
                -- [plain] (d),
          };
    \end{feynman}
\end{tikzpicture}
+
\begin{tikzpicture}[baseline]
    \begin{feynman}
        \node[shape=circle,draw=black,inner sep=0pt,minimum size=20pt] (m) at (0, 0) {};
        \node[shape=rectangle,fill=black,draw=black] (n) at (3.1, 0) {\rule{0.5cm}{0.5cm}};
        \vertex (a) at (225:2cm) {};
        \vertex (b) at (-45:2cm) {};
        \vertex (c) at (135:2cm) {};
        \vertex (d) at (45:2cm) {};
        \vertex (e) at ($(n) + (-45:2cm)$) {};
        \vertex (f) at ($(n) + (45:2cm)$) {};

        \diagram*{
        (a) -- [photon,color=red] (m)
        -- [photon,color=red] (c),
        (n) -- [bend left=45, edge label=$\pi^-(K^-)$] (m)
        -- [bend left=45, edge label=$\pi^+(K^+)$] (n),
        (e) -- (n) -- (f),
        };
    \end{feynman}
\end{tikzpicture}

\end{document}

或者使用article文档类,您需要定义足够大的\textwidth,例如通过添加\usepackage{geometry}到文档前言和方程式以及在center环境中插入图片:

\documentclass{article}
\usepackage{geometry}  % <---
\usepackage{tikz-feynman}

\begin{document}
    \begin{center}   
$
\gamma\gamma\to\pi^+\pi^-
$

(a)
\begin{tikzpicture}[baseline]
    \begin{feynman}
        \node[shape=circle,fill=black,inner sep=0pt,minimum size=20pt] (m) at ( 0, 0) {};
        \vertex (a) at ( 225:2cm) {};% <<< changed y-coordinate
        \vertex (b) at ( -45:2cm) {};%<<< switched to polar: -60 deg, 1 cm radius
        \vertex (c) at (135:2cm) {};
        \vertex (d) at (45:2cm) {};
        \diagram* {
            (a) -- [photon,color=red,edge label'=$q_2$] (m) % <<< funny bend
                -- [photon,color=red,edge   label'=$q_1$] (c),
            (b) -- [plain,edge label=$p_2$] (m) %<<< some color
                -- [plain, edge label=$p_1$] (d),
          };
    \end{feynman}
\end{tikzpicture}
=
\begin{tikzpicture}[baseline]
   \begin{feynman}
        \node[shape=circle,draw=black, inner sep=0pt,minimum size=20pt] (m) at ( 0, 0) {};
        \vertex (a) at ( 225:2cm) {};% <<< changed y-coordinate
        \vertex (b) at ( -45:2cm) {};%<<< switched to polar: -60 deg, 1 cm radius
        \vertex (c) at (135:2cm) {};
        \vertex (d) at (45:2cm) {};
        \diagram* {
            (a) -- [photon,color=red] (m) % <<< funny bend
                -- [photon,color=red] (c),
            (b) -- [plain] (m) %<<< some color
                -- [plain] (d),
          };
    \end{feynman}
\end{tikzpicture}
+
\begin{tikzpicture}[baseline]
    \begin{feynman}
        \node[shape=circle,draw=black,inner sep=0pt,minimum size=20pt] (m) at (0, 0) {};
        \node[shape=rectangle,fill=black,draw=black] (n) at (3.1, 0) {\rule{0.5cm}{0.5cm}};
        \vertex (a) at (225:2cm) {};
        \vertex (b) at (-45:2cm) {};
        \vertex (c) at (135:2cm) {};
        \vertex (d) at (45:2cm) {};
        \vertex (e) at ($(n) + (-45:2cm)$) {};
        \vertex (f) at ($(n) + (45:2cm)$) {};

        \diagram*{
        (a) -- [photon,color=red] (m)
        -- [photon,color=red] (c),
        (n) -- [bend left=45, edge label=$\pi^-(K^-)$] (m)
        -- [bend left=45, edge label=$\pi^+(K^+)$] (n),
        (e) -- (n) -- (f),
        };
    \end{feynman}
\end{tikzpicture}
\end{center}
\end{document}

在这两种情况下你都会得到相同的结果:

在此处输入图片描述

相关内容