A LaTeX style file for typesetting logic puzzles

User Tools

Site Tools



With the lpsmag bash script you can half automatically produce a Sudoku magazine using the LaTeX style file lpsudoku.sty and the createlpsudoku bash script.

The script needs an installed QQwing1) and a config file for defining the magazine's contents:

page p1 easy
page p2 easy
typesetpage p1
typesetpage p2
typesetsolpage p1 p2 last

See Half automatic production with the lpsmag bash script for an explanation.

This config file will be sourced into the lpsmag bash script and contains calls of lpsmag functions. Make sure, that the config file has UNIX line endings (LF)2).

lpsmag functions


page name difficulty

This function defines a page name with 6 puzzles and difficulty difficulty3) At the same time, it also creates the solutions for the puzzles.



This function resets the puzzle counter to 1 and does some setup for puzzles.


typesetpage name

This function typesets the predefined puzzle page name.



This function resets the puzzle counter to 1 and does some setup for solutions.


typesetsolpage name1 name2

This function typesets a solution page for the predefined pages name1 and name2. Please note that solution pages contain 12 puzzles. Therefore we should add 2 pages. You can add a third argument last4) to indicate that this is the last page of the magazine, to avoid an unwanted \clearpage in the LaTeX source.

Add some 'design'

To add some 'design' you can change the preamble.tmp HERE document in the script. You can define some fancy headers, colors, …

Create a PDF

After running lpsmag you will find a lpsmag.tex in your working directory. Just run pdflatex lpsmag.tex twice and you finally get lpsmag.pdf.

Have much fun solving the Sudokus! ;-)

QQwing is a Sudoku puzzle generator and solver
Using Windows, you can use an editor like Notepad++ or run your config file through dos2unix
Possible values: simple, easy, intermediate or expert; see: qqwing command line options
this is true for typesetpage as well, if you don't want to typeset solutions
lpsmag.txt · Last modified: 2015/09/06 09:51 (external edit)