超出预期容量

超出预期容量

下面的代码给了我一个意外的容量超出错误,我不明白为什么......

 \[\begin{tikzpicture}[xscale=5, yscale=5.5]
 
 node (1) at (0,0){
 $\begin{tikzpicture}[xscale=0.6, yscale=0.6]

 \tikzset{morphlabel/.style={draw=black, thin, rectangle, minimum width=7pt, fill=white, 
 font=\scriptsize}}

 \node[morphlabel] at (0, 0) {$a$};
 \end{tikzpicture}$};
 \end{tikzpicture}\]

让我感到很奇怪的是,我在其他地方使用几乎相同的代码,却没有收到任何错误消息?

答案1

在此处输入图片描述

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}


\newsavebox\mybox
\begin{lrbox}{\mybox}
    \begin{tikzpicture}[]
        
        \tikzset{morphlabel/.style={draw=black, thin, rectangle, minimum width=7pt, fill=white, 
                font=\scriptsize}}
        
        \node[morphlabel] at (0,0) {$a$};
\end{tikzpicture}
\end{lrbox}

\begin{document}
\begin{tikzpicture}[]
    
    \node (1) at (0,0){\usebox\mybox};
\end{tikzpicture}
\end{document}

相关内容