3

In a PGN file, there are tags like:

[Event "Tournament"]
[White "John Smith"]

And so on. I would like to know all the possible tags for PGN files so I can use them in a PGN file that my friend is demanding for.

8

PGN standards are described here. There are seven more-or-less required tags:

[Event]
[Site]
[Date]
[Round]
[White]
[Black]
[Result]

and many different supplemental tags, for example [WhiteElo] and [BlackElo] for the players' ratings, [Board] for the board number in team events, and [TimeControl] for information about the time-control used.

  • The set of seven tags you mention is required for a PGN export to be standards-compliant, but the standard allows for an import to be much less rigorous. The standard states that this is done to accommodate the laxity of manually-prepared PGN, and to tolerate that laxity. – jaxter Oct 8 '16 at 20:11
3

Glorfindel cited the PGN standard, so if you feel you need to include fields that you're not familiar with, by all means consult it.

But like many standards, it's far too comprehensive to be implemented fully in most situations. For example, the standard provides for the [Date] of the game, and the [EventDate] of the tournament; both White's and Black's clock time at the end of the game; the 3-letter acronym for the player's country, the name of the player's team (in an Olympiad or World Team Championship, these will match, but otherwise the team is normally unrelated); the name of the source publication for the game, the [SourceDate] for the date of the publication that the game appeared in; the Site and the EventSite; ... you get the idea.

Way over the top for all but the professionals, primarily those involved in publishing tournament bulletins and chess e-/magazines.

I'd also encourage you to make sure your PGN fields include:

[Event] [Date] [White] [Black] [Result]

Of the seven mentioned, the following are optional, even in published games: [Site] [Round]

The Site can be multiple things: the city name, such "Baku", the server organization name (if online) such as "playchess.com", the correspondence chess association (if CC) such as "ICCF", or the tournament name, such as "Dos Hermanas".

The Round is used when there are multiple games in one event, as in most tournaments, but can also be a combination of Board # and Round # in team tournaments. So, in the Baku Olympiad, for example, "Round 1.1" signifies a game played on Board 1 in Round 1. In most older tournament scores, the Round information is often missing, although it could be reconstructed from the tournament crosstable.

Note that [Event] must be the first field for most PGN import processing.

If the game score doesn't begin from the start position, you can insert a FEN field to represent the position, who's on move, what castling rights remain, and any e.p. capture that is possible at the beginning position. Just look up Forsyth-Edwards Notation for more information.

Use spaces to separate the moves and move numbers as follows:

  1. [white move] [black move] 10. etc.

You may run into trouble with variations, if you transcribe them manually. Keep the following rules in mind.

A. The variation immediately follows the move that it varies from, so:

  1. e5 dxe5 (4... d5)

shows the alternative move 4...d5 in the proper position in the score, immediately following the main (or parent-variation) move.

B. Certain codes are used by some PGN translators to represent the position evaluations at the end of a variation. They don't always import and export them the same way, and they don't always accept the "+/-" Informator symbology.

C. The game score should end with the result. e.g. "1-0", or "*" if it is only a line.

D. The FEN diagram / game replayer used on Chess.StackExchange is non-conforming, so don't use your experience with it as a guide. Two examples:

  • It doesn't require the [Event] field at all
  • It requires all PGN information lines to have a 4-space prefix. The latter helps distinguish the games from the language of the rest of the post on C.SE; such text outside of a game is not an option in the PGN standard.
1

PGN specification makes differences between import and output formats. For example, the seven tags event, site, date, round, white, black, result are mandatory for output in a specific order, but when importing you shouldn't be that strict - missing tags are ok, other order is ok, etc.

Then, there are a number of frequently used additional tags, like tags for rating, opening, title, etc. Open some of your favourite PGN files in an editor and have a look.

Then, when importing, I'd more or less accept anything that looks like a "key-value-pair" tag, and ignore (but maybe store) it if it's unknown.

I don't think most chess software give perfect PGN output, but most of them will also accept rather "exotic" interpretations. What does this mean for your use-case? Ask yourself what games you want to transfer, what info is in there, and then you'll probably find good tags for that. Maybe consider how your friend is going to process the PGN files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.