Next Previous Contents

3. Input syntax

3.1 General

The PGN standard specification differentiates between an ``Import'' and an ``Export'' format. The ``Export'' specification is much stricter, giving a lot of restrictions like: "Every PGN tag has to stand on a single line." a.s.o. and should be used for all programs that output PGN data.

In general, you won't have to care about this. If your PGN files stem from another program and are not handwritten Pgn2ltx should cope with them easily. It is supposed to support the full, rather lax, ``Import'' format with one little exception.

Just for the case that you experience some problems, a short overview of the Pgn2ltx input syntax follows...

The input from ``stdin'' is read line by line and may contain an arbitrary number of chess games in PGN notation. Every single game should consist of a ``tags'' section followed by a ``movetext'' section:

pgndata -> pgngame_list

pgngame_list -> pgngame NL pgngame_list
              | pgngame

pgngame -> tags NL movetext

As specified in the last two ``syntax rules'' the ``tags'' sections have to be separated from the ``movetext'' sections by a ``newline'' (NL).

The ``tags'' section may include empty lines and ``taglines''. A ``tagline'' is recognized if it contains an opening square bracket `[' and a closing one `]'. Several tags can make up a ``tagline'' but - and this is the only exception from the PGN ``Import'' format specification - a tag may not span over more than one line.

The first nonempty line that doesn't contain a PGN tag is recognized as the beginning of the ``movetext'' section and starts a new game in the output.

While scanning the input, Pgn2ltx covers the whole range of PGN comments including ``;'', the ``%'' in the first column and ``{}'' environments.

Please, also refer to the PGN standard specification for more details about the allowed PGN input syntax of the single ``tags'' and the ``movetext'' section.

3.2 Supported PGN tags

Every time a PGN tag is encountered, Pgn2ltx checks if it is supported. If yes, a LaTeX command is written to the output, defining a macro that contains the text of the tag.

Here is a list of the recognized PGN tags with the equivalent LaTeX macro name in parantheses:

If a "FEN" tag is found, the chess board is set to the given position and displayed by the ``showboard'' command, immediately (the value of the "SetUp" tag is disregarded in this case).

Next Previous Contents