Latin squares format

The purpose of this page is to describe the format that I use for my latin squares and rectangles. Data downloadable from this website is (usually) in this format.

Files begin with a single line, which I'll call the header. It consists of, in order,

  1. an integer n
  2. an integer k
  3. an integer m (optional)
  4. a description (optional).
This indicates that the file contains k×n latin rectangles, and that there are m of them. The description, if present, says what these rectangles are -- it is designed for human rather than machine enlightenment, and all you need to know is that it shouldn't be more than 80 characters long.

Following the header the latin rectangles will be given. Each latin rectangle is printed in k rows and followed by a blank line. Each row consists of n symbols followed by a carriage return. Each symbol is a letter from the set {a,b,c,d,...} consisting of the first n letters. (This is preferable to using digits, which run out after order 10 -- it is common to want latin squares of orders between 10 and 26, but fairly rare to want larger ones. If orders between 26 and 52 are required I next use the symbols {A,B,C,...}). For partial latin rectangles/squares I use the character ` to mark an empty cell. Why? Well it is the character preceding "a" in ASCII, and it also works fairly well visually.

Following the m latin rectangles there can be any garbage you like, including nothing at all. The only rule is that you should be able to tell from the first character of the garbage that it is not another latin rectangle (so the first character shouldn't be one of the symbols allowed in a (partial) k×n latin rectangle). This is particularly important if m is not specified in the header.

So here is an example file



5 3 2 ## two 3 by 5 partial latin rectangles
`abcd
b`cda
`````

ab`c`
d`ca`
bd```

That was fun wasn't it?