更重要的是,一个NewSavebox无法编译

时间:2015-07-26 15:24:33

标签: latex tikz

以下代码第二个\newsavebox{\spec}存在问题。它不编译。但是,如果我使用\speciesone两倍,即:

\matrix [matrix of nodes] {
\node (species1) [shape=rectangle,draw] {\usebox{\speciesone}}; & \node (species2) [shape=rectangle,draw] {\usebox{\speciesone}};\\
};

我没问题。

\documentclass[xcolor=pdftex,table,10pt,yellow,mathserif]{article}
\usepackage{tikz}
\usetikzlibrary{matrix}

\newsavebox{\speciesone}
\sbox{\speciesone}{
\begin{tabular}{c c c c}
  \multicolumn{3}{c}{{$k~ \times $  1}} \tabularnewline
  \hline
  $\vec{v} =$ &  $v_{1}$ & $v_{2}$ & $v_{3}$ \tabularnewline
  \hline
  \hline
  & $\circ$ & $\circ$ & $\circ$ \tabularnewline
\end{tabular}
}

\newsavebox{\spec}
\sbox{\spec}{
\begin{tabular}{c c c c}
  \multicolumn{3}{c}{{$k~ \times $  2}} \tabularnewline
  \hline
  $\vec{v} =$ &  $v_{1}$ & $v_{2}$ & $v_{3}$ \tabularnewline
  & $\circ$ & $\circ$ & $\circ$ \tabularnewline
\end{tabular}
}

\begin{document}
\begin{tikzpicture}
\matrix [matrix of nodes] {
\node (species1) [shape=rectangle,draw] {\usebox{\speciesone}}; & \node (species2) [shape=rectangle,draw] {\usebox{\spec}};\\
};
\end{tikzpicture}
\end{document}

1 个答案:

答案 0 :(得分:0)

要避免未定义的控制序列... 错误,您应该剪切\begin{document}并将其粘贴到之前

\newsavebox{\speciesone}
\sbox{\speciesone}{
...
}

\newsavebox{\spec}
\sbox{\spec}{
...
}