Comprehensive TeX Archive Network

Direc­tory macros/latex/contrib/etoc

Source:  etoc.dtx (v1.08i-2016/09/29)
Author:  Jean-Francois Burnol
Author:  Christine Roemer et al. (German tranlation)
Info:    Completely customisable TOCs
License: LPPL 1.3c
Copyright (C) 2012-2016 Jean-Francois Burnol.
Copyright (C) 2014-2016 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.

To pro­duce etoc.pdf one can run pdfla­tex (thrice) di­rectly on etoc.dtx or on the file etoc.tex which was ex­tracted from pre­vi­ous step.

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.

Since re­lease 1.08h pdfla­tex is the de­fault in etoc.tex (prior it was la­tex+dvipdfmx as it pro­duces smaller PDFs) in or­der to al­low in­clu­sion via the use of pack­age attachfile of about 25 code sam­ples as file at­tach­ment an­no­ta­tions.


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 Project Public Li­cense, in its ver­sion 1.3c. 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 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.08i [2016/09/29]

This fixes an is­sue dat­ing back to 1.08e-2015/04/17: un­der \etocchecksemptiness regime, some cir­cum­stances (such as adding to an al­ready com­piled doc­u­ment a \localtableofcontents be­fore the main \tableofcontents) cre­ated an "Undefined control sequence \Etoc@localtop" er­ror. Thanks to De­nis Bi­touzé for re­port­ing the prob­lem.

On this oc­ca­sion, \etocdoesnotcheckemptiness has been added to un­set the flag.

A rather more ex­otic is­sue was fixed: the empti­ness check for lo­cal tocs could get con­fused if the tocdepth counter was vary­ing in some spe­cific ways from in­side the toc file.

After adding to a doc­u­ment a \localtableofcontents, two passes are needed for etoc to get a chance to print the cor­rect lo­cal con­tents. Formerly, etoc is­sued a Warn­ing on the first pass; it now also in­duces into an­nounc­ing "There were un­de­fined ref­er­ences", as this is nearer to the end of the log file and con­sole out­put.

v1.08h [2016/09/25]

New func­tion­ing of \etocsetnexttocdepth: the tocdepth counter is mod­i­fied only at the time of the ta­ble of con­tents, not be­fore. This fixes an is­sue which arose when \etocsetnexttocdepth was used mul­ti­ple times with no in­ter­ven­ing ta­ble of con­tents. Thanks to De­nis Bi­touzé for re­port­ing the prob­lem.

The PDF doc­u­men­ta­tion in­cludes about 25 code snip­pets also as file at­tach­ment an­no­ta­tions, ad­di­tion­ally to their ver­ba­tim type­set­ting. The or­der­ing of the doc­u­men­ta­tion con­tents has been slightly re-or­ga­nized.

A pre­vi­ous doc­u­men­ta­tion-only up­date on 2016/09/09 added a new sec­tion with the (ap­prox­i­mate) trans­la­tion into etoc lin­gua of the book class toc style, for easy cus­tomiz­abil­ity.

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!

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

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 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.08i 2016-09-29
Li­cense The 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 tocbasic
Guest Book Sitemap Contact Contact Author