如何将 Matrix 和 Tikzpicture 对齐在同一水平线上

如何将 Matrix 和 Tikzpicture 对齐在同一水平线上

我正在使用子浮点数尝试将我的图表与矩阵数组对齐。我希望它们彼此相邻,并且根据建议,使用子浮点数尝试对齐它们。我收到了错误消息。虽然这是一个相对简单的代码,但我无法找出问题所在。

    \documentclass[11pt,oneside]{article}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{positioning,shapes}


\begin{document}



\begin{figure}[H]
\centering
 \subfloat[label 1]{
\begin{tikzpicture}[scale=3,line width=1pt]
\tikzstyle{every node}=[draw=black,fill=yellow!50!white,thick,
  shape=circle,minimum height=0.0001cm
  ];
 \draw (.5773502693, 0.)--(-.2886751347, .5000000000);
\draw (.5773502693, 0.)--(-.2886751347, -.5000000000);
\draw (.5773502693, 0.)--(.2886751347, .9574271080);
\draw (-.2886751347, .5000000000)--(-.2886751347, -.5000000000);
\draw (-.2886751347, .5000000000)--(-.9734937648, -.2287135539);
\draw (-.2886751347, -.5000000000)--(.6848186302, -.7287135539);
\draw (.2886751347, .5000000000)--(-.5773502693, 0.);
\draw (.2886751347, .5000000000)--(.2886751347, -.5000000000);
\draw (.2886751347, .5000000000)--(-.6848186302, .7287135539);
\draw (-.5773502693, 0.)--(.2886751347, -.5000000000);
\draw (-.5773502693, 0.)--(-.2886751347, -.9574271080);
\draw (.2886751347, -.5000000000)--(.9734937648, .2287135539);
\draw (.2886751347, .9574271080)--(-.6848186302, .7287135539);
\draw (.2886751347, .9574271080)--(.9734937648, .2287135539);
\draw (-.6848186302, .7287135539)--(-.9734937648, -.2287135539);
\draw (-.9734937648, -.2287135539)--(-.2886751347, -.9574271080);
\draw (-.2886751347, -.9574271080)--(.6848186302, -.7287135539);
\draw (.6848186302, -.7287135539)--(.9734937648, .2287135539);
\node at (.5773502693, 0) {1};
\node at (-.2886751347, .5000000000) {2};
\node at (-.2886751347, -.5000000000) {3};
\node at (.2886751347, .5000000000) {4};
\node at (-.5773502693, 0.) {5};
\node at (.2886751347, -.5000000000) {6};
\node at (.2886751347, .9574271080) {7};
\node at (-.6848186302, .7287135539) {8};
\node at (-.9734937648, -.2287135539) {9};
\node at (-.2886751347, -.9574271080) {10};
\node at (.6848186302, -.7287135539) {11};
\node at (.9734937648, .2287135539) {12};
\end{tikzpicture}}

\begin{tikzpicture}
\tikzset{
    table/.style={
        matrix of nodes,
        row sep=-\pgflinewidth,
        column sep=-\pgflinewidth,
        nodes={
            rectangle,
            draw=black,
            align=center
        },
        minimum height=2.5em,
        text depth=0.5ex,
        text height=0.5ex,
        nodes in empty cells,
%%
        every even row/.style={
            nodes={fill=gray!20}
        },
        column 1/.style={
            nodes={text width=2em,font=\bfseries}
        },
        row 1/.style={
            nodes={
                fill=black,
                text=white,
                font=\bfseries
            }
        }
    }
}
\matrix (first) [table,text width=4cm]
{
& X & Y\\
1 & $\sqrt{3}/3$ & $0$ \\
2 & $-\sqrt{3}/6$ & $1/2$ \\
3 & $-\sqrt{3}/6$ & $-1/2$ \\
4 & $\sqrt{3}/6$ & $1/2$ \\
5 & $-\sqrt{3}/3$ & $0$ \\
6 & $\sqrt{3}/6$ & $-1/2$ \\
7 & $\sqrt{3}/6$ & $\sqrt{33}/6$ \\
8 & $\sqrt{3}/12-\sqrt{11}/4$ & $1/4+\sqrt{33}/12$ \\
9 & $-\sqrt{3}/12-\sqrt{11}/4$ & $1/4-\sqrt{33}/12$ \\
10 & $-\sqrt{3}/6$ & $-\sqrt{33}/6$ \\
11 & $-\sqrt{3}/12+\sqrt{11}/4$ & $-1/4-\sqrt{33}/12$ \\
12 & $\sqrt{3}/12+\sqrt{11}/4$ & $-1/4+\sqrt{33}/12$ \\
};

\end{tikzpicture}%


\end{figure}
\end{document} 

相关内容