Template:Chess diagram/doc

Syntax
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 4x8 (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 8x12 (square size 26x26 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)
 * Template:Chess diagram 12x12 (square size 26x26 px)
 * Template:Chess diagram 16x16 (square size 26x26 px)
 * Template:Chess diagram 24x24 (square size 26x26 px)
 * 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:Raumschach diagram (5x5x5 board for Three-dimensional chess, 22x22 px)

The syntax is basically the same for all of them.

When the chess board is 8x8, there is an alternative syntax (see below):

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

There are also some fairy chess pieces available:


 * [[Image:Chess all45.svg|26px]] [[Image:Chess ald45.svg|26px]] [[Image:Chess adl45.svg|26px]] [[Image:Chess add45.svg|26px]] a = archbishop (knight+bishop compound)
 * [[Image:Chess cld45.svg|26px]] [[Image:Chess cll45.svg|26px]] [[Image:Chess cdd45.svg|26px]] [[Image:Chess cdl45.svg|26px]] c = chancellor (knight+rook compound)
 * [[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
 * [[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 eld45.svg|26px]] [[Image:Chess ell45.svg|26px]] [[Image:Chess edd45.svg|26px]] [[Image:Chess edl45.svg|26px]] j(e) = inverted bishop
 * [[Image:Chess sll45.svg|26px]] [[Image:Chess sld45.svg|26px]] [[Image:Chess sdl45.svg|26px]] [[Image:Chess sdd45.svg|26px]] N(s) = inverted knight
 * [[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 zll45.svg|26px]] [[Image:Chess zld45.svg|26px]] [[Image:Chess zdl45.svg|26px]] [[Image:Chess zdd45.svg|26px]] z = champion (for Omega Chess)
 * [[Image:Chess wld45.svg|26px]] [[Image:Chess wll45.svg|26px]] [[Image:Chess wdd45.svg|26px]] [[Image:Chess wdl45.svg|26px]] w = wizard (for Omega Chess)
 * [[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)
 * [[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
 * [[Image:Centaur on white squares.png|26px]] [[Image:Centaur on dark squares.png|26px]] C = centaur

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

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 dad45.svg|26px]][[Image:Chess dal45.svg|26px]] da = down
 * [[Image:Chess drd45.svg|26px]][[Image:Chess drl45.svg|26px]] dr = down & right

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:

Only 8x8 boards can use the "fen" parameter. For other size boards, positional parameters should be used.

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.