执行

执行

我怎样才能编写 Latex 代码并生成如下所示的矩形?

有谁能帮我解决这个问题,我真的很着急,

答案1

执行

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[scale=2] % <--- scale goes HERE!
    \begin{scope}[line width=2pt]
        \foreach \x in {0,1,...,10} {
            \foreach \y in {0,1,...,3} {
                \draw (\x*0.2,\y*0.2) rectangle +(0.2,0.2);
            }
        }
        \node[right] at (11*0.2,2*0.2) {2 squares};
        \node (a1) at (9*0.2+0.1,0*0.2) {};
    \end{scope}
    \begin{scope}[ultra thick,yshift=-1.2cm]
        \node (b1) at (2*0.2,3*0.2) {};
        \foreach \x in {0,1,...,3} {
            \foreach \y in {0,1,...,2} {
                \draw (\x*0.2,\y*0.2) rectangle +(0.2,0.2);
            }
        }
        \node[right] at (11*0.2,1*0.2+0.1) {1 square};
        \node (b2) at (3*0.2+0.1,0*0.2) {};
    \end{scope}
    \begin{scope}[thin,yshift=-2.0cm]
        \node (c1) at (1*0.2+0.1,1*0.2) {};
        \foreach \x in {0,1,...,2} {
            \foreach \y in {0} {
                \draw (\x*0.2,\y*0.2) rectangle +(0.2,0.2);
            }
        }
        \node[right] at (11*0.2,0*0.2+0.1) {3 squares};
    \end{scope}
    \draw[help lines,-latex] (a1) -- +(0,-0.3) -| (b1);
    \draw[-latex] (b2) -- +(0,-0.3) -| (c1);
\end{tikzpicture}
\end{document}

输出

在此处输入图片描述

相关内容