r/chess • u/mashedvote • Dec 06 '13
Inline PGN Viewer FAQ
Quick primer
- Portable Game Notation (PGN) is a plain text computer-processible format for recording chess games, and is supported by many chess programs. Wikipedia
- The PGN viewer is an addon for Firefox or Chrome that allows you to embed the PGN viewer from chesstempo in a comment. Credit to /u/betazoidberg for creating the browser addons.
- When you post the PGN of a game, wrap the game with the tags [ pgn] and [ /pgn] (without the spaces) and users with the inline PGN viewer installed will see a game board on which they can play through the moves.
- It is a good idea to indent every line with four spaces so that markdown will render it as it is. Otherwise, markdown might format it in such a way that the pgn viewer can no longer parse it.
- Consider readability for those who are not using the PGN viewer and break the move list up into reasonably short lines.
- You will probably want to annotate your game and add variations. Probably the easiest way to edit a PGN is to use an editor:
- http://www.chess.com/analysis-board-editor (online editor)
- http://scid.sourceforge.net/ (free database software)
Example
If you have the addon installed, the following text:
[ pgn]
[Site "Paris"]
[Date "1858"]
[Result "1-0"]
[White "Paul Morphy"]
[Black "A Bottin"]
[WhiteElo "2690 estimated"]
[BlackElo "?"]
1.e4 e5
2.c3 Nf6
3.d4 Nxe4
4.dxe5 Bc5
5.Qg4 Nxf2
6.Qxg7 Rf8
7.Bg5 f6
8.exf6 Rxf6
9.Bxf6 Be7
10.Qg8+
1-0[ /pgn]
Will be displayed like this:
[pgn]
[Site "Paris"]
[Date "1858"]
[Result "1-0"]
[White "Paul Morphy"]
[Black "A Bottin"]
[WhiteElo "2690 estimated"]
[BlackElo "?"]
1.e4 e5
2.c3 Nf6
3.d4 Nxe4
4.dxe5 Bc5
5.Qg4 Nxf2
6.Qxg7 Rf8
7.Bg5 f6
8.exf6 Rxf6
9.Bxf6 Be7
10.Qg8+
1-0[/pgn]
Note that here and in all other examples the PGN tags are written with spaces [ pgn] and [ /pgn] to prevent the PGN reader from reading them. Don't include the spaces in your own posts.
FAQ
- How do I include variations?
- How do I include annotations?
- How do I show multiple games in one comment?
- How do I display a single position, or show a game from a certain position?
- [How do I show the board with black at the bottom?] (http://www.reddit.com/r/chess/comments/1s8j14/inline_pgn_viewer_faq/cdva03e)
- [Why isn't the board showing up when I include positional evaluation symbols?] (http://www.reddit.com/r/chess/comments/1s8j14/inline_pgn_viewer_faq/ce32898)
- Why isn't the board showing up? (Random reasons and what to do next)
17
Upvotes
4
u/mashedvote Dec 06 '13 edited Dec 06 '13
How do I include variations?
Put variations in parentheses like this
[ pgn]
[ /pgn]
[pgn]
[/pgn]
4
u/mashedvote Dec 06 '13 edited Dec 06 '13
How do I show multiple games in one comment?
You must wrap all the games in one pair of tags. The PGN viewer will display a single board and a dropdown menu to select between games. The dropdown menu will display certain game information if it is properly tagged at the start of the PGN. The following example shows the tags that you can use. Note that they are case sensitive.
[ pgn]
[ /pgn]
[pgn]
[/pgn]
3
u/mashedvote Dec 06 '13 edited Dec 06 '13
How do I include annotations?
Put annotations in curly braces like this
[ pgn]
[ /pgn]
[pgn]
[/pgn]
3
u/mashedvote Dec 06 '13 edited Dec 06 '13
How do I display a single position, or show a game from a certain position?
Use the FEN tag. (explanation of FEN on wikipedia)
Markdown may try to format your moves as a list and automatically renumber them starting from 1. To avoid this either indent your lines by 4 spaces, OR use a backslash to escape the dot after the first number. Like this 38\.
[ pgn]
[ /pgn]
[pgn]
[/pgn]
2
u/hoijarvi Dec 06 '13
One more thing: Indent every line with four spaces. Markdown will then render is as it is. Otherwise, markdown might mess it up so the pgn viewer cannot anymore parse it.
And make the lines reasonably short for those who don't use the inline viewer.
2
u/MisterGone5 Dec 06 '13 edited Dec 06 '13
Also to note, if you want to show the game with black on the bottom, set up the board with the first white move already made with a FEN string.
Starting Board Position: [FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq"]
Board Position after 1. Nf3: [FEN "rnbqkbnr/pppppppp/8/8/8/5N2/PPPPPPPP/RNBQKB1R b KQkq"]
Example:
Board with White on the Bottom
[pgn] [Event "Third Rosenwald Trophy"] [Site "New York USA"] [Date "1956.10.17"] [EventDate "1956.10.07"] [Round "8"] [Result "0-1"] [White "Donald Byrne"] [Black "Robert James Fischer"] [ECO "D92"] [WhiteElo "?"] [BlackElo "?"] [PlyCount "82"]
1.Nf3 Nf6 2.c4 g6 3.Nc3 Bg7 4.d4 O-O 5.Bf4 d5 6.Qb3 dxc4 Qxc4 c6 7.e4 Nbd7 8.Rd1 Nb6 9.Qc5 Bg4 10.Bg5 {11. Be2 followed by 12 O-O would have been more prudent. The bishop move played allows a sudden crescendo of tactical points to be uncovered by Fischer. -- Wade} Na4 {!} 11.Qa3 {On 12. Nxa4 Nxe4 and White faces considerable difficulties.} Nxc3 {At first glance, one might think that this move only helps White create a stronger pawn center; however, Fischer's plan is quite the opposite. By eliminating the Knight on c3, it becomes possible to sacrifice the exchange via Nxe4 and smash White's center, while the King remains trapped in the center.} 12.bxc3 Nxe4 {The natural continuation of Black's plan.} 13.Bxe7 Qb6 14.Bc4 Nxc3 15.Bc5 Rfe8+ 16.Kf1 Be6 {!! If this is the game of the century, then 17...Be6!! must be the counter of the century. Fischer offers his queen in exchange for a fierce attack with his minor pieces. Declining this offer is not so easy: 18. Bxe6 leads to a 'Philidor Mate' (smothered mate) with ...Qb5+ 19. Kg1 Ne2+ 20. Kf1 Ng3+ 17.Kg1 Qf1+ 22. Rxf1 Ne2#. Other ways to decline the queen also run into trouble: e.g., 18. Qxc3 Qxc5} 18.Bxb6 Bxc4+ 19.Kg1 Ne2+ 20.Kf1 Nxd4+ {This tactical scenario, where a king is repeatedly revealed to checks, is sometimes called a "windmill."} 21.Kg1 Ne2+ 22.Kf1 Nc3+ 23.Kg1 axb6 24.Qb4 Ra4 25.Qxb6 Nxd1 26.h3 Rxa2 27.Kh2 Nxf2 28.Re1 Rxe1 29.Qd8+ Bf8 30.Nxe1 Bd5 31.Nf3 Ne4 32.Qb8 b5 {Every piece and pawn of the black camp is defended. The white queen has nothing to do.} 33.h4 h5 34.Ne5 Kg7 35.Kg1 Bc5+ 36.Kf1 Ng3+ {Now Byrne is hopelessly entangled in Fischer's mating net.} 37.Ke1 Bb4+ 38.Kd1 Bb3+ 39.Kc1 Ne2+ 40.Kb1 Nc3+ 41.Kc1 Rc2# 0-1
[/pgn]
Board with Black on the Bottom
[pgn] [Event "Third Rosenwald Trophy"] [Site "New York USA"] [Date "1956.10.17"] [EventDate "1956.10.07"] [Round "8"] [Result "0-1"] [White "Donald Byrne"] [Black "Robert James Fischer"] [ECO "D92"] [WhiteElo "?"] [BlackElo "?"] [FEN "rnbqkbnr/pppppppp/8/8/8/5N2/PPPPPPPP/RNBQKB1R b KQkq - 1 1"] [PlyCount "82"]
1.... Nf6 2.c4 g6 3.Nc3 Bg7 4.d4 O-O 5.Bf4 d5 6.Qb3 dxc4 Qxc4 c6 7.e4 Nbd7 8.Rd1 Nb6 9.Qc5 Bg4 10.Bg5 {11. Be2 followed by 12 O-O would have been more prudent. The bishop move played allows a sudden crescendo of tactical points to be uncovered by Fischer. -- Wade} Na4 {!} 11.Qa3 {On 12. Nxa4 Nxe4 and White faces considerable difficulties.} Nxc3 {At first glance, one might think that this move only helps White create a stronger pawn center; however, Fischer's plan is quite the opposite. By eliminating the Knight on c3, it becomes possible to sacrifice the exchange via Nxe4 and smash White's center, while the King remains trapped in the center.} 12.bxc3 Nxe4 {The natural continuation of Black's plan.} 13.Bxe7 Qb6 14.Bc4 Nxc3 15.Bc5 Rfe8+ 16.Kf1 Be6 {!! If this is the game of the century, then 17...Be6!! must be the counter of the century. Fischer offers his queen in exchange for a fierce attack with his minor pieces. Declining this offer is not so easy: 18. Bxe6 leads to a 'Philidor Mate' (smothered mate) with ...Qb5+ 19. Kg1 Ne2+ 20. Kf1 Ng3+ 17.Kg1 Qf1+ 22. Rxf1 Ne2#. Other ways to decline the queen also run into trouble: e.g., 18. Qxc3 Qxc5} 18.Bxb6 Bxc4+ 19.Kg1 Ne2+ 20.Kf1 Nxd4+ {This tactical scenario, where a king is repeatedly revealed to checks, is sometimes called a "windmill."} 21.Kg1 Ne2+ 22.Kf1 Nc3+ 23.Kg1 axb6 24.Qb4 Ra4 25.Qxb6 Nxd1 26.h3 Rxa2 27.Kh2 Nxf2 28.Re1 Rxe1 29.Qd8+ Bf8 30.Nxe1 Bd5 31.Nf3 Ne4 32.Qb8 b5 {Every piece and pawn of the black camp is defended. The white queen has nothing to do.} 33.h4 h5 34.Ne5 Kg7 35.Kg1 Bc5+ 36.Kf1 Ng3+ {Now Byrne is hopelessly entangled in Fischer's mating net.} 37.Ke1 Bb4+ 38.Kd1 Bb3+ 39.Kc1 Ne2+ 40.Kb1 Nc3+ 41.Kc1 Rc2# 0-1 [/pgn]
1
u/florin_pch chess.com~1400 Dec 06 '13 edited Dec 09 '13
It may be important to note that if the current url doesn't start with www., it won't work. It took me a while to figure it out. later edit: www could be replaced by something region dependent like nl, ne, etc.
3
u/Bacon_Oh_Bacon Dec 06 '13
This post should replace the old PGN viewer section in the sidebar. Much more informative.
1
u/Infenwe 2100 FIDE Mar 03 '14
Where does one post bug reports? I couldn't find a better place for it than here, so... here goes.
It seems that we have a game posted in another thread that causes the Firefox addon to sit and use 100% of one CPU core locking up the browser.
http://www.reddit.com/r/chess/comments/1zbfnj/massive_rookie_played_30min_game_and_won_analysis/ (DO NOT CLICK IF USING FIREFOX AND YOU HAVE THE ADDON INSTALLED UNLESS YOU WANT TO TEST THE BUG)
1
u/MetalMrHat Dec 06 '13
Don't suppose such a thing exists for Opera?
0
u/edderiofer Occasional problemist Dec 06 '13
Right. I'll refer to this whenever I do something that causes it to break.
0
u/[deleted] Dec 06 '13
[deleted] — view deleted comment