Quantcast
Channel: Rectangular table with consecutive integers using foreach - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 4

Answer by Mico for Rectangular table with consecutive integers using foreach

$
0
0

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

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 all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>