### Filter to typeset Sudoku tables with LaTeX ### ### Input should be in the format used by the Python Sudoku generator ### available at http://www.techsanctuary.com/node/48 ### ### (C) 2006 Gergo ERDI BEGIN { print "\\documentclass[12pt,a4paper]{article}" print "\\usepackage{hhline}" print "\\usepackage{tabularx}" print "\\newcommand{\\topline}{\\hhline{*{3}{|---|}}}" print "\\newcommand{\\singleline}{\\hhline{*{3}{|-|-|-|}}}" print "\\newcommand{\\doubleline}{\\hhline{*{3}{:===:}}}" print "\\begin{document}" print "\\pagestyle{empty}" print "\\ttfamily\\huge\\centering" print "\\setlength{\\doublerulesep}{2mm}" print "\\begin{tabularx}{10cm}{ *{3}{| *{3}{>{\\centering\\arraybackslash}X|} }}" print "\\topline" line = 1 } { if (line > 9) next for (i = 1; i <= 9; ++i) { if ($i == ".") $i = " " if (i != NF) printf ("%s & ", $i) else printf ("%s \\\\\n", $i) } if (line == 9) print "\\topline" else if (line % 3 == 0) print "\\doubleline" else print "\\singleline" line++ } END { print "\\end{tabularx}" print "\\end{document}" }