Template:Chess diagram/doc

These templates shows a chess diagram, a graphic representation of a position in a chess game, using standardised symbols resembling the pieces of the standard Staunton chess set. The default template for a standard chess board is Chess diagram. This documentation covers all related templates.

Templates
There are several standard chess diagram templates:

There are also templates for chess variants:
 * Template:Chess diagram (square size 26x26 px)
 * Template:Chess diagram small (square size 22x22 px)
 * Template:Chess diagram 4x4 (square size 26x26 px)
 * Template:Chess diagram 4x5 (square size 26x26 px)
 * Template:Chess diagram 5x5 (square size 26x26 px)
 * Template:Chess diagram 5x6 (square size 26x26 px)
 * Template:Chess diagram 6x6 (square size 26x26 px)
 * Template:Chess diagram 8x10 (Capablanca Chess square size 26x26 px)
 * Template:Chess diagram 8x10 small (Capablanca Chess square size 22x22 px)
 * Template:Chess diagram 9x9 (square size 26x26 px)
 * Template:Chess diagram 10x10 (square size 26x26 px)
 * Template:Chess diagram 10x10 small (square size 22x22 px)
 * For other board sizes, use {{#invoke:chessboard mxn|board|cols=|rows=
 * Template:Alice chess diagram (Alice Chess, square size 22x22 px)
 * Template:Bughouse chess diagram (Bughouse chess, square size 22x22 px)
 * Template:Omega Chess diagram (Omega Chess with 10x10 board + 4 corners, 22x22 px)
 * Template:Tamerlane chess diagram (Tamerlane chess with 10x11 board + 2 citadels, 22x22 px)
 * Template:Raumschach diagram (5x5x5 board for one type of Three-dimensional chess, 22x22 px)
 * Template:3D chess diagram (3x8x8 board for some types of Three-dimensional chess, 22x22 px)

Syntax
The syntax is basically the same for all chess diagram templates.

Parameters:


 * – defines horizontal alignment (floating) of the whole table, must be  or   (or nothing)
 * – the text which appears above the diagram, may be empty;
 * - specifies the size of each square in pixels, the default is 26.
 * - specifies whether the rows are numbered. Options are: left, right, both (default) or neither.
 * - specifies whether the columns are lettered. Options are: top, bottom, both (default) or neither.
 * – define corresponding squares of the chessboard, see below;
 * – 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:


 * [[Image:Chess kll45.svg|26px]] [[Image:Chess kld45.svg|26px]] [[Image:Chess kdl45.svg|26px]] [[Image:Chess kdd45.svg|26px]] k = king
 * [[Image:Chess qld45.svg|26px]] [[Image:Chess qll45.svg|26px]] [[Image:Chess qdd45.svg|26px]] [[Image:Chess qdl45.svg|26px]] q = queen
 * [[Image:Chess rll45.svg|26px]] [[Image:Chess rld45.svg|26px]] [[Image:Chess rdl45.svg|26px]] [[Image:Chess rdd45.svg|26px]] r = rook
 * [[Image:Chess bld45.svg|26px]] [[Image:Chess bll45.svg|26px]] [[Image:Chess bdd45.svg|26px]] [[Image:Chess bdl45.svg|26px]] b = bishop
 * [[Image:Chess nll45.svg|26px]] [[Image:Chess nld45.svg|26px]] [[Image:Chess ndl45.svg|26px]] [[Image:Chess ndd45.svg|26px]] n = knight
 * [[Image:Chess pld45.svg|26px]] [[Image:Chess pll45.svg|26px]] [[Image:Chess pdd45.svg|26px]] [[Image:Chess pdl45.svg|26px]] p = pawn

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.


 * [[Image:Chess d45.svg|26px]][[Image:Chess l45.svg|26px]] = empty square

Fairy Chess
There are also some fairy chess pieces available. In general, there is no convention for which inverted piece to use, but in general one should use something similar to how the fairy piece moves (e.g. a camel should use an inverted knight icon).
 * [[Image:Chess all45.svg|26px]] [[Image:Chess ald45.svg|26px]] [[Image:Chess adl45.svg|26px]] [[Image:Chess add45.svg|26px]] a = archbishop (princess)
 * [[Image:Chess cld45.svg|26px]] [[Image:Chess cll45.svg|26px]] [[Image:Chess cdd45.svg|26px]] [[Image:Chess cdl45.svg|26px]] c = chancellor (empress)
 * [[Image:Chess fll45.svg|26px]] [[Image:Chess fld45.svg|26px]] [[Image:Chess fdl45.svg|26px]] [[Image:Chess fdd45.svg|26px]] f = inverted king
 * [[Image:Chess gld45.svg|26px]] [[Image:Chess gll45.svg|26px]] [[Image:Chess gdd45.svg|26px]] [[Image:Chess gdl45.svg|26px]] g = inverted queen (grasshopper)
 * [[Image:Chess mll45.svg|26px]] [[Image:Chess mld45.svg|26px]] [[Image:Chess mdl45.svg|26px]] [[Image:Chess mdd45.svg|26px]] m = inverted rook
 * [[Image:Chess Bld45.svg|26px]] [[Image:Chess Bll45.svg|26px]] [[Image:Chess Bdd45.svg|26px]] [[Image:Chess Bdl45.svg|26px]] B = inverted bishop
 * [[Image:Chess sll45.svg|26px]] [[Image:Chess sld45.svg|26px]] [[Image:Chess sdl45.svg|26px]] [[Image:Chess sdd45.svg|26px]] N = inverted knight (nightrider)
 * [[Image:Chess hld45.svg|26px]] [[Image:Chess hll45.svg|26px]] [[Image:Chess hdd45.svg|26px]] [[Image:Chess hdl45.svg|26px]] h = inverted pawn
 * [[Image:Chess eld45.svg|26px]] [[Image:Chess ell45.svg|26px]] [[Image:Chess edd45.svg|26px]] [[Image:Chess edl45.svg|26px]] e = elephant
 * [[Image:Mann_white_on_light_(an_icon_of_the_chess_piece).png|26px]] [[Image:Mann_white_on_dark_(an_icon_of_the_chess_piece).png|26px]] [[Image:Mann_black_on_light_(an_icon_of_the_chess_piece).png|26px]] [[Image:Mann_black_on_dark_(an_icon_of_the_chess_piece).png|26px]] M = mann (alternate symbol)
 * [[Image:Centaur on white squares.png|26px]] [[Image:Centaur on dark squares.png|26px]] C = centaur or amazon
 * Chess fll26.svg Chess fld26.svg Chess fdl26.svg Chess fdd26.svg F = ferz (alternate symbol)

Omega Chess pieces:
 * [[Image:Chess zll45.svg|26px]] [[Image:Chess zld45.svg|26px]] [[Image:Chess zdl45.svg|26px]] [[Image:Chess zdd45.svg|26px]] z = champion
 * [[Image:Chess wld45.svg|26px]] [[Image:Chess wll45.svg|26px]] [[Image:Chess wdd45.svg|26px]] [[Image:Chess wdl45.svg|26px]] w = wizard
 * [[Image:Chess tld45.svg|26px]] [[Image:Chess tll45.svg|26px]] [[Image:Chess tdd45.svg|26px]] [[Image:Chess tdl45.svg|26px]] t = fool (for Omega Chess Advanced)

Other suitable images include:

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


 * [[Image:Chess xxd45.svg|26px]][[Image:Chess xxl45.svg|26px]] xx = black cross/x
 * [[Image:Chess oxd45.svg|26px]][[Image:Chess oxl45.svg|26px]] ox = white cross/x
 * [[Image:Chess xod45.svg|26px]][[Image:Chess xol45.svg|26px]] xo = black circle
 * [[Image:Chess ood45.svg|26px]][[Image:Chess ool45.svg|26px]] oo = white circle

When showing movement directions on the board, arrows are available


 * [[Image:Chess uld45.svg|26px]][[Image:Chess ull45.svg|26px]] ul = up & left
 * [[Image:Chess uad45.svg|26px]][[Image:Chess ual45.svg|26px]] ua = up
 * [[Image:Chess urd45.svg|26px]][[Image:Chess url45.svg|26px]] ur = up & right
 * [[Image:Chess lad45.svg|26px]][[Image:Chess lal45.svg|26px]] la = left
 * [[Image:Chess lrd45.svg|26px]][[Image:Chess lrl45.svg|26px]] lr = left & right
 * [[Image:Chess udd45.svg|26px]][[Image:Chess udl45.svg|26px]] ud = up & down
 * [[Image:Chess rad45.svg|26px]][[Image:Chess ral45.svg|26px]] ra = right
 * [[Image:Chess dld45.svg|26px]][[Image:Chess dll45.svg|26px]] dl = down & left
 * [[Image:Chess dbd45.svg|26px]][[Image:Chess dbl45.svg|26px]] db = diagonal as black
 * [[Image:Chess dad45.svg|26px]][[Image:Chess dal45.svg|26px]] da = down
 * [[Image:Chess drd45.svg|26px]][[Image:Chess drl45.svg|26px]] dr = down & right
 * [[Image:Chess dwd45.svg|26px]][[Image:Chess dwl45.svg|26px]] dw = diagonal as white

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


 * [[Image:Chess x0d45.svg|26px]][[Image:Chess x0l45.svg|26px]] x0
 * [[Image:Chess x1d45.svg|26px]][[Image:Chess x1l45.svg|26px]] x1
 * [[Image:Chess x2d45.svg|26px]][[Image:Chess x2l45.svg|26px]] x2
 * [[Image:Chess x3d45.svg|26px]][[Image:Chess x3l45.svg|26px]] x3
 * [[Image:Chess x4d45.svg|26px]][[Image:Chess x4l45.svg|26px]] x4
 * [[Image:Chess x5d45.svg|26px]][[Image:Chess x5l45.svg|26px]] x5
 * [[Image:Chess x6d45.svg|26px]][[Image:Chess x6l45.svg|26px]] x6
 * [[Image:Chess x7d45.svg|26px]][[Image:Chess x7l45.svg|26px]] x7
 * [[Image:Chess x8d45.svg|26px]][[Image:Chess x8l45.svg|26px]] x8
 * [[Image:Chess x9d45.svg|26px]][[Image:Chess x9l45.svg|26px]] x9

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.

Diagram with both captions
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  to break the lines.

Diagram without captions
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.

Movement example
This can be used to show how pieces move.

In the board on the right, it is shown that the white queen can go any distance in any of these directions.

Another method for the rook example:

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.

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

Alternative way to place the pieces: FEN
It is possible to populate the board using Forsyth–Edwards Notation, instead of positional parameters.

To do this, the "fen" parameter is used. For instance, this is the opening board of a chess game, defined using the "fen" parameter "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR":

It is also possible to show "fairy" pieces using the FEN notation. However, because the FEN notation uses uppercase and lowercase to denote the color of the piece, it is not possible to display the inverted knight fairy piece (denoted by "N") using the fen parameter. Here is a board where the pawns are replaced by fairy pieces:

While the "fen" parameter was first developed and tested with 8x8 boards, support for other sized boards is available. For example, here is the Grand Chess starting positiong represented with an FEN board:

Displaying the board from the Black's point of view
The "reverse=true" parameter causes the board to be shown from Black's point of view, that is, with the h8 square at lower-left corner, and a1 at the upper-right. This works for all sizes of the normal chessboard template, but not for the Alice, Bughouse, Omega, or Raumschach templates. Here, the same FEN notation as in the previous example produces a board with Black's starting position at the bottom.

Alternative way to place the pieces: PGN
It is possible to populate the board using Portable Game Notation (PGN), instead of positional parameters or FEN. Internally, the PGN is converted to an FEN using Module:Pgn. The other parameters (align, reverse, etc) are also applicable when using PGN.