Document 518

The LaTeX sectsty package

Version: 3.5, 4.x, 5.x - Scientific WorkPlace & Scientific Word

The sectsty package modifies the typeset appearance of section headings in standard LaTeX articles, books, reports, and some documents derived from them. The package commands combine with standard LaTeX font selection commands to affect the font family, size, justification, use of rules, and numbering of division headers. Thus, you can change the text of the section headings from a serif font, as used in this topic, to a sans serif font, such as Arial. Using the package to change the justification for headings that are automatically indented is possible but not advisable. The sectsty package doesn't work with documents created with Style Editor shells.

How to change the typeset appearance of section headings

  1. Add the sectsty package to your document.

    NOTEIf the sectsty package is listed in the Add Package list, you can add it to your document. It if isn't listed, the package won't work with your document. Do not go native to add it.

  2. From the Typeset menu, choose Preamble.
  3. Click the mouse in the entry area.
  4. On a new line, add the command \headingcommand{\fontcommand} where headingcommand is the package command indicating the section heading you want to change and fontcommand is one or more standard LaTeX font selection commands (see below).
  5. Repeat step 4 for each type of section heading you want to modify.
  6. Choose OK.

The package has no options. Available package commands include but aren't limited to these:

Command Effect
\allsectionsfont Changes the appearance of all section headings.
\partfont Changes the appearance of all part headings and numbers.
\chapterfont Changes the appearance of all chapter headings and numbers.
\sectionfont Changes the appearance of all section headings.
\subsectionfont Changes the appearance of all subsection headings.
\partnumberfont Changes the appearance of all part numbers.
\parttitlefont Changes the appearance of all part titles only.
\chapternumberfont Changes the appearance of all chapter numbers.
\chaptertitlefont Changes the appearance of all chapter titles only.

See the package documentation for a complete listing of available commands.

Standard LaTeX font selection commands include those to select a font family, such as \sffamily or \ttfamily; a font shape, such as \itshape or \scshape; a font series (width and weight), such as \bfseries or \mdseries; or a font size, such as \Large or \huge. Font selection commands also include those related to justification: \centering, \raggedright, and \raggedleft.

Thus, although the basic \section{\fontcommand} command syntax is the same, the actual commands can vary considerably depending on the extent of the modifications you want to make. An example shows the possibilities available with the package. The command \allsectionsfont{\raggedleft} right-justifies all headings in a standard LaTeX report, changing their appearance from this:
Sample section headings before sectsty command

to this:
Sample section headings changed by sectsty command

Because sectsty redefines LaTeX sectioning commands, any package that requires sectioning commands won't necessarily work with the sectsty package. The package works for standard document classes only. The package is installed in the TCITeX/TeX/LaTeX/contrib/sectsty directory.

See also

Last revised 05/02/07

This document was created with Scientific WorkPlace.