Quarroz
Quarroz

Reputation: 57

LaTeX: Split and gathered environment

I would like to split on multiple lines an equation which contain tikzpicture in gathered environment. I have tried to use align and split environments but both did not work...

Here is a working example where the equation is on one line:

\documentclass[12pt]{article}

\usepackage{amssymb}
% !TEX program = lualatex
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}

\usepackage{tikz}
\usepackage[compat=1.1.0]{tikz-feynman}

\begin{document}

\begin{equation}
        2\Im\left(F(q^2)\right) =
    \begin{gathered}
        \scalebox{0.7}{
            \begin{tikzpicture}
                \begin{feynman}
                  \vertex (i1) {\(s\)};
                  \vertex [right=of i1] (a);
                  \vertex [right=of a]  (b);
                  \vertex [right=of b]  (i2);
                    \diagram* {
                      i1 -- a --[half left] b -- i2,
                      b --[half left, double] a,
                    };

                    %% Find the midpoint which is halfway between a and b
                    \coordinate (midpoint) at ($(a)!0.5!(b)$);
                    %% Draw a line starting 2 units above the midpoint, and
                    %% ending 2 units below the midpoints
                    \draw [dashed] ($(midpoint) + (0, 0.8)$) -- ($(midpoint) + (0,-0.8)$);
                \end{feynman}
            \end{tikzpicture}
          }
   \end{gathered}
    = \int\frac{\,d^d k}{i\pi^{d/2}} \left[2\pi i\: \theta(k^0)\delta(k^2-m^2)\right]\left[2\pi i\: \theta(q^0-k^0)\delta((q-k)^2)\right]%
\end{equation}

\end{document}

Here is what I would like to do

\documentclass[12pt]{article}

\usepackage{amssymb}
% !TEX program = lualatex
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}

\usepackage{tikz}
\usepackage[compat=1.1.0]{tikz-feynman}

\begin{document}

\begin{equation}
    \begin{split}
        2\Im\left(F(q^2)\right) &=
    \begin{gathered}
        \scalebox{0.7}{
            \begin{tikzpicture}
                \begin{feynman}
                  \vertex (i1) {\(s\)};
                  \vertex [right=of i1] (a);
                  \vertex [right=of a]  (b);
                  \vertex [right=of b]  (i2);
                    \diagram* {
                      i1 -- a --[half left] b -- i2,
                      b --[half left, double] a,
                    };

                    %% Find the midpoint which is halfway between a and b
                    \coordinate (midpoint) at ($(a)!0.5!(b)$);
                    %% Draw a line starting 2 units above the midpoint, and
                    %% ending 2 units below the midpoints
                    \draw [dashed] ($(midpoint) + (0, 0.8)$) -- ($(midpoint) + (0,-0.8)$);
                \end{feynman}
            \end{tikzpicture}
          }
   \end{gathered}\\
    &= \int\frac{\,d^d k}{i\pi^{d/2}} \left[2\pi i\: \theta(k^0)\delta(k^2-m^2)\right]\left[2\pi i\: \theta(q^0-k^0)\delta((q-k)^2)\right]%
\end{split}
\end{equation}

\end{document}

The latter returns a error due to the gathered in the split environment.

Does any of you know to solution to my problem ?

Upvotes: 1

Views: 1214

Answers (1)

DeX97
DeX97

Reputation: 657

It's unclear to me what your desired result should look like exactly, but I think this should be approximately what you want:

\documentclass[12pt]{article}

\usepackage{amssymb}
% !TEX program = lualatex
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}

\usepackage{tikz}
\usepackage[compat=1.1.0]{tikz-feynman}

\begin{document}

\begin{align}
    2\Im\left(F(q^2)\right) &=
    \parbox{0.5\linewidth}{%
        \scalebox{0.7}{
            \begin{tikzpicture}
                \begin{feynman}
                  \vertex (i1) {\(s\)};
                  \vertex [right=of i1] (a);
                  \vertex [right=of a]  (b);
                  \vertex [right=of b]  (i2);
                    \diagram* {
                      i1 -- a --[half left] b -- i2,
                      b --[half left, double] a,
                    };
                    %% Find the midpoint which is halfway between a and b
                    \coordinate (midpoint) at ($(a)!0.5!(b)$);
                    %% Draw a line starting 2 units above the midpoint, and
                    %% ending 2 units below the midpoints
                    \draw [dashed] ($(midpoint) + (0, 0.8)$) -- ($(midpoint) + (0,-0.8)$);
                \end{feynman}
            \end{tikzpicture}
          }
     } \\ 
     &= \int\frac{\,d^d k}{i\pi^{d/2}} \left[2\pi i\: \theta(k^0)\delta(k^2-m^2)\right]\left[2\pi i\: \theta(q^0-k^0)\delta((q-k)^2)\right] \notag
\end{align}

\end{document}

This gives the following result: Output

Upvotes: 1

Related Questions