在等式内对齐图片

在等式内对齐图片

考虑以下代码:

\documentclass{article}
\usepackage{amsmath} % math
\usepackage{amssymb} % math
\usepackage{amsthm}
\usepackage{graphicx} % to use \includegraphics{}
\usepackage{tikz}
\usepackage{tikz-feynman}

\begin{document}
%propagator line
\begin{equation}
\begin{tikzpicture}[baseline=(current  bounding  box.center)]
\begin{feynman}
    \vertex (a);
    \vertex[right= of a] (b);
    \diagram*{
    (a) --[fermion, edge label=${k, i\omega_n}$] (b)
};
\end{feynman}
\end{tikzpicture}=\frac{1}{i\omega_n -\epsilon_k}, \quad \begin{tikzpicture}[baseline=(current  bounding  box.center)]
\begin{feynman}
\vertex (a);
\vertex[right= of a] (b);
\diagram*{
    (a) --[charged scalar, edge label=${i\omega_n}$] (b)
};
\end{feynman}
\end{tikzpicture}=\frac{1}{i\omega_n -\lambda}.
\end{equation}

\end{document}

其输出就像 在此处输入图片描述

我想将线条对齐,使其位于 = 符号的中间。我该怎么做?

答案1

您可以使用https://tex.stackexchange.com/a/59660/4427,即

baseline=-\the\fontdimen22\textfont2

代码:

\documentclass{article}
\usepackage{amsmath} % math
\usepackage{amssymb} % math
\usepackage{amsthm}
\usepackage{graphicx} % to use \includegraphics{}
\usepackage{tikz}
\usepackage{tikz-feynman}

\begin{document}
%propagator line
\begin{equation}
\begin{tikzpicture}[baseline=-\the\fontdimen22\textfont2)]
\begin{feynman}
    \vertex (a);
    \vertex[right= of a] (b);
    \diagram*{
    (a) --[fermion, edge label=${k, i\omega_n}$] (b)
};
\end{feynman}
\end{tikzpicture}=\frac{1}{i\omega_n -\epsilon_k}, \quad
\begin{tikzpicture}[baseline=-\the\fontdimen22\textfont2]
\begin{feynman}
\vertex (a);
\vertex[right= of a] (b);
\diagram*{
    (a) --[charged scalar, edge label=${i\omega_n}$] (b)
};
\end{feynman}
\end{tikzpicture}=\frac{1}{i\omega_n -\lambda}.
\end{equation}

\end{document}

在此处输入图片描述

答案2

pst-feyn使用和很容易获得pst-node

\documentclass{article}
\usepackage{pst-node, pst-feyn}%,
\usepackage{auto-pst-pdf}

\begin{document}

\[ %
\pnode[0,0.6ex]{A}\hspace{3.5em}\pnode[0,0.6ex]{B}\mkern 7mu = \frac{1}{i\omega_n-\epsilon_k},\qquad
\pnode[0,0.6ex]{C}\hspace{3.5em}\pnode[0,0.6ex]{D}\mkern 7mu = \frac{1}{i\omega_n-\lambda}
\psset{linewidth=0.2pt, labelsep=2pt}
\psArrowLine(A)(B)\ncline[linestyle=none]{A}{B}\naput{k, i\omega_n}
\psArrowLine[linestyle=dashed, dash=3pt 2.5pt](C)(D)\ncline[linestyle=none]{C}{D}\naput{ i\omega_n}
\]%

\end{document} 

在此处输入图片描述

答案3

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath} % math
\usepackage{amssymb} % math
\usepackage{amsthm}
\usepackage{graphicx} % to use \includegraphics{}
\usepackage{tikz}
\usepackage{tikz-feynman}

\begin{document}
    %propagator line
    \begin{equation}
    \begin{tikzpicture}[baseline=(current  bounding  box.base)]
    \begin{feynman}
    \vertex (a);
    \vertex[right= of a] (b);
    \diagram*{
        (a) --[fermion, edge label=${k, i\omega_n}$] (b)
    };
    \end{feynman}
    \end{tikzpicture}=\frac{1}{i\omega_n -\epsilon_k}, \quad \begin{tikzpicture}[baseline=(current  bounding  box.base)]
    \begin{feynman}
    \vertex (a);
    \vertex[right= of a] (b);
    \diagram*{
        (a) --[charged scalar, edge label=${i\omega_n}$] (b)
    };
    \end{feynman}
    \end{tikzpicture}=\frac{1}{i\omega_n -\lambda}.
    \end{equation}
    
\end{document}

答案4

我添加了另一个短代码...使用feyn包。

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb,feyn}

\begin{document}
\begin{equation}
\feyn{
!{fA}{k,i\omega_{n}}}
=\frac{1}{i\omega_{n} -\epsilon_{k}}, \quad \rlap{$\mkern 16mu\feyn{a}$}\feyn{ !h{i\omega_{n}}}=\frac{1}{i\omega_{n} -\lambda}.
\end{equation}

\end{document}

沒有錯誤,但我想這也是正常的。

在此处输入图片描述

相关内容