Template:Barlabel/doc

This template is used to add labels to brackets and bars which have been added to cladograms using cladex.

Usage

 * 1) First create a cladogram using cladex and clade, as appropriate.
 * 2) Then embed the cladogram in this template.

Example
Suppose you have created the cladogram shown below.

To provide labels for the two groups identified in the cladogram:
 * Count the number of leaf nodes in the cladogram; here there are 7. The parameter size will be set to 7.
 * Decide against which leaf nodes you want the labels to go. To centre the labels, the label for the green group should be opposite leaf node 3; the label for the purple group should be between leaf nodes 5 and 6, i.e. opposite leaf node "5.5". The at parameters of the template are set to these values.

The full expression required is shown below (excluding the code to create the cladogram). This produces

To reduce the font size of the cladogram and its labels, use the style parameter. Thus produces

Parameters

 * size must be set to the total number of leaf nodes in the cladogram, e.g. |size=23.

Up to five labels can be provided. They are identified by the digit in the name of the parameter. Each label requires three parameters, e.g. at1, label1 and bar1.


 * atN</tt> defines the position of label N in terms of the leaf node which it is opposite to. For a label between two leaf nodes, use the average. Thus to place the first label opposite leaf node 6, use |at1=6</tt>; to place the third label opposite a point between leaf nodes 6 and 7, use |at3=6.5</tt>.
 * labelN</tt> defines the text of label N. Thus to give the third label the text "Group 3", use |label3=Group 3</tt>.
 * barN</tt> defines the colour of label N. Thus to put the second label in green text, use |bar3=green</tt>. (The name bar</tt> is consistent with cladex; however colourN</tt> or colorN</tt> can be used instead.)


 * style</tt> The size of the text used in the cladogram and the labels can be altered by using the style</tt> parameter, e.g. |style=font-size:85%</tt>. Do not alter the font size in the cladex or clade templates! If you do, the cladogram and the labels will not align correctly as they will be of different sizes.

Limitations, debugging
The template works by constructing a hidden table. Different browsers (user agents) have different algorithms for laying out tables, so the precise alignment of the labels differs between browsers and platforms, and is not always exactly opposite the chosen leaf node. Although it's possible to 'tweak' the alignment for one browser/platform combination (e.g. by using fractional positions other than 0.5), this won't work across combinations.

The template does not check the ranges of the parameters supplied, so make sure that the values of the atN</tt> parameters are less or equal to the value of the size</tt> parameters. Label N will only be displayed if size</tt>, <tt>atN</tt> and <tt>labelN</tt> are defined. The colour of the text of the label (defined by <tt>barN</tt>, <tt>colorN</tt> or <tt>colourN</tt>) defaults to black.