Hitori
The puzzle
Black out some cells according to these specifications: In each row and each column a number may only occur once or can be completely blackened. The blackened cells can touch neither horizontal nor vertical. All non blackened cells must remain connected. Each number has its own color, which otherwise has no meaning. Here’s a little self-explanatory example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
\begin{center} \begin{hitori} \framepuzzle \setcolorrow{5}{2,4,2,1,1} \setcolorrow{4}{1,3,2,4,1} \setcolorrow{3}{1,3,3,3,2} \setcolorrow{2}{4,2,1,3,3} \setcolorrow{1}{4,1,2,2,3} \end{hitori} \hspace{1.5cm} \begin{hitori} \framepuzzle \setcolorrow{5}{2,4,0,1,0} \setcolorrow{4}{0,3,2,4,1} \setcolorrow{3}{1,0,3,0,2} \setcolorrow{2}{4,2,1,3,0} \setcolorrow{1}{0,1,0,2,3} \end{hitori} \end{center} |
Options
-
rows (5)
defines the number of rows in the grid -
columns (5)
specifies the number of columns in the grid -
width (5.1cm)
sets the width of the minipage, in which the grid is typeset -
scale (1)
scales the size of the grid in the minipage -
fontsize (Large)
specifies the size of the numbers next to the grid. Here, the usual LaTeX sizes are used. Possible values: tiny, scriptsize, footnotesize, small, normalsize, large, Large, LARGE, huge, Huge -
title ()
sets the title of a puzzle -
titleindent (0cm)
defines the indent of the title -
titlewidth (5.1cm)
specifies the width of the box the title is set in -
bgcolor ()
sets the background color of the grid -
counterstyle (none)
defines the counter style. Predefined styles: none, left, right -
cvoffset (-23pt)
sets the vertical offset of the counters in the margin
Environments
hitori
1 2 3 |
\begin{hitori} \end{hitori} |
The hitori
environment is the central core of the style file. With the optional argument of the environment, you can reset the options with local scope. Here, a blank grid is created.
Commands
In the grid and around
setcolorrow
setcolorrow{row}{csv list}
With the setcolorrow
command, you can set the contents of a row
. Furthermore, the background of the cell is filled with color LP@c@romannumber
. With the number 0, you can black out the grid cell.
setcolorcolumn
setcolorcolumn{column}{csv list}
With the setcolorcolumn
command, you can set the contents of a column
. Furthermore, the background of the cell is filled with color LP@c@romannumber
.
framepuzzle
framepuzzle[color]
With the framepuzzle
command, you can frame the grid (thicker line) with the color specified with the optional argument color
(default: black).
Presentation
definecounterstyle
The command allows you to define your own styles. For example, the style left
is defined as follows:
1 2 3 4 5 6 |
\definecounterstyle{left}{ \begingroup\reversemarginpar\marginnote{ \tikz\node[shape=rectangle,fill=yellow!40,inner sep=7pt, draw,rounded corners=3pt,thick] {\Huge\puzzlecounter};}[\LP@cvoffset]\endgroup} } |
To typeset the counter into the margin we use the command \marginnote
. We need to use the command \reversemarginpar
to set the counter into the left margin. Of course, we must use this command in a group for local scope. Finally we use \puzzlecounter
in a \tikz
node with a vertical offset set with the option cvoffset
.
puzzlecounter
\puzzlecounter
The command provides the counter in textual form to use it for example in \definecounterstyle
.
titleformat
\titleformat{format}
With the command \titleformat
, you can define the format of the title. By default, the definition is as follows:
\titleformat{\centering\Large\color{blue}}
Miscellaneous
hitorisetup
\hitorisetup{options}
With the command \hitorisetup
you can reset the options with global scope.
setpuzzlecounter
\setpuzzlecounter{number}
With the command \setpuzzlecounter
, you can reset the puzzle counter, for example before the solutions.
Examples & Solutions
You can download application examples and their solutions from the project page. The puzzles are originally licensed under .