Template:Image2ontop

From Wikibooks, open books for an open world
Jump to: navigation, search
{{{1}}} {{{3}}}
{{{2}}} {{{4}}}



Uses, Limitations, Parameters and Options[edit]


Uses[edit]


Template name:Image2ontop Makes a three columned table and places the Table of Contents, (TOC), in it. Allows two separate images with captions to be placed to its right, level with the top of the TOC. Saves space and looks better than the large expanse of white space which usually exists to the right of the TOC.

Because the TOC text can vary and because the TOC has its own internal sizing algorithm, a widthleft option is provided to adjust the width of the leftmost cell, if necessary.

Note that the table can be placed anywhere on the page, so text could exist above it. To reduce any excessive gap between such text and the images, consider placing the template in-line with the end of the top text.

Limitations[edit]


I cannot figure out how to fully manage the mind of the TOC so the widthleft option was found necessary to unwrap TOC entries on occasion.

Images vary in size so it is important to select images of about the right shape before scaling. Scale the images to the same height if possible by specifying the height of each exactly and exaggerating the width to a considerable extent. In this way the software picks the least size to match the specification, which will be the one you want. Tiled Images contains further examples of such scaling, but see the code below for a typical example which can be run in the sandbox. (You will need to type a few dummy headings there to generate the Table of Contents.)

{{image2ontop|[[Image:Narcissus pseudonarcissus (daffodills) - 1.jpg|900x230px]]|Caption 1|[[image:crocus_4.jpg|1000x230px]]|Caption 2}}


Provision for two images is made, but if captions are not needed, use template:textontop with images scaled and in-line within the text space. In this way, a variable number of images could be included.

Parameters[edit]


There are four parameters; left image code, left caption, right image code, and right caption.

Options[edit]


widthleft
width of the leftmost table cell, with the Table of Contents, (TOC).Default 200px.
cp
all-round cell padding, default 5px
background
background color, default transparent.
border
perimeter border, default none.