Syntax
editThere are several standard chess diagram templates:
- Template:Chess diagram (square size 26x26 px)
- Template:Chess diagram small (square size 22x22 px)
- Template:Chess diagram 5x5; Template:Chess diagram 6x6 (bigger, 26px squares; can be used either for smaller sections of the board or Minichess and Los Alamos chess)
There are also templates for chess variants:
- Template:Chess diagram 8x10 (Capablanca chess with ten columns, 26x26 px)
- Template:Raumschach diagram (5x5x5 board for Three-dimensional chess, 22x22 px)
- Template:Omega Chess diagram (Omega Chess with 10x10 board + 4 corners, 22x22 px)
The syntax is basically the same for all of them.
{{Chess diagram | <alignment> (param #1) | <header> (#2) | <a8> | <b8> | ... | <h8> (#3 to ... | <a7> | <b7> | ... | <h7> ... | <a1> | <b1> | ... | <h1> ( ... #66) | <footer> (#67) }}
Parameters:
<alignment>
– defines horizontal alignment (floating) of the whole table, must betright
ortleft
(or nothing)<header>
– the text which appears above the diagram, may be empty;<a8>, <b8>, ... <h1>
– define corresponding squares of the chessboard, see below;<footer>
– the text which appears beneath the diagram, may be empty; optional – can be left out (currently not in the other templates)
A square is defined by the name of piece or empty parameter. The names of the pieces are those given in algebraic notation:
There are also some fairy chess pieces available:
- a = archbishop (knight + bishop compound)
- c = chancelor (knight + rook compound)
- f = upside-down king
- g = upside-down queen
- m = upside-down rook
- e = upside-down bishop
- s = upside-down knight
- h = upside-down pawn
- z = champion (for Omega Chess)
- w = wizard (for Omega Chess)
These letters are combined with either "l" for Light=White, or "d" for Dark=Black. So "kl" is White's king, and "nd" is Black's knight.
An empty square is written either using underscores, spaces, or nothing at all. Two spaces are recommended.
You can also use "xx" for a cross, "xo" for a black circle on an empty square or "oo" for a white one.
Numbers can also be added to squares by using "x1" for 1, "x2" for 2, ..., "x9" for 9. There is no 0.
Examples
editIn the following examples the rows and columns are numbered. Because any text between "|=" and the next "|" is ignored, numbers and letters can be added without affecting output.
Standard diagram
editThis diagram is recommended for common use as a main diagram in the articles on chess openings, endings, games, positions etc. See the corresponding code below.
a | b | c | d | e | f | g | h | ||
8 | 8 | ||||||||
7 | 7 | ||||||||
6 | 6 | ||||||||
5 | 5 | ||||||||
4 | 4 | ||||||||
3 | 3 | ||||||||
2 | 2 | ||||||||
1 | 1 | ||||||||
a | b | c | d | e | f | g | h |
{{Chess diagram | tright | |rd|nd|bd|qd|kd|bd|nd|rd |pd|pd|pd|pd| |pd|pd|pd | | | | | | | | | | | | |pd| | | | | | | |pl|pl| | | | | | | | | | |pl|pl|pl|pl| | |pl|pl |rl|nl|bl|ql|kl|bl|nl|rl | The King's Gambit }}
Diagram with both captions
edita | b | c | d | e | f | g | h | ||
8 | 8 | ||||||||
7 | 7 | ||||||||
6 | 6 | ||||||||
5 | 5 | ||||||||
4 | 4 | ||||||||
3 | 3 | ||||||||
2 | 2 | ||||||||
1 | 1 | ||||||||
a | b | c | d | e | f | g | h |
It may be convenient to use this in the articles on chess problems. Please note that in the header and footer you can use bolds or italics. You can also use <br>
to break the lines.
{{Chess diagram | tright | '''W. Langstaff''', ''Chess Amateur'' 1922 | | | | |kd| | |rd | | | | | | | | | | | | | |bl| |pl | | | |rl| |kl|pd|pl | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '''Mate in two.''' <br> This problem uses ''partial retrograde analysis'' method. }}
Diagram without captions
edita | b | c | d | e | f | g | h | ||
8 | 8 | ||||||||
7 | 7 | ||||||||
6 | 6 | ||||||||
5 | 5 | ||||||||
4 | 4 | ||||||||
3 | 3 | ||||||||
2 | 2 | ||||||||
1 | 1 | ||||||||
a | b | c | d | e | f | g | h |
See the corresponding code below. If you don't want the captions, just remove them, but don't delete the second "|" pipe character for the caption above; it is possible to delete the last pipe for the longer caption below.
The diagram floats to the left to illustrate the use of the first parameter.
{{Chess diagram | tleft | | | | | | | | | | | | | | | | | | |xx|xo|xx| | | | | | |pl| | | | | | | | | | |xo| | | | | | |xx|xo|xx| | | | | | |pl| | | | | | | | | | }}
Small diagram
editThis one may be useful in articles with many diagrams. It uses another template named {{Chess diagram small}}.
The small diagrams can have header, too.
a | b | c | d | e | f | g | h | ||
8 | 8 | ||||||||
7 | 7 | ||||||||
6 | 6 | ||||||||
5 | 5 | ||||||||
4 | 4 | ||||||||
3 | 3 | ||||||||
2 | 2 | ||||||||
1 | 1 | ||||||||
a | b | c | d | e | f | g | h |
{{Chess diagram small | tright | |rd| | |qd| |rd|kd| |pd|pd| | |pd|pd|bd|pd | |nd|pd| | |nd|pd| | | |ql| | | |bl| | | | |pl|pl| |bd| | | |nl| | |nl| | |pl|pl| | | |pl|pl|pl | | | |rl|kl|bl| |rl | The position after 11. Bg5. }}
Different board size
editChess boards of non-standard dimensions need special templates. There are templates for the following boards:
{{Chess diagram 5x5 | tright | |kd|qd|bd|nd|rd |pd|pd|pd|pd|pd | | | | | |pl|pl|pl|pl|pl |kl|ql|bl|nl|rl | Gardner minichess }} |
{{Chess diagram 6x6 | tright | |rd|nd|qd|kd|nd|rd |pd|pd|pd|pd|pd|pd | | | | | | | | | | | | |pl|pl|pl|pl|pl|pl |rl|nl|ql|kl|nl|rl | Los Alamos chess }} |
{{Chess diagram 8x10 | tright | |rd|nd|ad|bd|qd|kd|bd|cd|nd|rd |pd|pd|pd|pd|pd|pd|pd|pd|pd|pd | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |pl|pl|pl|pl|pl|pl|pl|pl|pl|pl |rl|nl|al|bl|ql|kl|bl|cl|nl|rl | Capablanca chess }} |
{{Chess diagram 10x10 | tright | |rd| | | | | | | | |rd | |nd|bd|qd|kd|cd|ad|bd|nd| |pd|pd|pd|pd|pd|pd|pd|pd|pd|pd | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |pl|pl|pl|pl|pl|pl|pl|pl|pl|pl | |nl|bl|ql|kl|cl|al|bl|nl| |rl| | | | | | | | |rl | Grand Chess }} |
Double boards
edit{{bughouse chess diagram | A1=Team 1, Board A | A2=Team 2, Board A | B1=Team 1, Board B | B2=Team 2, Board B | tright | |rd|nd|bd|qd|kd|bd|nd|rd |pd|pd|pd|pd|pd|pd|pd|pd | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |pl|pl|pl|pl|pl|pl|pl|pl |rl|nl|bl|ql|kl|bl|nl|rl |rl|nl|bl|kl|ql|bl|nl|rl |pl|pl|pl|pl|pl|pl|pl|pl | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |pd|pd|pd|pd|pd|pd|pd|pd |rd|nd|bd|kd|qd|bd|nd|rd | '''Bughouse setup and start position''' }} |
{{alice chess diagram | tright | |rd|nd|bd|qd|kd| |nd|rd |pd|pd|pd|pd| |pd|pd|pd | | | | | | | | | | | | |nl| | | | | | | | | | | | | | | | | | | |pl|pl|pl|pl|pl|pl|pl|pl |rl|nl|bl|ql|kl|bl| |rl | | | | | | | | | | | | | | | | | | | | |pd| | | | | |bd| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The position after '''1.Nf3 e6 2.Ne5 Bc5'''. }} |
Different shaped board
edit{{Raumschach diagram | tright | |rd|nd|kd|nd|rd |pd|pd|pd|pd|pd | | | | | | | | | | | | | | | |bd|sd|qd|bd|sd |pd|pd|pd|pd|pd | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |pl|pl|pl|pl|pl |bl|sl|ql|bl|sl | | | | | | | | | | | | | | | |pl|pl|pl|pl|pl |rl|nl|kl|nl|rl | Raumschach }} |
{{Omega Chess diagram | | [[Omega Chess|Omega Chess]] (10x10 + 4 corners) |wd |wd |zd|rd|nd|bd|qd|kd|bd|nd|rd|zd |pd|pd|pd|pd|pd|pd|pd|pd|pd|pd | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |pl|pl|pl|pl|pl|pl|pl|pl|pl|pl |zl|rl|nl|bl|ql|kl|bl|nl|rl|zl |wl |wl | '''Omega Chess''' - start position }} |
Omega Chess (10x10 + 4 corners)
|