\section{The class family}\label{sec:family} Throughout the paper $k \ge 1$ and $m \ge 2$ are integers and $n = km$. Rows, columns and symbols are indexed by $0, 1, \dots, n-1$. It is convenient to write an index as a pair $(h, x)$ with $h \in \Z_k$ and $x \in \Z_m$; the pair stands for the number $h m + x$, where $h$ and $x$ are read as integers in $\{0, \dots, k-1\}$ and $\{0, \dots, m-1\}$. I call $h$ the \emph{block} and $x$ the \emph{residue} of the index. For a symbol $(j, v)$ the number $j$ is its \emph{class} and $v$ its \emph{value}. A \emph{split} is a number $s$ with $1 \le s \le m - 1$. It cuts $\Z_m$ into the \emph{lower part} $\{0, \dots, s-1\}$ and the \emph{upper part} $\{s, \dots, m-1\}$. There is a row split $s_r$ and a column split $s_c$, and the \emph{sector} of a row or column is the pair formed by its block and its part. There are thus $2k$ row sectors and $2k$ column sectors. For a row $r = (h_r, x_r)$ and a column $c = (h_c, x_c)$ let $\varepsilon(r, c)$ be $1$ if $r$ is upper and $c$ is lower, and $0$ otherwise, and let \begin{equation}\label{eq:class} \cls(r, c) = h_c - h_r - \varepsilon(r, c) \in \Z_k \end{equation} be the \emph{class} of the cell $(r, c)$. Figure~\ref{fig:sectors} shows the classes for $k = 3$. \input{sections/fig-sectors} A \emph{column map} is a map $\beta$ from the columns to $\Z_m$ that maps every column sector injectively into its own part. \begin{definition}\label{def:family} The square $K = K(k, m, s_r, s_c, \beta)$ has in row $r$ and column $c$ the symbol \[ K(r, c) = \begin{cases} (0,\, x_r + x_c) & \text{if } \cls(r, c) = 0, \\ (j,\, x_r + \beta(c)) & \text{if } \cls(r, c) = j \ne 0. \end{cases} \] \end{definition} It is useful to write $\beta_0(c) = x_c$ and $\beta_j = \beta$ for $j \ne 0$, so that $K(r, c) = (j, x_r + \beta_j(c))$ with $j = \cls(r, c)$ in all cases. For $k = 1$ the square is the Cayley table of $\Z_m$. \begin{lemma}\label{lem:latin} $K$ is a Latin square. In every row the symbols of class $0$ stand in $m$ cyclically consecutive cells and increase by one from each cell to the next, and in every column the symbols of each class $j \ne 0$ stand in $m$ cyclically consecutive cells and increase by one from each cell to the next. \end{lemma} \begin{proof} Fix a row $r$ in the block $h$ and a class $j$. By \eqref{eq:class} the columns $c$ with $\cls(r, c) = j$ are the lower columns of the block $h + j + \varepsilon$, where $\varepsilon = 1$ if $r$ is upper and $\varepsilon = 0$ otherwise, and the upper columns of the block $h + j$. These are one lower and one upper sector, so their residues run through $\Z_m$ once, and so do the values of $\beta$ on them. Hence $r$ contains every symbol of class $j$ exactly once. In the same way the rows $r$ with $\cls(r, c) = j$ for a fixed column $c$ in the block $g$ are the lower rows of the block $g - j$ and the upper rows of the block $g - j - \varepsilon'$ with $\varepsilon' = 1$ if $c$ is lower; their residues run through $\Z_m$ once, so $c$ contains every symbol of class $j$ exactly once. For the pattern, the cells of class $0$ in a lower row of the block $h$ are the $m$ columns of the block $h$, and in an upper row they are the upper columns of the block $h$ followed by the lower columns of the block $h+1$; in both cases the residue of the column and hence the symbol increases by one from each cell to the next. The same argument with rows applies to the classes $j \ne 0$ in a column. \end{proof} For $k = 2$ the symbols $0, \dots, m-1$ are the class $0$ and the symbols $m, \dots, 2m - 1$ the class $1$, so the squares with two classes have Wanless's pattern in the strong form: the low symbols in cyclic order in consecutive cells of every row, the high symbols in consecutive cells of every column. Figure~\ref{fig:square16} shows the square of order $16$ from the first rule of Table~\ref{tab:params} next to Wanless's square of order $8$. \input{sections/fig-square16} The rules of Table~\ref{tab:params} use column maps of one kind. The column part $b$ is the interval $[\ell_b, \ell_b + z_b)$ of residues with $\ell_0 = 0$, $z_0 = s_c$ for the lower part and $\ell_1 = s_c$, $z_1 = m - s_c$ for the upper part. \begin{definition}\label{def:mirror} Let $t(g, b) \in \{0, \dots, z_b - 1\}$ for $g \in \Z_k$ and $b \in \{0, 1\}$. The \emph{mirror rule} with \emph{shifts} $t$ maps the column at position $p$ of the sector $(g, b)$, that is the column $(g, \ell_b + p)$ with $0 \le p < z_b$, to $\ell_b + ((t(g, b) - p) \bmod z_b)$. \end{definition} The mirror rule maps each sector bijectively onto its part, so it is a column map. Table~\ref{tab:params} lists the parameters used for Theorem~\ref{thm:main}; the shifts are given as $t(g, 0)$ and $t(g, 1)$. \begin{table}[ht] \centering \small \begin{tabular}{lllll} \hline order $n$ & $k$, $m$ & splits $s_r$, $s_c$ & $t(g, 0)$ & $t(g, 1)$ \\ \hline $4w$, $w \ge 4$ & $2$, $2w$ & $w$, $w$ & $0, 1$ & $2, 3$ \\ $2(2u + 1)$, $u \ge 4$ & $2$, $2u + 1$ & $u$, $u$ & $0, 1$ & $3, 4$ \\ $k(2u + 1)$, $k$ odd prime, $u \ge 2$ & $k$, $2u + 1$ & $u$, $u$ & $[g = 0]$ & $2 + [g = (k-1)/2]$ \\ $p$ prime & $1$, $p$ & & & \\ \hline \end{tabular} \caption{Parameters of the class family for Theorem~\ref{thm:main}. For $k = 2$ the shifts are listed for the blocks $g = 0, 1$; $[\,\cdot\,]$ is $1$ if the condition holds and $0$ otherwise. Shifts are reduced modulo the size of their part; this matters only for the third rule with $u = 2$, where the upper shift $3$ is $0$. All odd composite orders other than $9$, and all even orders from $16$ on, are of one of the first three forms.} \label{tab:params} \end{table}