Template:Chess diagram

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Solid white.svg a b c d e f g h Solid white.svg
8 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king8
7 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king7
6 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king6
5 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king5
4 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king4
3 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king3
2 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king2
1 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king1
Solid white.svg a b c d e f g h Solid white.svg
Template documentation[view] [edit] [history] [purge]

Syntax[change source]

There are several standard chess diagram templates:

(There are several other chess and chess variant diagram templates on English Wikipedia that can be imported if there is a need.)

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:

  • Chess kll44.png Chess kld44.png Chess kdl44.png Chess kdd44.png k = king
  • Chess qld44.png Chess qll44.png Chess qdd44.png Chess qdl44.png q = queen
  • Chess rll44.png Chess rld44.png Chess rdl44.png Chess rdd44.png r = rook
  • Chess bld44.png Chess bll44.png Chess bdd44.png Chess bdl44.png b = bishop
  • Chess nll44.png Chess nld44.png Chess ndl44.png Chess ndd44.png n = knight
  • Chess pld44.png Chess pll44.png Chess pdd44.png Chess pdl44.png p = pawn

There are also some fairy chess pieces available:

  • Chess all44.png Chess ald44.png Chess adl44.png Chess add44.png a = archbishop (knight + bishop compound)
  • Chess cld44.png Chess cll44.png Chess cdd44.png Chess cdl44.png c = chancellor (knight + rook compound)
  • Chess fll44.png Chess fld44.png Chess fdl44.png Chess fdd44.png f = upside-down king
  • Chess gld44.png Chess gll44.png Chess gdd44.png Chess gdl44.png g = upside-down queen
  • Chess mll44.png Chess mld44.png Chess mdl44.png Chess mdd44.png m = upside-down rook
  • Chess eld44.png Chess ell44.png Chess edd44.png Chess edl44.png e = upside-down bishop
  • Chess sll44.png Chess sld44.png Chess sdl44.png Chess sdd44.png s = upside-down knight
  • Chess hld44.png Chess hll44.png Chess hdd44.png Chess hdl44.png h = upside-down pawn
  • Chess zll44.png Chess zld44.png Chess zdl44.png Chess zdd44.png z = champion (for Omega Chess)
  • Chess wld44.png Chess wll44.png Chess wdd44.png Chess wdl44.png 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.

  • Chess d45.svgChess l45.svg <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.

  • Chess xxd45.svgChess xxl45.svg xx = cross/x
  • Chess xod45.svgChess xol45.svg xo = black circle
  • Chess ood44.pngChess ool44.png oo = white circle

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

  • Chess x0d45.svgChess x0l45.svg x0
  • Chess x1d45.svgChess x1l45.svg x1
  • Chess x2d45.svgChess x2l45.svg x2
  • Chess x3d45.svgChess x3l45.svg x3
  • Chess x4d45.svgChess x4l45.svg x4
  • Chess x5d45.svgChess x5l45.svg x5
  • Chess x6d45.svgChess x6l45.svg x6
  • Chess x7d45.svgChess x7l45.svg x7
  • Chess x8d45.svgChess x8l45.svg x8
  • Chess x9d45.svgChess x9l45.svg x9

Examples[change source]

Standard diagram[change source]

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.

Solid white.svg a b c d e f g h Solid white.svg
8 {{{square}}} black rook {{{square}}} black knight {{{square}}} black bishop {{{square}}} black queen {{{square}}} black king {{{square}}} black bishop {{{square}}} black knight {{{square}}} black rook8
7 {{{square}}} black pawn {{{square}}} black pawn {{{square}}} black pawn {{{square}}} black pawn {{{square}}} black king {{{square}}} black pawn {{{square}}} black pawn {{{square}}} black pawn7
6 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king6
5 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black pawn {{{square}}} black king {{{square}}} black king {{{square}}} black king5
4 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} white pawn {{{square}}} white pawn {{{square}}} black king {{{square}}} black king4
3 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king3
2 {{{square}}} white pawn {{{square}}} white pawn {{{square}}} white pawn {{{square}}} white pawn {{{square}}} black king {{{square}}} black king {{{square}}} white pawn {{{square}}} white pawn2
1 {{{square}}} white rook {{{square}}} white knight {{{square}}} white bishop {{{square}}} white queen {{{square}}} white king {{{square}}} white bishop {{{square}}} white knight {{{square}}} white rook1
Solid white.svg a b c d e f g h Solid white.svg
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[change source]

W. Langstaff, Chess Amateur 1922
Solid white.svg a b c d e f g h Solid white.svg
8 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black rook8
7 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king7
6 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} white bishop {{{square}}} black king {{{square}}} white pawn6
5 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} white rook {{{square}}} black king {{{square}}} white king {{{square}}} black pawn {{{square}}} white pawn5
4 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king4
3 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king3
2 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king2
1 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king1
Solid white.svg a b c d e f g h Solid white.svg
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[change source]

Solid white.svg a b c d e f g h Solid white.svg
8 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king8
7 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king7
6 {{{square}}} black king {{{square}}} cross {{{square}}} black circle {{{square}}} cross {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king6
5 {{{square}}} black king {{{square}}} black king {{{square}}} white pawn {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king5
4 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black circle {{{square}}} black king {{{square}}} black king4
3 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} cross {{{square}}} black circle {{{square}}} cross {{{square}}} black king3
2 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} white pawn {{{square}}} black king {{{square}}} black king2
1 {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king {{{square}}} black king1
Solid white.svg a b c d e f g h Solid white.svg

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[change source]

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.

Start of chess board.
a8 black rook b8 black king c8 black king d8 black queen e8 black king f8 black rook g8 black king h8 black king
a7 black pawn b7 black pawn c7 black king d7 black king e7 black pawn f7 black pawn g7 black bishop h7 black pawn
a6 black king b6 black knight c6 black pawn d6 black king e6 black king f6 black knight g6 black pawn h6 black king
a5 black king b5 black king c5 white queen d5 black king e5 black king f5 black king g5 white bishop h5 black king
a4 black king b4 black king c4 black king d4 white pawn e4 white pawn f4 black king g4 black bishop h4 black king
a3 black king b3 black king c3 white knight d3 black king e3 black king f3 white knight g3 black king h3 black king
a2 white pawn b2 white pawn c2 black king d2 black king e2 black king f2 white pawn g2 white pawn h2 white pawn
a1 black king b1 black king c1 black king d1 white rook e1 white king f1 white bishop g1 black king h1 white rook
End of chess board.
The position after 11. Bg5.
{{Chess diagram small
| tright
| 
<!--  a  b  c  d  e  f  g  h
8-->|rd|  |  |qd|  |rd|kd|  <!--
7-->|pd|pd|  |  |pd|pd|bd|pd<!--
6-->|  |nd|pd|  |  |nd|pd|  <!--
5-->|  |  |ql|  |  |  |bl|  <!--
4-->|  |  |  |pl|pl|  |bd|  <!--
3-->|  |  |nl|  |  |nl|  |  <!--
2-->|pl|pl|  |  |  |pl|pl|pl<!--
1-->|  |  |  |rl|kl|bl|  |rl|=
| The position after 11. Bg5.
}}

Double boards[change source]

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
|
|=
 8 |rd|nd|bd|qd|kd|bd|nd|rd|=
 7 |pd|pd|pd|pd|pd|pd|pd|pd|=
 6 |  |  |  |  |  |  |  |  |=
 5 |  |  |  |  |  |  |  |  |=
 4 |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |pl|pl|pl|pl|pl|pl|pl|pl|=
 1 |rl|nl|bl|ql|kl|bl|nl|rl|=
    a  b  c  d  e  f  g  h

 8 |rl|nl|bl|kl|ql|bl|nl|rl|=
 7 |pl|pl|pl|pl|pl|pl|pl|pl|=
 6 |  |  |  |  |  |  |  |  |=
 5 |  |  |  |  |  |  |  |  |=
 4 |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |pd|pd|pd|pd|pd|pd|pd|pd|=
 1 |rd|nd|bd|kd|qd|bd|nd|rd|=
    a  b  c  d  e  f  g  h

| '''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
|
|=
 8 |rd|nd|bd|qd|kd|  |nd|rd|=
 7 |pd|pd|pd|pd|  |pd|pd|pd|=
 6 |  |  |  |  |  |  |  |  |=
 5 |  |  |  |  |nl|  |  |  |=
 4 |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |pl|pl|pl|pl|pl|pl|pl|pl|=
 1 |rl|nl|bl|ql|kl|bl|  |rl|=
    a  b  c  d  e  f  g  h
          Board A

 8 |  |  |  |  |  |  |  |  |=
 7 |  |  |  |  |  |  |  |  |=
 6 |  |  |  |  |pd|  |  |  |=
 5 |  |  |bd|  |  |  |  |  |=
 4 |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |  |  |  |  |  |  |  |  |=
 1 |  |  |  |  |  |  |  |  |=
    a  b  c  d  e  f  g  h
          Board B
| 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.