# formula and a table in align environment

I need to type formula and table in an align environment like but I only could prepare

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{diagbox}

\begin{document}

\begin{tabular}{c c c}
&$\left(\frac{1}{2} \, m'\right| J_x \left| \frac{1}{2} \, m \right)$&
\\ && \\
\diagbox{$m'$}{$m$}& $+\frac{1}{2}$ & $-\frac{1}{2}$ \\ [1.5 em]
$+\frac{1}{2}$ & 0 & $\frac{\hbar}{2}$ \\ [1.5 em]
$-\frac{1}{2}$ & $\frac{\hbar}{2}$ & 0  \\ [1.5 em]
\end{tabular}

\begin{tabular}{c c c}
&$\left(\frac{1}{2} \, m'\right| J_y \left| \frac{1}{2} \, m \right)$&
\\ && \\
\diagbox{$m'$}{$m$}& $+\frac{1}{2}$ & $-\frac{1}{2}$ \\ [1.5 em]
$+\frac{1}{2}$ & 0 & $-i\frac{\hbar}{2}$ \\ [1.5 em]
$-\frac{1}{2}$ & $i\frac{\hbar}{2}$ & 0  \\ [1.5 em]
\end{tabular}

\begin{tabular}{c c c}
&$\left(\frac{1}{2} \, m'\right| J_z \left| \frac{1}{2} \, m \right)$&
\\ && \\
\diagbox{$m'$}{$m$}& $+\frac{1}{2}$ & $-\frac{1}{2}$ \\ [1.5 em]
$+\frac{1}{2}$ & $\frac{\hbar}{2}$ & 0  \\ [1.5 em]
$-\frac{1}{2}$ &  0 & $-\frac{\hbar}{2}$  \\ [1.5 em]
\end{tabular}

\end{document}


which is not the same as what I want. How can I figure it out?

Many thanks

• Consider TikZ... – user156344 Apr 23 at 16:32
• Please explain your suggestion with a code. – AYBRXQD Apr 23 at 16:33

This is a TikZ code for the first diagram (and you can draw the rest I think).

\documentclass[tikz]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix[matrix of math nodes,nodes={
minimum height=0.8cm,minimum width=1.5cm,anchor=center}] (x) {
& +\frac12 & -\frac12\\
+\frac12 & 0 & \frac\hbar2\\
-\frac12 & \frac\hbar2 & 0\\};
\draw (x-2-3.north east) -| (x-3-2.south west);
\draw (x-2-2.north west) -- ++ (-1,2/3)
node[midway,above right,inner sep=2pt] {$m$}
node[midway,below left,inner sep=0pt] {$m'$};
\path (x-1-2.north) node[above=1ex] {$(\frac12m'\mid J_x\mid\frac12m)$};
\end{tikzpicture}
\end{document}