Jump to content

ଛାଞ୍ଚ:TOC begin

Template documentation[view] [edit] [history] [purge]

These templates are designed to aid in producing tables of contents (TOCs) using a standardised set of table sections. They are begun with a {{TOC begin}} and are ended with {{TOC end}}.

The aim of these templates is to divorce the TOC from the underlying code. If you have a new circumstance to format, perhaps the best option is to make a new template, rather than hack an old one to fit.

  • align: alignment of the table on the page, defaults to central (optional)
  • width: table width (optional, any CSS units), | width = 100%
  • max-width: table max-width (optional, any CSS units), | max-width = 600px
  • sc: applies small-caps to the entire table (optional), | sc = yes
  • style: applies any other free-form style to the entire table (optional/no default), | style = line-height:1
  • plus: allows addition of separate code (optional), eg. to set table attributes | plus = cellpadding {{=}} 5 ( refer Template:= )

Naming convention


Template are named by the colspan of their cells (in order) and the salient feature of any cells that are not "normal".

For example, a row of three single cells is {{TOC row 1-1-1}}, and a row with a colspan-2 cell followed by a single cell is {{TOC row 2-1}}. If a cell has no colspan but a salient feature, the "1" from that cell is omitted: {{TOC row 1-out-1}}

  • {{TOC row c}}: a single cell, text centred, with a colspan given in the first parameter, and contents in the second.
  • {{TOC row r}}: a single cell, text right-aligned, with a colspan given in the first parameter, and contents in the second.

3-column tables


3-column tables are perhaps the most common type. The "normal" condition if for the first and last columns to be right-aligned, and the middle column to be left aligned.

  • {{TOC row 1-1-1}}: three single cells, right-left-right aligned, respectively
  • {{TOC row 2-1}}: a colspan=2 cell and a normal cell. Left and right aligned respectively.
Hanging indents
  • {{TOC row 1-out-1}}: three single cells, but the middle cell has a {{hanging indent}} applied.
  • {{TOC row 2out-1}}: same as "2-1", but the first cell has a hanging indent.
  • {{TOC row 1-dot-1}}: same as "1-out-1", but the middle cell also has a dot-trailer appended.
    • Optional: use symbol= to set dot character(s), space= to set number of spaces (default: one dot and 5 spaces)
      • Use spaces= to set spaces between (symbols.)
  • {{TOC row 2dot-1}}: same as "2out-1", but the first cell also has a dot-trailer appended.
Different alignment
  • {{TOC row 1-r-1}}: three single cells, left-right-right aligned, respectively.
  • {{TOC row 1-c-1}}: three single cells, left-center-right aligned, respectively.
ଛାଞ୍ଚ:TOC row rଛାଞ୍ଚ:TOC row 1-out-1ଛାଞ୍ଚ:TOC row 2out-1ଛାଞ୍ଚ:TOC row 1-dot-1ଛାଞ୍ଚ:TOC row 2dot-1
Table of Contents: {{TOC row c}}
Introduction, Preface and Other Front Matter : {{TOC row 2-1}} 1
1 Chapter 1: {{TOC row 1-1-1}} 2
2 Chapter 2: {{TOC row 1-1-1}} Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 3

4-column tables


The "normal" condition if for the first, second and last columns to be right-aligned, and the third column to be left aligned.

ଛାଞ୍ଚ:TOC row 2-1-1ଛାଞ୍ଚ:TOC row 1-1-1-1ଛାଞ୍ଚ:TOC row 1-1-1-1
Table of Contents: {{TOC row c}}

If a table is broken across multiple, as is common for long TOCs, you need to add a {{nop}} to the top of every page body, to prevent the transclusion running the last line of the previous page into the first line of that page. You also need to put a {{TOC begin}} in the header of the page to make it render properly in the Page: namespace, and you should close the table in the footer of every page except the last:

First page body
{{TOC begin}}
{{TOC row.....}}
First page footer
{{TOC end}}
Middle page header
{{TOC begin}}
Middle pages body
{{TOC row.......}}
{{TOC row.......}}
Middle pages footer
{{TOC end}}
Last page header
{{TOC begin}}
Last page body
{{TOC row....}}
{{TOC end}}

Navigation templates are used to help a reader navigate through or between texts.

Template You type You get Notes
{{TOC}} {{TOC}}

Table of contents A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Used to provide a compact TOC to an alphabetical listing.
{{AuxTOC}} {{AuxTOC|

* [[/Chapter 1/]]}}

Chapters (not individually listed)
Used when the work does not include an original Table of Contents.
{{TOC begin}},
{{TOC end}} and
all {{TOC row....}}'s

{{TOC begin}}
{{TOC row 1-1-1|...}}
{{TOC end}}

Preface i
I. Introduction xii
II. Chapter 1 1
Used to easily format existing TOCs in the original.