Comprehensive TeX Archive Network

Direc­tory macros/latex/contrib/etoc

Source:  etoc.dtx (v1.08g 2015/08/29 -- doc 2015/11/12)
Author:  Jean-Francois Burnol
Author:  Christine Roemer et al. (German tranlation)
Info:    Completely customisable TOCs
License: LPPL 1.3c or later
Copyright (C) 2012-2015 Jean-Francois Burnol.
Copyright (C) 2014-2015 Christine Roemer and collaborators for
the translation into German of the documentation.
<jfbu at free dot fr>    <Christine_Roemer at t-online dot de>


The etoc pack­age gives to the user com­plete con­trol on how the en­tries of the ta­ble of con­tents should be con­sti­tuted from the name, num­ber, and page num­ber of each sec­tion­ing unit. This goes via the def­i­ni­tion of line styles for each sec­tion­ing level used in the doc­u­ment. The pack­age pro­vides its own cus­tom line styles. Sim­pler ones are given as ex­am­ples in the doc­u­men­ta­tion. The sim­plest us­age will be to take ad­van­tage of the lay­out fa­cil­i­ties of pack­ages deal­ing with list en­vi­ron­ments.

Re­gard­ing the global toc dis­play, etoc pro­vides pre-de­fined styles based on a multi-col­umn for­mat, with, op­tion­ally, a ruled ti­tle or framed con­tents.

The \tableofcontents com­mand may be used ar­bi­trar­ily many times and it has a vari­ant \localtableofcontents which prints ta­bles of con­tents 'lo­cal' to the cur­rent sur­round­ing doc­u­ment unit. An ex­ten­sion of the \label/\ref syn­tax al­lows to re­pro­duce (with an­other lay­out) a lo­cal ta­ble of con­tents de­fined some­where else in the doc­u­ment.

Via depth tags, one gets an even finer con­trol for each ta­ble of con­tents of which sec­tion­ing units it should, or not, dis­play.

The for­mat­ting in­her­ited (and pos­si­bly cus­tomized by other pack­ages) from the doc­u­ment class will be used when in com­pat­i­bil­ity mode.

The as­sign­ment of lev­els to the sec­tion­ing units can be changed at any time, and etoc can thus be used in a quite gen­eral man­ner to cre­ate cus­tom ''lists of'', ad­di­tion­ally to the ta­bles of con­tents re­lated to the doc­u­ment sec­tion­ing units. No aux­il­iary file is used ad­di­tion­ally to the stan­dard .toc file.


The sim­plest is to down­load


and then run unzip etoc.tds.zip -d <DEST> where <DEST> is a TDS-com­pli­ant reper­tory.

Else, to ex­tract the pack­age (.sty) and driver (.tex) files from etoc.dtx:

  • if etoc.ins is present: etex etoc.ins
  • with­out etoc.ins: etex etoc.dtx

It is also pos­si­ble to run la­tex or pdfla­tex di­rectly on etoc.dtx.

At least three ways to pro­duce etoc.pdf (method (3) is pre­ferred):

  1. la­tex etoc.dtx (thrice), then dvips, then ps2pdf
  2. pdfla­tex etoc.dtx (thrice)
  3. la­tex etoc.tex (thrice), then dvipdfmx

Method (3) pro­duces the small­est pdf files. Op­tions can be set in etoc.tex:

  • scr­doc class op­tions (pa­per size, font size, ...)
  • with or with­out source code,
  • with dvipdfmx or with la­tex+dvips or pdfla­tex.

To pro­duce etoc-DE.pdf (Ger­man doc­u­men­ta­tion) run etex on etoc.ins or etoc.dtx to pro­duce etoc-DE.tex, then com­pile etoc-DE.tex with la­tex (thrice) then dvipdmx, or set first to 0 \Withdvipdfmx in etoc-DE.tex to al­low com­pi­la­tion with pdfla­tex.

Um etoc-DE.pdf zu erzeu­gen ist la­tex dreimal mit etoc-DE.tex laufen zu lassen, dann dvipdfmx mit etoc-DE.dvi. Im Falle von Prob­le­men mit dvipdfmx ist \Withdvidpdfmx auf 0 in etoc-DE.tex zu set­zen, dann ist pdfla­tex dreimal mit etoc-DE.tex laufen zu lassen.


etoc.sty    -> TDS:tex/latex/etoc/etoc.sty
etoc.dtx    -> TDS:source/latex/etoc/etoc.dtx
etoc.pdf    -> TDS:doc/latex/etoc/etoc.pdf
etoc-DE.pdf -> TDS:doc/latex/etoc/etoc-DE.pdf
README.md   -> TDS:doc/latex/etoc/README.md

The other files may be dis­carded.


This Work may be dis­tributed and/or mod­i­fied un­der the con­di­tions of the LaTeX Project Public Li­cense, ei­ther ver­sion 1.3c of this li­cense or (at your op­tion) any later ver­sion. This ver­sion of this li­cense is in


and the lat­est ver­sion of this li­cense is in


and ver­sion 1.3 or later is part of all dis­tri­bu­tions of LaTeX ver­sion 2005/12/01 or later.

The Authors of this Work are:

  • Jean-Fran­cois Burnol <jfbu at free dot fr> for the source code and English doc­u­men­ta­tion, and
  • Chris­tine Roe­mer <Christine_Roemer at t-online dot de> and col­lab­o­ra­tors for the trans­la­tion into Ger­man of the doc­u­men­ta­tion.

This Work con­sists of the main source file etoc.dtx and the de­rived files etoc.sty, etoc.ins, etoc.tex, etoc-DE.tex, etoc.pdf, etoc-DE.pdf, etoc.dvi, etoc-DE.dvi.


v1.08g [2015/08/29]

Down­graded to a mere info mes­sage the etoc-is­sued warn­ing (rel­a­tive to \settocdepth/\maxtocdepth) un­der class memoir.

v1.08f [2015/04/28]

Mi­nor changes to the doc­u­men­ta­tion. \etocsetlevel more eco­nom­i­cal.

v1.08e [2015/04/17]

The com­mand \etocchecksemptiness tells etoc to not print, from that point on, the head­ings of the lo­cal ta­bles of con­tents if they have empty con­tents. This is mainly for class au­thors who might want to have their \section or \chapter au­to­mat­i­cally do a \localtableofcontents. Could prove also use­ful for batch con­ver­sions of doc­u­ments. Thanks to Paul Ga­borit who asked for such a fea­ture.

The com­mand \etocnotocifnotoc ex­tends this be­haviour to global TOCs: in­deed why should doc­u­ments with no sec­tion­ing units take this as an ex­cuse not to use pack­age etoc ?

The com­mand \etocifwasempty{yes}{no} can be used for suit­able ex­tra ac­tion.

A \tableofcontents\ref{foo} now ex­pects foo to be a la­bel to a lo­cal TOC. The use with foo a la­bel to a global TOC is not sup­ported any­more as it had no util­ity and made the code more com­plex.

The syn­tax \localtableofcontents\ref{foo} is now ac­cepted as a syn­onym to the ear­lier syn­tax \tableofcontents\ref{foo}.

v1.08d [2015/04/09]

Trans­la­tion into Ger­man of the ad­di­tions made to the doc­u­men­ta­tion for the 1.08x se­ries of re­leases.

Thanks to Chris­tine Römer!

v1.08c [2015/03/30]

  • re­moved a few un­needed \long from the code.
  • re­moved use of \arabic at one lo­ca­tion of the code, as it may get re­de­fined by some lan­guage mod­ules for babel or polyglossia.

v1.08b [2015/03/18]

Bug fixes:

  • ex­tra space to­ken re­moved from \localtableofcontents (showed only for in­line TOCs.)
  • \etocpartname (a macro used by the pack­age own de­fault line styles) was de­fined to be \partname, but this is not com­pat­i­ble at least with babel+french con­text. Now sim­ply ex­pands to Part.
  • some prob­lems fixed in the Ger­man doc­u­men­ta­tion.
  • [2015/03/28] some more prob­lems fixed in the doc­u­men­ta­tion. Added men­tion of \etocarticlestyle and \etocbookstyle.

v1.08a [2015/03/13]

\etocname, \etocnumber and \etocpage are now the ro­bust vari­ants of \etocthelinkedname, \etocthelinkednumber and \etocthelinkedpage. This should ar­guably have been done since the ad­di­tion of the lat­ter to etoc with v1.07f [2013/03/07]. The ear­lier ro­bust com­mands \etocname etc... con­tained the hy­per­link des­ti­na­tion only in an un­ex­panded form.

The doc­u­men­ta­tion has a brand new ti­tle page and a new sec­tion The TOC as a TikZ mind map both il­lus­trat­ing fur­ther uses of etoc to dis­play ta­bles of con­tents as trees in an au­to­matic man­ner.

v1.08 [2015/03/10]

\etocskipfirstprefix may now ap­pear any­where in the <start> part of a level style.

New com­mands \etociffirst, \etocxiffirst, \etocxifnumbered, \etocglobaldefs and \etoclocaldefs.

It is now pos­si­ble to is­sue line style spec­i­fi­ca­tions di­rectly with & and \\ to­kens, in or­der to type­set a TOC as a tab­u­lar or longtable with the open­ing for ex­am­ple in the first ar­gu­ment of \etocsettocstyle and the clos­ing in its sec­ond ar­gu­ment.

It is manda­tory for such uses to is­sue \etocglobaldefs which tells etoc to pro­ceed glob­ally for cer­tain def­i­ni­tions. This is also use­ful in the con­text of the in­line en­vi­ron­ments of pack­age en­u­mitem.

On this oc­ca­sion, var­i­ous old parts of the code have been im­proved.

v1.07n [2015/03/05]

No more use of \toks@ when etoc con­structs \etocthelinkedname etc... Thus \toks@ can be put in the line styles in or­der to ac­cu­mu­late in­for­ma­tion. Only use­ful if it is cer­tain noth­ing else will change \toks@ ei­ther.

In the doc­u­men­ta­tion: list of main com­mands now in al­pha­betic or­der.

v1.07m [2015/01/23]

Read­ing of .toc file is de­layed to \begin{document} to ac­count for pos­si­ble Ba­bel ac­tive char­ac­ters used therein. Thanks to De­nis Bi­touzé who re­ported a Ba­bel re­lated prob­lem.

Im­proved global toc dis­play em­u­la­tion un­der KOMA-script classes.

New com­mand \etocbeforetitlehook. New com­mand \etocdisplay.

v1.07l [doc of 2014/04/29]

Added to the doc­u­men­ta­tion an ex­am­ple of use of \etocthelinkedname to­gether with an en­u­mitem in­line item­ize* en­vi­ron­ment; moved main TOC to im­me­di­ately af­ter the ti­tle, and li­cense to the first pages.

In­cor­po­ra­tion of the trans­la­tion into Ger­man done on the ini­tia­tive of Chris­tine Römer by Felix Baral-We­ber, Jenny Rothkrämer-Vogt, Daniel Büt­tner, Clau­dia Dahl, Chris­tian Otto and Chris­tine Römer (FSU Jena). My grate­ful thanks to all!

Down­load the con­tents of this pack­age in one zip archive (983.7k).

etoc – Com­pletely cus­tomis­able TOCs

The pack­age gives the user com­plete con­trol of how the en­tries of the ta­ble of con­tents should be con­sti­tuted from the name, num­ber, and page num­ber of each sec­tion­ing unit. The lay­out is con­trolled by the def­i­ni­tion of ‘line styles’ for each sec­tion­ing level used in the doc­u­ment.

The pack­age pro­vides its own cus­tom line styles (which may be used as ex­am­ples), and con­tin­ues to sup­port the stan­dard for­mat­ting in­her­ited from the LaTeX doc­u­ment classes, but the pack­age can also al­low the user to del­e­gate the de­tails to pack­ages deal­ing with list mak­ing en­vi­ron­ments (such as en­u­mitem). The pack­age’s de­fault global style type­sets ta­bles of con­tents in a multi-col­umn for­mat, with ei­ther a stan­dard head­ing, or a ruled ti­tle (op­tion­ally with a frame around the ta­ble).

The \table­of­con­tents com­mand may be used ar­bi­trar­ily many times in the same doc­u­ment, while \lo­caltable­of­con­tents pro­vides a ‘lo­cal’ ta­ble of con­tents.

Ver­sion1.08g-doc 2015-11-12
Li­censeThe LaTeX Project Public Li­cense 1.3
Main­tainerJean-François Burnol
TDS archiveetoc.tds.zip
Con­tained inTeX Live as etoc
MiKTeX as etoc
Topics deal with Tables of Con­tents, and of other such things
See also titletoc
Guest Book Sitemap Contact Contact Author