While trying to support arbitrarily nested annotations
the first small problems arise. The LaTeX package ``skak
''
(version 1.2 or higher) knows the environments ``mainline
''
and ``variation
'' for displaying chess moves, which can't
be used because they verify the move numbers.
Luckily, a third command named ``movecomment
'' exists...
It doesn't check anything but simply translates the piece letters to
figurine symbols.
So, for every starting annotation a new ``movecomment
'' environment is opened
that gets enclosed by square brackets `[]
'.
If unbalanced parantheses occur within a single PGN game Pgn2ltx emits
a warning message and tries to recover by closing the last
annotation.
Another spot that I pondered on for quite some time is the syntax right after the
end of the last annotation. Can one rely
on the fact that the ``normal game'' definitely starts with a move number
again --- even if it is Blacks move?
The PGN standard gives no clue and the problem is that ``mainline
''
is used as default for displaying the chess moves in the ``skak
package ... and it requires a move number at its beginning!
Pgn2ltx takes care of this intricacy now and
inserts a correct move number (for White or Black) whenever a
``mainline
'' environment has to be restarted. But it does even more:
It keeps track of the move number and the side which is to move in general and
synchronizes these variables with every move number that is found in the
PGN input. Move numbers for White are inserted throughout the whole mainline
of the game whereever they are missing. It wouldn't bother Pgn2ltx
if the PGN file didn't contain any move numbers at all!