From Wikipedia, the free encyclopedia

Syntax

There are several standard chess diagram templates:

There are also templates for chess variants:

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 be tright or tleft (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:

  • k = king
  • q = queen
  • r = rook
  • b = bishop
  • n = knight
  • p = pawn

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.

  • <space> = empty square

You can also use "xx" for a cross, "xo" for a black circle on an empty square or "oo" for a white one.

  • xx = cross/x
  • xo = black circle
  • oo = white circle

Numbers can also be added to squares by using "x1" for 1, "x2" for 2, ..., "x9" for 9. There is no 0.

  • x1
  • x2
  • x3
  • x4
  • x5
  • x6
  • x7
  • x8
  • x9

Examples

In 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

This 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.

abcdefgh
8
a8 black rook
b8 black knight
c8 black bishop
d8 black queen
e8 black king
f8 black bishop
g8 black knight
h8 black rook
a7 black pawn
b7 black pawn
c7 black pawn
d7 black pawn
f7 black pawn
g7 black pawn
h7 black pawn
e5 black pawn
e4 white pawn
f4 white pawn
a2 white pawn
b2 white pawn
c2 white pawn
d2 white pawn
g2 white pawn
h2 white pawn
a1 white rook
b1 white knight
c1 white bishop
d1 white queen
e1 white king
f1 white bishop
g1 white knight
h1 white rook
8
77
66
55
44
33
22
11
abcdefgh
The King's Gambit
{{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

W. Langstaff, Chess Amateur 1922
abcdefgh
8
e8 black king
h8 black rook
f6 white bishop
h6 white pawn
d5 white rook
f5 white king
g5 black pawn
h5 white pawn
8
77
66
55
44
33
22
11
abcdefgh
Mate in two.
This problem uses partial retrograde analysis method.

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

abcdefgh
8
b6 black cross
c6 black circle
d6 black cross
c5 white pawn
f4 black circle
e3 black cross
f3 black circle
g3 black cross
f2 white pawn
8
77
66
55
44
33
22
11
abcdefgh

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

This one may be useful in articles with many diagrams. It uses another template named {{ Chess diagram small}}.

The small diagrams can have header, too.

abcdefgh
8
a8 black rook
d8 black queen
f8 black rook
g8 black king
a7 black pawn
b7 black pawn
e7 black pawn
f7 black pawn
g7 black bishop
h7 black pawn
b6 black knight
c6 black pawn
f6 black knight
g6 black pawn
c5 white queen
g5 white bishop
d4 white pawn
e4 white pawn
g4 black bishop
c3 white knight
f3 white knight
a2 white pawn
b2 white pawn
f2 white pawn
g2 white pawn
h2 white pawn
d1 white rook
e1 white king
f1 white bishop
h1 white rook
8
77
66
55
44
33
22
11
abcdefgh
The position after 11. Bg5.
{{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

Chess boards of non-standard dimensions need special templates. There are templates for the following boards:

Minichess (5×5) – Chess diagram 5x5
{{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
}}
a5 black king b5 black queen c5 black bishop d5 black knight e5 black rook
a4 black pawn b4 black pawn c4 black pawn d4 black pawn e4 black pawn
a3 b3 c3 d3 e3
a2 white pawn b2 white pawn c2 white pawn d2 white pawn e2 white pawn
a1 white king b1 white queen c1 white bishop d1 white knight e1 white rook
Gardner minichess
Los Alamos chess (6×6) – Template:Chess diagram 6x6
{{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
}}
abcdef
6 a6 black rook b6 black knight c6 black queen d6 black king e6 black knight f6 black rook6
5 a5 black pawn b5 black pawn c5 black pawn d5 black pawn e5 black pawn f5 black pawn5
4 a4 b4 c4 d4 e4 f44
3 a3 b3 c3 d3 e3 f33
2 a2 white pawn b2 white pawn c2 white pawn d2 white pawn e2 white pawn f2 white pawn2
1 a1 white rook b1 white knight c1 white queen d1 white king e1 white knight f1 white rook1
abcdef
Los Alamos chess
Capablanca chess (8×10)
{{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
}}
abcdefghij
8 a8 black rook b8 black knight c8 black princess d8 black bishop e8 black queen f8 black king g8 black bishop h8 black empress i8 black knight j8 black rook8
7 a7 black pawn b7 black pawn c7 black pawn d7 black pawn e7 black pawn f7 black pawn g7 black pawn h7 black pawn i7 black pawn j7 black pawn7
6 a6 b6 c6 d6 e6 f6 g6 h6 i6 j66
5 a5 b5 c5 d5 e5 f5 g5 h5 i5 j55
4 a4 b4 c4 d4 e4 f4 g4 h4 i4 j44
3 a3 b3 c3 d3 e3 f3 g3 h3 i3 j33
2 a2 white pawn b2 white pawn c2 white pawn d2 white pawn e2 white pawn f2 white pawn g2 white pawn h2 white pawn i2 white pawn j2 white pawn2
1 a1 white rook b1 white knight c1 white princess d1 white bishop e1 white queen f1 white king g1 white bishop h1 white empress i1 white knight j1 white rook1
abcdefghij
Capablanca chess
Grand 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
}}
abcdefghij
10 a10 black rook b10 c10 d10 e10 f10 g10 h10 i10 j10 black rook10
9 a9 b9 black knight c9 black bishop d9 black queen e9 black king f9 black empress g9 black princess h9 black bishop i9 black knight j99
8 a8 black pawn b8 black pawn c8 black pawn d8 black pawn e8 black pawn f8 black pawn g8 black pawn h8 black pawn i8 black pawn j8 black pawn8
7 a7 b7 c7 d7 e7 f7 g7 h7 i7 j77
6 a6 b6 c6 d6 e6 f6 g6 h6 i6 j66
5 a5 b5 c5 d5 e5 f5 g5 h5 i5 j55
4 a4 b4 c4 d4 e4 f4 g4 h4 i4 j44
3 a3 white pawn b3 white pawn c3 white pawn d3 white pawn e3 white pawn f3 white pawn g3 white pawn h3 white pawn i3 white pawn j3 white pawn3
2 a2 b2 white knight c2 white bishop d2 white queen e2 white king f2 white empress g2 white princess h2 white bishop i2 white knight j22
1 a1 white rook b1 c1 d1 e1 f1 g1 h1 i1 j1 white rook1
abcdefghij
Grand Chess

Double boards

Bughouse chess (four players)
{{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'''
}}


Team 2, Board A

a8 b8 c8 d8 e8 f8 g8 h8
a7 b7 c7 d7 e7 f7 g7 h7
a6 b6 c6 d6 e6 f6 g6 h6
a5 b5 c5 d5 e5 f5 g5 h5
a4 b4 c4 d4 e4 f4 g4 h4
a3 b3 c3 d3 e3 f3 g3 h3
a2 b2 c2 d2 e2 f2 g2 h2
a1 b1 c1 d1 e1 f1 g1 h1

Team 1, Board A

Team 2, Board B

a8 b8 c8 d8 e8 f8 g8 h8
a7 b7 c7 d7 e7 f7 g7 h7
a6 b6 c6 d6 e6 f6 g6 h6
a5 b5 c5 d5 e5 f5 g5 h5
a4 b4 c4 d4 e4 f4 g4 h4
a3 b3 c3 d3 e3 f3 g3 h3
a2 b2 c2 d2 e2 f2 g2 h2
a1 b1 c1 d1 e1 f1 g1 h1

Team 1, Board B

Bughouse setup and start position
Alice chess (two players)
{{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'''.
}}


a8 b8 c8 d8 e8 f8 g8 h8
a7 b7 c7 d7 e7 f7 g7 h7
a6 b6 c6 d6 e6 f6 g6 h6
a5 b5 c5 d5 e5 f5 g5 h5
a4 b4 c4 d4 e4 f4 g4 h4
a3 b3 c3 d3 e3 f3 g3 h3
a2 b2 c2 d2 e2 f2 g2 h2
a1 b1 c1 d1 e1 f1 g1 h1
A
a8 b8 c8 d8 e8 f8 g8 h8
a7 b7 c7 d7 e7 f7 g7 h7
a6 b6 c6 d6 e6 f6 g6 h6
a5 b5 c5 d5 e5 f5 g5 h5
a4 b4 c4 d4 e4 f4 g4 h4
a3 b3 c3 d3 e3 f3 g3 h3
a2 b2 c2 d2 e2 f2 g2 h2
a1 b1 c1 d1 e1 f1 g1 h1
B
The position after 1.Nf3 e6 2.Ne5 Bc5.

Different shaped board

Three-dimensional chess (Raumschach) – Template:Raumschach diagram
{{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
}}
Ea5 black rook Eb5 black knight Ec5 black king Ed5 black knight Ee5 black rook
Ea4 black pawn Eb4 black pawn Ec4 black pawn Ed4 black pawn Ee4 black pawn
Ea3 Eb3 Ec3 Ed3 Ee3
Ea2 Eb2 Ec2 Ed2 Ee2
Ea1 Eb1 Ec1 Ed1 Ee1
E
Da5 black bishop Db5 black upside-down knight Dc5 black queen Dd5 black bishop De5 black upside-down knight
Da4 black pawn Db4 black pawn Dc4 black pawn Dd4 black pawn De4 black pawn
Da3 Db3 Dc3 Dd3 De3
Da2 Db2 Dc2 Dd2 De2
Da1 Db1 Dc1 Dd1 De1
D
Ca5 Cb5 Cc5 Cd5 Ce5
Ca4 Cb4 Cc4 Cd4 Ce4
Ca3 Cb3 Cc3 Cd3 Ce3
Ca2 Cb2 Cc2 Cd2 Ce2
Ca1 Cb1 Cc1 Cd1 Ce1
C
Ba5 Bb5 Bc5 Bd5 Be5
Ba4 Bb4 Bc4 Bd4 Be4
Ba3 Bb3 Bc3 Bd3 Be3
Ba2 white pawn Bb2 white pawn Bc2 white pawn Bd2 white pawn Be2 white pawn
Ba1 white bishop Bb1 white upside-down knight Bc1 white queen Bd1 white bishop Be1 white upside-down knight
B
Aa5 Ab5 Ac5 Ad5 Ae5
Aa4 Ab4 Ac4 Ad4 Ae4
Aa3 Ab3 Ac3 Ad3 Ae3
Aa2 white pawn Ab2 white pawn Ac2 white pawn Ad2 white pawn Ae2 white pawn
Aa1 white rook Ab1 white knight Ac1 white king Ad1 white knight Ae1 white rook
A
Raumschach
Omega ChessTemplate:Omega Chess diagram
{{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)
w4 wd <W4
   A

 B

 C

 D

 E

 F

 G

 H

 I
W3>
   J
w3 wd
9 a9 zd b9 rd c9 nd d9 bd e9 qd f9 kd g9 bd h9 nd i9 rd j9 zd 9
8 a8 pd b8 pd c8 pd d8 pd e8 pd f8 pd g8 pd h8 pd i8 pd j8 pd 8
7 a7 b7 c7 d7 e7 f7 g7 h7 i7 j7 7
6 a6 b6 c6 d6 e6 f6 g6 h6 i6 j6 6
5 a5 b5 c5 d5 e5 f5 g5 h5 i5 j5 5
4 a4 b4 c4 d4 e4 f4 g4 h4 i4 j4 4
3 a3 b3 c3 d3 e3 f3 g3 h3 i3 j3 3
2 a2 b2 c2 d2 e2 f2 g2 h2 i2 j2 2
1 a1 pl b1 pl c1 pl d1 pl e1 pl f1 pl g1 pl h1 pl i1 pl j1 pl 1
0 a0 zl b0 rl c0 nl d0 bl e0 ql f0 kl g0 bl h0 nl i0 rl j0 zl 0
w1 wl    A
<W1
 B
 C
 D
 E
 F
 G
 H
 I
   J
W2>
w2 wl
Omega Chess - start position