# logicpuzzle

A LaTeX style file for typesetting logic puzzles

### Sidebar

CTAN

Bitbucket

jkLaTeX

TeXdoku

——

The TeX community aggregator

Impressum / Datenschutzerklärung

sudoku_magazine

# How to create a Sudoku magazine

## Create Sudokus

Here we use HoDoKu or qqwing for creating the Sudokus and the solutions.

### Sudokus

#### HoDoKu

To create the sudokus (command line options), we run:

hodoku /s /sl 0

This will create an Easy.txt in your working directory with the sudokus in the 81 format. You will have to close the opened window to stop the indefinite creation of sudokus! You might also want to add HoDoKu to the PATH.

#### qqwing

Alternatively, we can also use qqwing for the production of Sudoku puzzles.

qqwing --generate 6 --one-line --difficulty easy >page1.81

This will create 6 easy puzzles in file page1.81. See: qqwing command line options

### Solutions

#### HoDoKu

To create the solutions, we run:

hodoku /vs /bs Easy.txt

This will create an Easy.txt.out.txt in your working directory with the solutions of our sudokus.

#### qqwing

For qqwing we use:

cat page1.81 | qqwing --solve --one-line >page1_sol.81

## Create lpsudoku environments

We simply run

createlpsudoku -o sudoku.lps -i Easy.txt

and get the following lpsudoku environments:

\begin{lpsudoku}
\setrow{9}{{},{},{},{},2,{},9,5,{}}
\setrow{8}{{},{},6,{},{},{},{},3,4}
\setrow{7}{3,{},{},{},{},{},7,{},{}}
\setrow{6}{8,{},{},{},{},{},{},{},{}}
\setrow{5}{{},{},3,5,{},{},{},{},{}}
\setrow{4}{9,{},{},4,{},{},{},{},1}
\setrow{3}{{},9,{},{},6,7,5,2,{}}
\setrow{2}{{},{},2,{},4,{},{},{},{}}
\setrow{1}{{},5,{},{},1,9,{},{},{}}
\end{lpsudoku}

\begin{lpsudoku}
\setrow{9}{1,7,{},4,{},2,5,{},{}}
\setrow{8}{{},3,4,8,9,{},{},{},{}}
\setrow{7}{{},{},{},{},1,{},6,{},{}}
\setrow{6}{{},{},{},{},{},{},{},{},{}}
\setrow{5}{{},{},2,{},{},4,{},6,{}}
\setrow{4}{{},4,8,{},{},9,7,{},{}}
\setrow{3}{{},{},{},{},{},5,{},2,9}
\setrow{2}{{},{},{},2,{},{},8,{},{}}
\setrow{1}{{},6,{},{},{},{},{},{},1}
\end{lpsudoku}

\begin{lpsudoku}
\setrow{9}{{},{},{},5,{},{},{},{},{}}
\setrow{8}{9,{},{},{},{},{},{},2,1}
\setrow{7}{{},6,5,{},4,{},3,{},7}
\setrow{6}{5,{},4,9,1,8,{},{},{}}
\setrow{5}{{},9,8,{},{},{},{},7,{}}
\setrow{4}{{},{},{},{},{},{},{},{},{}}
\setrow{3}{6,{},{},8,{},1,{},9,{}}
\setrow{2}{{},{},{},{},{},5,{},{},{}}
\setrow{1}{{},8,{},7,{},{},{},{},{}}
\end{lpsudoku}

To get the solution environments:

createlpsudoku -o sudoku_sol.lps -i Easy.txt.out.txt

Et voilà:

\begin{lpsudoku}
\setrow{9}{4,8,7,1,2,3,9,5,6}
\setrow{8}{5,2,6,9,7,8,1,3,4}
\setrow{7}{3,1,9,6,5,4,7,8,2}
\setrow{6}{8,4,1,7,3,6,2,9,5}
\setrow{5}{2,6,3,5,9,1,8,4,7}
\setrow{4}{9,7,5,4,8,2,3,6,1}
\setrow{3}{1,9,4,3,6,7,5,2,8}
\setrow{2}{7,3,2,8,4,5,6,1,9}
\setrow{1}{6,5,8,2,1,9,4,7,3}
\end{lpsudoku}

\begin{lpsudoku}
\setrow{9}{1,7,6,4,3,2,5,9,8}
\setrow{8}{5,3,4,8,9,6,2,1,7}
\setrow{7}{8,2,9,5,1,7,6,4,3}
\setrow{6}{9,5,7,6,2,3,1,8,4}
\setrow{5}{3,1,2,7,8,4,9,6,5}
\setrow{4}{6,4,8,1,5,9,7,3,2}
\setrow{3}{7,8,1,3,6,5,4,2,9}
\setrow{2}{4,9,3,2,7,1,8,5,6}
\setrow{1}{2,6,5,9,4,8,3,7,1}
\end{lpsudoku}

\begin{lpsudoku}
\setrow{9}{8,1,3,5,7,2,4,6,9}
\setrow{8}{9,4,7,6,8,3,5,2,1}
\setrow{7}{2,6,5,1,4,9,3,8,7}
\setrow{6}{5,7,4,9,1,8,6,3,2}
\setrow{5}{3,9,8,2,6,4,1,7,5}
\setrow{4}{1,2,6,3,5,7,9,4,8}
\setrow{3}{6,5,2,8,3,1,7,9,4}
\setrow{2}{7,3,9,4,2,5,8,1,6}
\setrow{1}{4,8,1,7,9,6,2,5,3}
\end{lpsudoku}

## Create the magazine

We now have the sudokus and their solutions in lpsudoku environments. We just need to include them into a LaTeX document using the lpsudoku style file. We leave it to the user to add some 'design' as exercise!

You might get something like this: TeXdoku Issue 0

### Half automatic production with the lpsmag bash script

First of all, we need a config file for lpsmag:

simple.smc
page p1 easy
page p2 easy
startpuzzles
typesetpage p1
typesetpage p2
startsolutions
typesetsolpage p1 p2 last

Here, we first “create” the pages p1 and p2 - with 61) easy puzzles each. Then, we start with the puzzles and typeset the pages p1 and p2. Finally, we want to typeset the solutions. Note, that solution pages have 12 puzzles. So, we should add two pages. We need to indicate last to avoid an unwanted \clearpage on the last page!

After running this config file through lpsmag,

lpsmag simple.smc

we finally get: lpsmag.pdf

Whenever you run the lpsmag script, you get a new Sudoku 'magazine'

### Monthly magazine

Have fun with our open source monthly Sudoku magazine TeXdoku

1)
design default of the script