Quantcast
Viewing latest article 2
Browse Latest Browse All 4

Answer by Mico for Rectangular table with consecutive integers using foreach

Here's a LuaLaTeX-based solution. It employs two for loops.

Image may be NSFW.
Clik here to view.
enter image description here

\documentclass{article}\usepackage{array}   % for \extrarowheight length parameter and 'w' column type\usepackage{luacode} % for \luaexec macro\begin{document}\setlength\extrarowheight{2pt} % make squares 14pt wide and tall\setlength\tabcolsep{4pt}\begin{tabular}{|*{9}{w{c}{6pt}|}}\hline\luaexec{  for i=1,4 do    for j=1,8 do       tex.sprint( i*j .. "&" )     end    tex.sprint( i*9 .. "\\\\ \\hline" )  end }\end{tabular}\end{document}

Viewing latest article 2
Browse Latest Browse All 4

Trending Articles