我试图在 tikz 图片旁边放置一个矩阵,并在它们之间放置同构,但它不起作用。有人能给我建议吗?
这是我的尝试:
\documentclass[10pt]{article}
\usepackage{geometry}% <-- added,
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{mathrsfs,array}
\begin{document}
\definecolor{uuuuuu}{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
\tikzset{graph-1/.style = {
line cap = round,
line join = round,
> = triangle 45,
x=0.7cm, y=0.7cm,
every node/.append style = {inner ysep=2mm}
}
}% end of tikzset
\begin{figure}[h]
\centering
$\displaystyle
\alpha=
\begin{pmatrix}
0 & 0 & 0 \\
1 & 0 & 0 \\
0 & 1 & 0
\end{pmatrix}
\cong
\begin{tikzpicture}[graph-1]
\draw (0, 1.5) -- + (2,0);
\draw (0,-1.5) -- + (2,0);
%%%
\foreach \x in {0, 1}
\draw (\x,1.5) -- (\x+1,-1.5);
\foreach \x/\label in {0/\scriptstyle1, 1/\scriptstyle2, 2/\scriptstyle3}
\draw[fill=uuuuuu] (\x,1.5) circle (1.3pt) node[above] {$\label$};
%
\foreach \x/\label in {0/\scriptstyle1, 1/\scriptstyle2, 2/\scriptstyle3}
\draw[fill=uuuuuu] (\x,-1.5) circle (1.3pt) node[below] {$\label$};
\end{tikzpicture}
$
\caption{Caption}
\label{ex}
\end{figure}
\end{document}
答案1
我认为,加载amsmath
包并进行一些小的调整后它就可以工作了。
\documentclass[10pt]{article}
\usepackage{amsmath}%<-- added,
\usepackage{geometry}%
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{mathrsfs,array}
\begin{document}
\definecolor{uuuuuu}{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
\tikzset{graph-1/.style = {
line cap = round,
line join = round,
> = triangle 45,
x=0.7cm, y=0.7cm,
every node/.append style = {inner ysep=2mm}
}
}% end of tikzset
\begin{figure}[h]
\[ \alpha=
\begin{pmatrix}
0 & 0 & 0 \\
1 & 0 & 0 \\
0 & 1 & 0 \\
\end{pmatrix}
\cong
\begin{tikzpicture}[graph-1,baseline={(fakebase.base)}]
\node[draw=none] (fakebase){\strut};
\draw (0, 1.5) -- + (2,0);
\draw (0,-1.5) -- + (2,0);
%%%
\foreach \x in {0, 1}
\draw (\x,1.5) -- (\x+1,-1.5);
\foreach \x/\label in {0/\scriptstyle1, 1/\scriptstyle2, 2/\scriptstyle3}
\draw[fill=uuuuuu] (\x,1.5) circle (1.3pt) node[above] {$\label$};
%
\foreach \x/\label in {0/\scriptstyle1, 1/\scriptstyle2, 2/\scriptstyle3}
\draw[fill=uuuuuu] (\x,-1.5) circle (1.3pt) node[below] {$\label$};
\end{tikzpicture}
\]
\caption{Caption}
\label{ex}
\end{figure}
\end{document}