我有一个tabular
包含多个tabular
s 的文件。我这样做是为了生成一个数学工作表。以下是示例:
\begin{tabular}{cccccccccccccccc}
\begin{tabular}{rr}&\phantom{00}3\\\times&\phantom{00}4\\\hline&12\end{tabular}&
\begin{tabular}{rr}&\phantom{00}1\\\times&\phantom{00}7\\\hline&7\end{tabular}&
\begin{tabular}{rr}&\phantom{00}6\\\times&\phantom{00}1\\\hline&6\end{tabular}&
.
.
.
\begin{tabular}{rr}&\phantom{0}11\\\times&\phantom{00}1\\\hline&11\end{tabular}
\end{tabular}
我正在使用 LatexMK 进行渲染,但当 s 的数量达到 50 左右时,它就无法正常工作tabular
。我该如何让它工作?据我所知,它没有抛出任何错误。不过,这可能是因为我摆弄了文件。Overleaf 似乎处理得很好。
答案1
我想你需要做这样的事情:
\documentclass{article}
\newdimen\mulw \mulw=3em
\def\mul #1x#2=#3#4 {\vbox{\hbox to\mulw{\hfil$#1$ }\hbox to\mulw{$\times\hfil#2$ }%
\smallskip\hrule\smallskip \hbox to\mulw{\hfil$#3#4$ }}\hskip1em plus.3em\relax}
\begin{document}
\noindent
\mul 3 x 4 = 12
\mul 1 x 7 = 7
\mul 1 x 6 = 6
\mul 5 x 5 = 25
\mul 1 x 1 = 1
\end{document}
答案2
与@wipet 的答案(+1)类似,但使用更基本\makecell
:
\documentclass{article}
\usepackage{makecell}
\begin{document}
\[\setlength\arraycolsep{12pt}
\begin{array}{*{10}{c}}
\makecell[tr]{ 3 \\ \times 4 \\ \hline = 12 }&
\makecell[tr]{ 1 \\ \times 7 \\ \hline = 7 }&
\makecell[tr]{ 1 \\ \times 6 \\ \hline = 6 }&
\makecell[tr]{ 5 \\ \times 5 \\ \hline = 25 }&
\makecell[tr]{ 1 \\ \times 1 \\ \hline = 1 }&
%
\makecell[tr]{ 3 \\ \times 4 \\ \hline = 12 }&
\makecell[tr]{ 1 \\ \times 7 \\ \hline = 7 }&
\makecell[tr]{ 1 \\ \times 6 \\ \hline = 6 }&
\makecell[tr]{ 5 \\ \times 5 \\ \hline = 25 }&
\makecell[tr]{ 1 \\ \times 1 \\ \hline = 1 }
\end{array}
\]
\end{document}