Standard chess diagram

Standard chess diagram template is a result of discussions and votings which took place in WikiProject Chess on Meta-Wiki. It is based on the template "Chess position" widely used in English Wikipedia. Both the template and the images of pieces were modified.


Syntax edit

{{Chess diagram | alignment
| header
| 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
| footer
}}

There are two standard chess diagram templates:

  • Chess diagram (8 × 8 board, alternating light and dark squares in a checkered pattern, 26 × 26 px for each square)
  • Chess diagram small (8 × 8 board, alternating light and dark squares in a checkered pattern, 22 × 22 px for each square)

and some templates for special purposes:

The syntax is similar for all of them.

Parameters:
  • | 1 = alignment – defines horizontal alignment of the whole image (required, must be "tright" or "tleft");
  • | 2 = header – the text which appears above the diagram (required, may be empty);
  • | 3, ... = a8, ..., h8, ..., a1, ..., h1 – define the content of the chessboard with as many parameters as cells, ordered from top to bottom, and each row from left to right (required, see below for their encoded value);
    background cell colors don't need to be specified in encoded values, as they are implied by the diagram template;
  • | n = footer – the text which appears beneath the diagram (optional, may be empty).

All needed parameters are positional (they are implicitly named as integer numbers). All parameters named with something else are ignored.

Encoded values for square contents:

A square is defined by the name of piece or empty parameter:

  • The names of the pieces are those given in algebraic notation. Also, several fairy chess pieces are present.
    • 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. Using "L" or "D" (instead of "l" or "d") will show the same light or dark piece, but on a square marked by a surrounding box (however this still does not work for fairy chess pieces): such mark may be used to render the effective state of a piece in fairy chess rules (e.g. petrified/immobilized pieces, which would be marked in real game by either placing the physical piece over some base token, or by placing a ring around, or exchanging the piece with another one with distinctive forms, colors or materials).
  • An empty square is written either using underscores, spaces, or nothing at all. Two spaces are recommended.
    • You can also use "xx" (or "xo") for an empty square marked with a black (or white) cross, "xo" (or "oo") for an empty square marked with a black (or white) disc, and "x0" through "x9" for an empty space marked with a number.
    • Alternative marks include vertical, horizontal or diagonal arrows (pointing in each direction or both).
  • The next letter "l" or "d" allows differenting squares with light or dark background, over which pieces are placed, in order to create a a bicolor chessboard). However chess diagram templates will normally encode that letter themselves as these colors are usually immutable in standard boards.
Pieces:
Type "d" "l" "D" "L"
"k" king                
"q" queen
lady / conselor / ferz / vizier / minister / flag
               
"r" rook
Note: "ra" is used for the right-pointing" arrow below, so "a" cannot be used to select color/marking of pieces.
               
"b" bishop                
"n" knight                
"p" pawn                
"f" rotated king        
"g" rotated queen        
"m" rotated rook
biok (Semi-queen chess): bishop + rook
       
"B" rotated bishop
roshop (Semi-queen chess): rook + bishop
       
"s" rotated knight
boat
       
"h" rotated pawn        
"c" chancellor (Capablanca chess) /
cardinal (Grand Chess): rook + knight
       
"a" archbishop (Capablanca chess) /
marshall (Grand Chess): bishop + knight
       
"U" unicorn (Raumschach chess)        
"Z" zebra        
"G" giraffe        
"e" elephant / alfil        
"t" fool (Omega Chess)        
"w" wizard (Omega Chess) /
crescent moon
       
"z" champion (Omega Chess) /
armor shield
       
Empty cells, and symbolic or numeric marks:
"__" empty    
"xx" mark: black cross    
"ox" mark: white cross    
"xo" mark: black disc    
"oo" mark: white disc    
"x0" mark: 0    
"x1" mark: 1    
"x2" mark: 2    
"x3" mark: 3    
"x4" mark: 4    
"x5" mark: 5    
"x6" mark: 6    
"x7" mark: 7    
"x8" mark: 8    
"x9" mark: 9    
Addition arrows for marking empty cells:
"ul" up-left    
"la" left    
"dl" down-left    
"ua" up    
"ud" up and
down
   
"da" down    
"ur" up-right    
"ra" right    
"dr" down-right    
"db" up-right and
down-left
   
"lr" left and
right
   
"dw" up-left and
down-right
   

Examples edit

To see how it works, compare the diagrams below and the code which generates them. To use it - just copy the code, paste it into your article and change parameters.

In the following examples the rows and columns are numbered. Because any text between dummy named parameters "|=" and the next "|" is ignored, numbers and letters can be added without affecting output.


Some practical hints:

  • be careful not to change general schema, especially leave "|" and "=" characters just where they are,
  • you cannot use "|" character in the captions (footers and headers),
  • if you want to use "=" in the caption you have to enclose it in nowiki tags,
  • you can use some formatting like bolds, italics.



Standard diagram edit

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.

  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  
The position of the pieces at the start of a game of chess.
{{Chess diagram|tright|'''[[Template:Chess diagram|Standard chess diagram]]'''
|-= a  b  c  d  e  f  g  h
 8 |rd|nd|bd|qd|kd|bd|nd|rd|-8=
 7 |pd|pd|pd|pd|pd|pd|pd|pd|-7=
 6 |  |  |  |  |  |  |  |  |-6=
 5 |  |  |  |  |  |  |  |  |-5=
 4 |  |  |  |  |  |  |  |  |-4=
 3 |  |  |  |  |  |  |  |  |-3=
 2 |pl|pl|pl|pl|pl|pl|pl|pl|-2=
 1 |rl|nl|bl|ql|kl|bl|nl|rl|-1=
    a  b  c  d  e  f  g  h
|The position of the pieces at the start of a game of chess.
}}
  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  
The Queen's Gambit declined.
{{Chess diagram|tright|
|-= a  b  c  d  e  f  g  h
 8 |rd|nd|bd|qd|kd|bd|nd|rd|-8=
 7 |pd|pd|pd|  |  |pd|pd|pd|-7=
 6 |  |  |  |  |pd|  |  |  |-6=
 5 |  |  |  |pd|  |  |  |  |-5=
 4 |  |  |pl|pl|  |  |  |  |-4=
 3 |  |  |  |  |  |  |  |  |-3=
 2 |pl|pl|  |  |  |  |pl|pl|-2=
 1 |rl|nl|bl|ql|kl|bl|nl|rl|-1=
    a  b  c  d  e  f  g  h
|The Queen's Gambit declined.
}}
  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|
|-= a  b  c  d  e  f  g  h
 8 |  |  |  |  |bl|  |  |  |-8=
 7 |  |nl|  |  |  |pd|  |  |-7=
 6 |  |  |  |  |kd|  |  |  |-6=
 5 |  |  |  |  |  |  |ql|  |-5=
 4 |  |  |  |  |  |  |  |  |-4=
 3 |  |  |  |  |  |kl|  |  |-3=
 2 |  |  |  |  |  |  |  |  |-2=
 1 |  |  |  |  |  |  |  |  |-1=
    a  b  c  d  e  f  g  h
}}

More examples:

Diagram without captions edit

See the corresponding code below. If you don't want the captions, just remove them, but don't delete any "|" character before the diagram data (except for the last empty parameter for the second caption below the diagram).

The diagram floats to the left to illustrate the use of the first parameter.

  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|tleft|
|-= a  b  c  d  e  f  g  h
 8 |  |  |  |  |  |  |  |  |-8=
 7 |  |  |  |  |  |  |  |  |-7=
 6 |  |xx|xo|xx|  |  |  |  |-6=
 5 |  |  |pl|  |  |  |  |  |-5=
 4 |  |  |  |  |  |xo|  |  |-4=
 3 |  |  |  |  |xx|xo|xx|  |-3=
 2 |  |  |  |  |  |pl|  |  |-2=
 1 |  |  |  |  |  |  |  |  |-1=
    a  b  c  d  e  f  g  h
}}

Small diagram edit

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

  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  
The position after 11. Bg5.
{{Chess diagram small|tright|'''[[Template:Chess diagram small|Standard chess diagram (small)]]'''
|-= a  b  c  d  e  f  g  h
 8 |rd|  |  |qd|  |rd|kd|  |-8=
 7 |pd|pd|  |  |pd|pd|bd|pd|-7=
 6 |  |nd|pd|  |  |nd|pd|  |-6=
 5 |  |  |ql|  |  |  |bl|  |-5=
 4 |  |  |  |pl|pl|  |bd|  |-4=
 3 |  |  |nl|  |  |nl|  |  |-3=
 2 |pl|pl|  |  |  |pl|pl|pl|-2=
 1 |  |  |  |rl|kl|bl|  |rl|-1=
    a  b  c  d  e  f  g  h
|The position after 11. Bg5.
}}
  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|
|-= a  b  c  d  e  f  g  h
 8 |rd|  |  |qd|  |rd|kd|  |-8=
 7 |pd|pd|  |  |pd|pd|bd|pd|-7=
 6 |  |nd|pd|  |  |nd|pd|  |-6=
 5 |  |  |ql|  |  |  |bl|  |-5=
 4 |  |  |  |pl|pl|  |bd|  |-4=
 3 |  |  |nl|  |  |nl|  |  |-3=
 2 |pl|pl|  |  |  |pl|pl|pl|-2=
 1 |  |  |  |rl|kl|bl|  |rl|-1=
    a  b  c  d  e  f  g  h
}}

Capablanca chess edit

Chessboards of non-standard dimensions need special templates.

  a b c d e f g h i j  
8                     8
7                     7
6                     6
5                     5
4                     4
3                     3
2                     2
1                     1
  a b c d e f g h i j  
Capablanca chess – start position.
{{Chess diagram 8x10|tright|'''[[Template:Chess diagram 8x10|Non-standard (8 × 10) chess diagram]]'''
|-= a  b  c  d  e  f  g  h  i  j
 8 |rd|nd|ad|bd|qd|kd|bd|cd|nd|rd|-8=
 7 |pd|pd|pd|pd|pd|pd|pd|pd|pd|pd|-7=
 6 |  |  |  |  |  |  |  |  |  |  |-6=
 5 |  |  |  |  |  |  |  |  |  |  |-5=
 4 |  |  |  |  |  |  |  |  |  |  |-4=
 3 |  |  |  |  |  |  |  |  |  |  |-3=
 2 |pl|pl|pl|pl|pl|pl|pl|pl|pl|pl|-2=
 1 |rl|nl|al|bl|ql|kl|bl|cl|nl|rl|-1=
    a  b  c  d  e  f  g  h  i  j
|'''[[w:en:Capablanca chess|Capablanca chess]]''' – start position.
}}

Chaturanga edit

Chaturanga template may be used in any games played on 8x8 board.

  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  
Makruk – start position.
{{Chaturanga diagram|tright|'''[[Template:Chaturanga diagram|Chaturanga diagram]]'''
|-= a  b  c  d  e  f  g  h
 8 |rd|nd|bd|qd|kd|bd|nd|rd|-8=
 7 |  |  |  |  |  |  |  |  |-7=
 6 |pd|pd|pd|pd|pd|pd|pd|pd|-6=
 5 |  |  |  |  |  |  |  |  |-5=
 4 |  |  |  |  |  |  |  |  |-4=
 3 |pl|pl|pl|pl|pl|pl|pl|pl|-3=
 2 |  |  |  |  |  |  |  |  |-2=
 1 |rl|nl|bl|ql|kl|bl|nl|rl|-1=
    a  b  c  d  e  f  g  h
|'''Makruk''' – start position.
}}

More examples:

Chess Mutation edit

  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 Mutation – start position.
{{Chess Mutation diagram|tright|'''[[Template:Chess Mutation diagram|Chess Mutation diagram]]'''
|-= a  b  c  d  e  f  g  h
 8 |pd|pd|pd|pd|kd|pd|pd|pd|-8=
 7 |pd|pd|pd|pd|pd|pd|pd|pd|-7=
 6 |  |  |  |  |  |  |  |  |-6=
 5 |  |  |  |  |  |  |  |  |-5=
 4 |  |  |  |  |  |  |  |  |-4=
 3 |  |  |  |  |  |  |  |  |-3=
 2 |pl|pl|pl|pl|pl|pl|pl|pl|-2=
 1 |pl|pl|pl|pl|kl|pl|pl|pl|-1=
    a  b  c  d  e  f  g  h
|'''Chess Mutation''' – start position.
}}

Omega Chess edit

Omega Chess template on a 10x10 board with 4 extra corners.

  ‹ w4
a
b c d e f g h i w3 ›
j
 
9                     9
8                     8
7                     7
6                     6
5                     5
4                     4
3                     3
2                     2
1                     1
0                     0
  a
‹ w1
b c d e f g h i j
w2 ›
 
Omega Chess – start position.
{{Omega Chess diagram|tright|'''[[Template:Omega Chess diagram|Omega Chess diagram]]'''
|-=  a  b  c  d  e  f  g  h  i  j
 |wd|-W4=                         |wd|-W3=
  9 |zd|rd|nd|bd|qd|kd|bd|nd|rd|zd|-9=
  8 |pd|pd|pd|pd|pd|pd|pd|pd|pd|pd|-8=
  7 |  |  |  |  |  |  |  |  |  |  |-7=
  6 |  |  |  |  |  |  |  |  |  |  |-6=
  5 |  |  |  |  |  |  |  |  |  |  |-5=
  4 |  |  |  |  |  |  |  |  |  |  |-4=
  3 |  |  |  |  |  |  |  |  |  |  |-3=
  2 |  |  |  |  |  |  |  |  |  |  |-2=
  1 |pl|pl|pl|pl|pl|pl|pl|pl|pl|pl|-1=
  0 |zl|rl|nl|bl|ql|kl|bl|nl|rl|zl|-0=
 |wl|-W1=                         |wl|-W2=
     a  b  c  d  e  f  g  h  i  j
|'''[[w:en:Omega Chess#Omega Chess Advanced|Omega Chess]]''' – start position.
}}

Raumschach edit

Raumschach template on a 5x5x5 board.

{{Raumschach diagram|tright|'''[[Template:Raumschach diagram|Raumschach diagram]]'''|=

5 |rd|nd|kd|nd|rd|-E5=
4 |pd|pd|pd|pd|pd|-E4=
3 |  |  |  |  |  |-E3=
2 |  |  |  |  |  |-E2=
1 |  |  |  |  |  |-E1=
   Ea Eb Ec Ed Ee

5 |sd|bd|qd|sd|bd|-D5=
4 |pd|pd|pd|pd|pd|-D4=
3 |  |  |  |  |  |-D3=
2 |  |  |  |  |  |-D2=
1 |  |  |  |  |  |-D1=
   Da Db Dc Dd De

5 |  |  |  |  |  |-C5=
4 |  |  |  |  |  |-C4=
3 |  |  |  |  |  |-C3=
2 |  |  |  |  |  |-C2=
1 |  |  |  |  |  |-C1=
   Ca Cb Cc Cd Ce

5 |  |  |  |  |  |-B5=
4 |  |  |  |  |  |-B4=
3 |  |  |  |  |  |-B3=
2 |pl|pl|pl|pl|pl|-B2=
1 |bl|sl|ql|bl|sl|-B1=
   Ba Bb Bc Bd Be

5 |  |  |  |  |  |-A5=
4 |  |  |  |  |  |-A4=
3 |  |  |  |  |  |-A3=
2 |pl|pl|pl|pl|pl|-A2=
1 |rl|nl|kl|nl|rl|-A1=
   Aa Ab Ac Ad Ae

|'''Raumschach''' – start position.
}}

Tools edit