在 LaTeX 上创建格子乘法图像

在 LaTeX 上创建格子乘法图像

我需要一张详细描述格乘法的图像,它应该是这样的:

http://megamindacademy.com/wp-content/uploads/2011/09/Lattice-Method-for-Multiplication-Example-51.jpg

答案1

这不是完整的代码,但这是开始绘制图片的一种方式。我认为有很多更好的可能性...您需要 fit 库来绘制黄线。您可以看到很多示例来完成图片。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit}

\begin{document}
\begin{tikzpicture}[case/.style={minimum width=2cm,minimum height=2cm,draw},line/.style={blue!10!gray,line width=4,line cap=round,line join=round}]
\node[case] (a) at (0,0){} ;
\node[case] (b) at (2,0){} ;
\node[case] (c) at (0,2){} ;
\node[case] (d) at (2,2){} ;

\draw[line] (c.south west) -- (c.north west) -- (c.north east) -- (c.south west)-- ++(-1,-1);
\draw[line] (c.south west) -- (c.south east) -- (c.north east) -- (d.north east)-- (a.south west) -- ++(-1,-1);
\draw[line] (d.north east) -- (b.north east) -- (b.north west) -- (b.south west)-- (a.south west) -- (a.north  west);
\draw[line] (b.south west) -- (b.south east) -- (b.north east) -- (b.south west)-- ++(-1.25,-1.25);

\node[left=0.5 cm,above] at (a) {\huge 2};
\node[above=0.25 cm] at (c.north) {\huge 4};
\node[above=0.25 cm] at (d.north) {\huge 5};
\node[text=green,shift={(0.5,0.5)}] at (d.north east) { \huge $\times$};

\end{tikzpicture}
\end{document}   

在此处输入图片描述

相关内容