tikzpicture と配列をサブ図に並べて配置すると位置が合わない

tikzpicture と配列をサブ図に並べて配置すると位置が合わない

tikzpicture私は a (ネットワークのイメージ) と配列 (マトリックス) を並べて配置しようとしていますが、何をしても正しく配置されません。2 つの配列を並べて配置したり、2 つtikzpictureの s を並べて配置すると正しく配置されます (同じ行に) が、この 2 つを混在させると問題が発生します。サブ図でこれらの 2 つの環境を扱っている投稿はまだ見つかっていません。これが私のコードです。

\documentclass[12ptm]{article}
\usepackage{amsmath, amsthm}
\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{arrows}
\usepackage{subcaption}

\begin{document}


\begin{figure}
\begin{subfigure}[t]{0.1\textwidth}
\centering
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=1.5cm,
        thick,main node/.style={circle,draw,font=\Large\bfseries}]

\tikzstyle{every node}=[draw,shape=circle];
\node[draw=none, shape=circle,scale=0.02cm, fill=none] (n1) {} ;
\node[draw,shape=circle,scale=0.02cm, main node](n2) [left of=n1] {$M$} ;
\node[draw,shape=circle,scale=0.02cm, main node] (n4) [above of=n1] {1} ;
\node[draw,shape=circle,scale=0.02cm, main node] (n3) [below of=n1] {3} ;
\node[draw,shape=circle,scale=0.02cm, main node] (n5) [right of=n1] {2} ;

\draw[<->] (n2) to[bend left=30] (n4);
\draw[<->] (n2) to[bend right=30] (n3);
\draw[->] (n4) to[bend left=30] (n5);
\draw[<->] (n3) to (n4);
\end{tikzpicture}
\end{subfigure}
\begin{subfigure}[t]{0.4\textwidth}
\centering
\[
\begin{array}{cccc}
\begin{array}{cccc} 
\\
&A &  &\;B\\
\end{array} 
\\
\begin{array}{cc}
 a \\
\\
  b\\

\end{array} 
\begin{array}{|cc|cc|}
\hline 
$6$&&$2$&\\
&$6$&&$7$\\ \hline
$7$&&$0$&\\
&$2$&&$0$\\ \hline

\end{array}
\end{array}
\]

\end{subfigure}
\end{figure}
\end{document}

ご覧のとおり、表示されるのはネットワーク図と、そのネットワークの斜め下 (右) にある別の線上の配列です。これらを並べて表示したいのです。

答え1

偽物が多く$subfigureマークアップはあまり役に立たなかったので削除しました。ここでは、\raiseboxtikz を垂直方向に中央揃えするために使用しています。

ここに画像の説明を入力してください

\documentclass[12ptm]{article}
\usepackage{amsmath, amsthm}
\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{arrows}
\usepackage{subcaption}

\begin{document}


\begin{figure}

\raisebox{-.5\totalheight}{\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=1.5cm,
        thick,main node/.style={circle,draw,font=\Large\bfseries},
align=center]

\tikzstyle{every node}=[draw,shape=circle];
\node[draw=none, shape=circle,scale=0.02cm, fill=none] (n1) {} ;
\node[draw,shape=circle,scale=0.02cm, main node](n2) [left of=n1] {$M$} ;
\node[draw,shape=circle,scale=0.02cm, main node] (n4) [above of=n1] {1} ;
\node[draw,shape=circle,scale=0.02cm, main node] (n3) [below of=n1] {3} ;
\node[draw,shape=circle,scale=0.02cm, main node] (n5) [right of=n1] {2} ;

\draw[<->] (n2) to[bend left=30] (n4);
\draw[<->] (n2) to[bend right=30] (n3);
\draw[->] (n4) to[bend left=30] (n5);
\draw[<->] (n3) to (n4);
\end{tikzpicture}}
$\begin{array}{cccc}
\begin{array}{cccc} 
\\
&A &  &\;B\\
\end{array} 
\\
\begin{array}{cc}
 a \\
\\
  b\\
\end{array} 
\begin{array}{|cc|cc|}
\hline 
6&&2&\\
&6&&7\\ \hline
7&&0&\\
&2&&0\\ \hline

\end{array}
\end{array}
$
\end{figure}
\end{document}

答え2

スタイルを使用してbaseline垂直方向の配置を設定できます。

\begin{tikzpicture}[baseline={(n2)}, ...]

大丈夫なはず。

関連情報