# how to align these diagrams

i am trying to align the left hand text with right hand diagram.but its not working.if i use \feynmandiagram[baseline] it can be done.but if i manually adjust my diagram it is not working.heres an example

\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{braket}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{tikz-feynman}
\usepackage[compat=1.1.0]{tikz-feynman}
\usepackage{simpler-wick}
\usetikzlibrary{calc}
\usepackage{cancel}
\begin {document}
$\braket{p_1p_2|i\mathcal{T}|p_Ap_B}= \begin{tikzpicture} \begin{feynman} \vertex (a); \vertex[right=2 cm of a ](b); \vertex[below=2 cm of b] (c); \vertex[left=2 cm of c](d); \vertex[below right=1cm of a](e); \diagram*{ (a)--(c),(b)--(d) }; \end{feynman} \end{tikzpicture} + \begin{tikzpicture} \begin{feynman} \vertex (a); \vertex [right=2cm of a] (b); \vertex[above right=1.414 cm of a](c); \vertex[above=1 cm of c](d); \vertex[above right=1.414 cm of d](e); \vertex[above left=1.414 cm of d](f); \diagram*{ (a)--(c), (b)--(c), (c)--[out= 0,in=0](d), (c)--[out=180,in=180](d), (d)--(e), (d)--(f) }; \end{feynman} \end{tikzpicture}$
\end{document}


giving me this result.But i want the left hand text to be align with the diagrams.how can i do that. thank you.

• you load tikz-feynman twice
• package simpler-wick had to be loaded before tikz-feynman otherwise you have clash between this two packages
• better is write your equation as diapslay math, not as in line math
• for align tikzpictures you should move their baselines to their centers
• equation should be inside frame

\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{braket}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{simpler-wick}
\usepackage[compat=1.1.0]{tikz-feynman}

\usetikzlibrary{calc}
\usepackage{cancel}

\begin{document}
\begin{frame}
$% <--- \braket{p_1p_2|i\mathcal{T}|p_Ap_B}= \begin{tikzpicture}[baseline=(current bounding box.center)] \begin{feynman} \vertex (a); \vertex[right=2 cm of a ](b); \vertex[below=2 cm of b] (c); \vertex[left=2 cm of c](d); \vertex[below right=1cm of a](e); \diagram*{ (a)--(c),(b)--(d) }; \end{feynman} \end{tikzpicture} + \begin{tikzpicture}[baseline=(current bounding box.center)] \begin{feynman} \vertex (a); \vertex [right=2cm of a] (b); \vertex[above right=1.414 cm of a](c); \vertex[above=1 cm of c](d); \vertex[above right=1.414 cm of d](e); \vertex[above left=1.414 cm of d](f); \diagram*{ (a)--(c), (b)--(c), (c)--[out= 0,in=0](d), (c)--[out=180,in=180](d), (d)--(e), (d)--(f) }; \end{feynman} \end{tikzpicture}$
\end{frame}
\end{document}


• thank you.why you put [\ .../] after begin{frame}? – jowadul kader Mar 11 '18 at 17:43
• why simpler-wick has to be loaded before tikz-feynman? why the clash? – jowadul kader Mar 11 '18 at 17:45
• i do no now why. i receive error, that they clash. $...$ put content in display math node (i.e.: equation is own line, not in text, read some introductory text about math in latex, for example en.wikibooks.org/wiki/LaTeX/Mathematics – Zarko Mar 11 '18 at 17:49

Besides the nice answer by @Zarko, you can vertically center anything in math-mode by \vcenter{\hbox{...}}.

\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{braket}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{simpler-wick}
\usepackage[compat=1.1.0]{tikz-feynman}

\usetikzlibrary{calc}
\usepackage{cancel}

\begin{document}
\begin{frame}
$% <--- \braket{p_1p_2|i\mathcal{T}|p_Ap_B}=\vcenter{\hbox{% \begin{tikzpicture} \begin{feynman} \vertex (a); \vertex[right=2 cm of a ](b); \vertex[below=2 cm of b] (c); \vertex[left=2 cm of c](d); \vertex[below right=1cm of a](e); \diagram*{ (a)--(c),(b)--(d) }; \end{feynman} \end{tikzpicture} }} + \vcenter{\hbox{% \begin{tikzpicture} \begin{feynman} \vertex (a); \vertex [right=2cm of a] (b); \vertex[above right=1.414 cm of a](c); \vertex[above=1 cm of c](d); \vertex[above right=1.414 cm of d](e); \vertex[above left=1.414 cm of d](f); \diagram*{ (a)--(c), (b)--(c), (c)--[out= 0,in=0](d), (c)--[out=180,in=180](d), (d)--(e), (d)--(f) }; \end{feynman} \end{tikzpicture} }}$
\end{frame}
\end{document}
`