Difference between revisions of "Table of Contents - Mediawiki"

From Help Wiki
m
Line 1: Line 1:
 +
{{TwoColumn|lead=
 
A page can be divided into '''sections''', using the section header syntax.
 
A page can be divided into '''sections''', using the section header syntax.
 
+
|content=
 
==Creation and numbering of sections==
 
==Creation and numbering of sections==
  
Line 37: Line 38:
  
 
More info: http://meta.wikimedia.org/wiki/Help:TOC
 
More info: http://meta.wikimedia.org/wiki/Help:TOC
 
+
|sidebar=
 
{{Mediawiki Help}}
 
{{Mediawiki Help}}
 
+
{{GetHelp}}
 +
}}
 
  [[category:Mediawiki]]
 
  [[category:Mediawiki]]

Revision as of 15:18, 15 November 2016

A page can be divided into sections, using the section header syntax.

Creation and numbering of sections

Sections are created by creating their headers, as below

==Section==

===Subsection===

====Sub-subsection====

Please do not use only one equals sign on a side (=text here=); this causes a title the size of the page name, which is taken care of automatically.

With the preference setting Auto-number headings sections are numbered.

Table of contents (TOC)

For each page with more than three headings, a table of contents (TOC) is automatically generated from the section headings, unless:

  • (for a user) preferences are set to turn it off
  • (for an article) in the edit box the magic word __NOTOC__ is added

Controlling the Auto TOC

With __FORCETOC__ or __TOC__ in the wikitext a TOC is added even if the page has fewer than four headings.

With __FORCETOC__ the TOC is put before the first section header. With __TOC__, it is put at the position of this code. This allows any positioning, also e.g. on the right, and in a table cell, and it also allows multiple occurrence, e.g. in every section (demonstrated on Section; however, this seems only useful if the sections are long, so that the TOCs take up only a small part of the total space.).

Thus there may be some introductory text before the TOC, known as the "lead". Although usually a header after the TOC is preferable, __TOC__ can be used to avoid being forced to insert a meaningless header just to position the TOC correctly, i.e., not too low.

User preferences can be set to number the sections automatically.


The Table of contents can be forced onto a floating table on the right hand of the screen with the code below

 {|align=right
  |__TOC__
  |}

More info: http://meta.wikimedia.org/wiki/Help:TOC