Home
The etoc package
Contents
1.
2. begingroup etocfontone addvspace etocsepone parindent z parfillskip z setbox z vbox parfillskip flushglue etocname par setbox tw lastbox global setbox ne hbox unhbox tw dimen z wd ne setbox z etoctoclineleaders advance dimen z wd z etocifnumbered setbox tw hbox etocnumber etocabbrevpagename etocpage setbox tw hbox etocabbrevpagename etocpage advance dimen z wd tw ifdim dimen z lt linewidth vbox etocname leaders box z hfil box tw baselineskip etocbaselinespreadone baselineskip par else vbox etocname leaders copy z hfil break hbox leaders box z hfil box tw baselineskip etocbaselinespreadone baselineskip par fi endgroup addpenalty secpenalty addvspace etocsepzero subsection 728 etoc setstyle two 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 82 addpenalty medpenalty etocskipfirstprefix addpenalty itempenalty begingroup etocfonttwo addvspace etocseptwo parindent z parfillskip z setbox z vbox parfillskip flushglue etocname par setbox tw lastbox global setbox ne hbox unhbox tw dimen z wd ne setbox z etoctoclineleaders advance dimen z wd z etocifnumbered setbox tw hbox etocnumber etocabbrevpagename etocpage setbox tw hbox etocabbrevpagename etocpage advance dimen z
3. placeholder for comments 381 def Etoc getit hyp 1 2 3 4 5 6 etoc 382 def Etoc getname 1 hspace relax etoc 383 namedef etocname leavevmode 1 2 3 1 5 384 def etocthename 1 385 toks 1 386 edef etocthelinkedname noexpand hyperlink 3 the toks 387 388 def Etoc getnbr 1 hspace 2 3 etoc 389 ifx relax 2 else 390 namedef etocnumber leavevmode 1 2 3 1 5 391 def etocthenumber 1 392 toks 1 75 35 Implementation 393 edef etocthelinkednumber noexpand hyperlink 3 the toks 394 Etoc numbertrue 395 Etoc getname 3 etoc 396 fi 397 3 398 Etoc getnbr 4 hspace relax etoc 399 placeholder for comments 400 let etocthename empty 401 let etocthenumber empty 402 let etocthepage empty 403 let etocthelinkedname empty 404 let etocthelinkednumber empty 405 let etocthelinkedpage empty 406 let etocthelink empty 407 DeclareRobustCommand etocname 1 408 DeclareRobustCommand etocnumber 409 DeclareRobustCommand etocpage 1 410 DeclareRobustCommand etoclink 1 411 DeclareRobustCommand etocifnumbered 412 ifEtoc number expandafter firstoftwo else expandafter secondoftwo fi 1 07j modifies Etoc readtoc 413 def Etoc readtoc 414 ifeof Etoc tf 415 else 416 read Etoc tf to Etoc buffer 417 Etoc toctoks expandafter expandafter expandafter 418 expandafter the expanda
4. 1 In 99 99 of use cases however the macro gets redefined at a later stage thus the bug did not show 296 def Etoc getthepage hyp 1 2 3 4 5 etoc 297 namedef etoclink 1 leavevmode 1 2 3 1 5 298 edef etocthelink 1 noexpand hyperlink 3 1 299 def etocthepage 4 300 toks 4 301 edef etocthelinkedpage noexpand hyperlink 3 the toks 302 303 304 def Etoc getnb 1 305 let Etoc next Etoc getnb nohyp 306 ifEtoc hyperref ifx 1 hyper linkstart 307 let Etoc next Etoc getnb hyp 308 fi fi 309 Etoc next 1 310 311 312 def Etoc getit 1 313 let Etoc next Etoc getit nohyp 314 ifEtoc hyperref ifx 1 hyper linkstart 315 let Etoc next Etoc getit hyp 316 fi fi 317 Etoc next 1 318 placeholder for comments 319 def Etoc getnb nohyp 1 2 3 etoc 320 def Etoc getname 1 relax relax etoc 321 namedef etocname leavevmode 1 322 def etocthename 1 323 def etocthelinkedname 1 324 325 ifx 1 numberline 326 namedef etocnumber leavevmode 2 327 def etocthenumber 2 328 def etocthelinkednumber 2 329 Etoc numbertrue 330 Etoc getname 3 etoc 331 else then etocthename and etocthelinkedname already defined 332 namedef etocnumber leavevmode 333 let etocthenumber empty 334 let etocthelinkednumber empty 335 Etoc numberfalse 336 fi 337 placeholder for comments 74 338 d
5. 34 Change history 35 Implementation 49 30 Customizing etoc 30 Customizing etoc 30 1 Customizing the etoc pre defined line styles We will simply list the relevant commands as defined in the package Customizing them goes through suitable renewcommands newcommand etocfontminustwo normalfont LARGE bfseries newcommand etocfontminusone normalfont large bfseries newcommand etocfontzero normalfont large bfseries newcommand etocfontone normalfont normalsize bfseries newcommand etocfonttwo normalfont normalsize newcommand etocfontthree normalfont footnotesize newcommand etocsepminustwo 4ex plus 5ex minus 5ex newcommand etocsepminusone 4ex plus 5ex minus 5ex newcommand etocsepzero 2 5ex plus 4ex minus 4ex newcommand etocsepone 1 5ex plus 3ex minus 3ex newcommand etocseptwo 5ex plus lex minus lex newcommand etocsepthree 25ex plus 05ex minus 05ex newcommand etocminustwoleftmargin 1 5em plus 0 5fil newcommand etocminustworightmargin 1 5em plus 0 5fil newcommand etocminusoneleftmargin lem newcommand etocminusonerightmargin lem newcommand etocbaselinespreadminustwo 1 newcommand etocbaselinespreadminusone 1 newcommand etocbaselinespreadzero 1 newcommand etocbaselinespreadone 1 newcommand etocbaselinespreadtwo 1 newcommand etocbaselinespreadthree 9 newcommand etoctoclineleaders hbox normalfont normalsize hbox to 2ex hss hss
6. la etoc but just for the sections and subsections in this part As it is put in a frame it has to be small enough to fit on one page It has the label toc b Specifying the toc display style The compatibility mode etocstan 25 p 38 darddisplaystyle 25 6 p 40 the command etocsettocstyle The command etocinline 25 1 p 38 25 7 p 41 The commands etocmulticol style etocmulticol and etoc localmulticol 25 2 p 38 Starred variants of the tableof contents etc commands 26 p 41 The commands etocruledstyle etocruled and etoclocalruled Table of contents for this part 25 3 p 39 27 p 41 ine co inta da etocframedstyle Testing the compatibility mode etocframed and etoclocalframed ee 27 1 p 41 25 4 p 39 A framed display 27 2 p 42 ice etocoldpar etoc A crazy inline display 27 3 p 43 innertopsep 25 5 p 40 27 3 A crazy inline display Let us finally make some crazy inline display of the table of contents of this entire doc ument We will typeset the subsections as footnotes This kind of style is suitable for a hyperlinked document probably not for print although I like it but my personal taste in many matters does not seem to be widely shared Here is the inline table of contents Abstract Foreword License installation Overview Do I need to be a geek to use etoc Line styles and toc display style A first example A second example Linked list of the main
7. tents all inside a group so that future table of contents will not be affected there is etocruled number_of_columns title And the local form will be etoclocalruled 25 4 The commands etocframedstyle etocframed and etoclocalframed Same mechanism etocframedstyle number_of_columns title 39 25 Specifying the toc display style and the accompanying shortcut etocframed number_of_columns Xtitle The shortcut is used if one does not want to modify the style of the next TOCs the other way is to put the whole thing inside braces or a begingroup endgroup there is also etoclocalframed for a local table of contents The entire table of contents is framed The title itself is not framed if one wants a frame one should set it up inside the title argument to etocframedstyle or etocframed The colors for the background and for the components top left right bottom of the border are specified via suitable renewcommand s see subsection 30 2 A minipage is used hence the produced table of contents isn t compatible with a page break For allowing page breaks use of the commands of mdframed or tcolorbox in the arguments of etocsettocstyle is recommended Examples in this document are on pages 13 19 43 and 54 25 5 Headings titles etocoldpar etocinnertopsep For etocmulticolstyle the mandatory heading argument can be either vertical mode material like section emph Table
8. up is with chapter and contentsname The format of the actual heading of the TOC should also be set appropriately for ex ample with etoctocstyle to use the identical division unit as in the first argument to etocmemoirtoctotocfmt A weird situation arises when one has two successive localtableofcontents obvi ously this is not a truly real life situation just after a part for example The first one creates if the default has not been modified as indicated above a Chapter heading which is written to the toc Then the second one thinks to be local to this chapter and as a result it displays nothing The fix is to define the second one to be a clone of the first one Independently of the situation with the memoir class there is generally speaking a hook macro called etocaftertitlehook which is inhibited by using the starred variants of the displaying commands Except for the memoir class this hook is initially defined to do nothing There is also etocaftercontentshook similarly defined to do nothing They can be used for some special effects 27 Table of contents for this part 27 1 Testing the compatibility mode As a third example we now print the local table of contents for this part First we will test the compatibility mode The original was invisibly defined with a label at the beginning of this Part V KOMAoptions toc left etocstandarddisplaystyle necessary for the display to obey toc left etocstandardli
9. 22 noindent strut bfseries large etocnumber hskip 5em etocname par nopagebreak 3 etocruledstyle 4 Large bfseries List of the exercises setlength columnseprule 4pt tableofcontents endgroup 17 A TOC with a fancy layout Here is a table of contents where the sections from a given chapter are to be represented by a number range like 18 22 for a given chapter 42 49 for another one of course to be inserted automatically in the TOC This is not an image inclusion the TOC is produced from its original tex source in serted in this document after replacement of part chapter or section with dummypart dummychapter and dummysection and there is also a dummy page count We copied the line styles used in the original and displayed the table of contents following etocsetlevel dummypart 1 etocsetlevel part 2 etocsetlevel dummychapter 0 etocsetlevel chapter 2 etocsetlevel dummysection 1 etocsetlevel section 2 etocsetnexttocdepth dummysection Each chapter displays the numbers of only the first and the last sections it contains See the source file etoc dtx for the details of how this is done Another technique for doing this kind of things is explained in subsection 32 4 TABLE OF CONTENTS PARTI Sections PAGE Introductory vs ass s 1 8 5 Concord LESSON 1 Concord of Subject and Verb si 9 17 7 2 Concord of Substantive and Adjective sa 18 22 9 Concord of Relative and its Ant
10. We must cancel all tocvsec2 toc related actions But a check must be done for the memoir class as its tocvsec2 emulation does not have the incompatible things etoc needs to revert This extra check added with etoc 1 071 1180 def Etoc tocvsec err 1 PackageError etoc 1181 the command protect 1 space is incompatible with etoc 1182 use protect etocsettocdepth toc as replacement check the manual 1183 7 1184 AtBeginDocument 1185 ifclassloaded memoir 1186 PackageWarning etoc You may consider using protect etocsettocdepth toc 1187 as a drop in44J 1188 replacement to the memoir own protect settocdepth space 1189 if you wish to exploit etoc to its J 1190 fullest Similarly consider using 1191 protect etocsettocdepth space and 1192 protect etocsetnexttocdepth J rather 1193 than memoir s protect maxtocdepth 1194 ifpackageloaded tocvsec2 1195 def maxtocdepth 1 Etoc tocvsec err maxtocdepth 3 1196 def settocdepth 1 Etoc tocvsec err settocdepth 3 1197 def resettocdepth ifstar Etoc tocvsec err resettocdepth 1198 Etoc tocvsec err resettocdepth 1199 3 1200 def save tocdepth 1 2 3 if etoc is added to file previously 1201 let reset tocdepth relax using tocvsec2 1202 let remax tocdepth relax 1203 let tableofcontents etoctableofcontents 91 35 Implementation 1204 PackageWarning etoc 1205 package tocvsec2 detected and its modification of J 1206 prot
11. etocruledstyle etoc ruled and etoclocalruled The commands etocframedstyle etoc framed and etoclocalframed The compatibility mode etocstandard displaystyle 25 6 p 40 The command etocinline 26 Starred variants of the table ofcontents etc commands 27 Table of contents for this part Testing the compatibility mode 27 1 0 41 A framed display 27 2 0 42 A crazy inline display 27 3 0 43 Part VI Using and customiz ing etoc 28 Summary of the main style commands Setting up local styles 28 1 0 45 Setting up toc display styles 28 2 0 45 Displaying tables of contents 29 The package default line styles etocdefaultlines 30 Customizing etoc Customizing the etoc pre defined line l t Sine 30 1 p 50 Customizing the toc display styles EE 30 2 p 51 31 One more example of colored TOC layout Part VII Tips 32 and tricks Hacking framed parboxes 32 1 p 54 Interverting the levels 32 2 p 55 All subsections of this document ebe 32 3 p 55 Displaying statistics 32 4 p 56 Using depth tags 32 5 p 58 Typesetting the TOC as a table DEE 32 6 p 60 Compatibility with other packages 42 32 7 0 64 TeXnical matters 32 8 p 65 Errors and catastrophes 32 9 0 66 Part VIII The code 33 Timestamp
12. restonecoltrue onecolumn else restonecolfalse fi 1005 chapter contentsname 1006 mkboth MakeUppercase contentsname 1007 MakeUppercase contentsname 1008 if restonecol twocolumn fi 1009 def etocbookstylenomarks 1010 etocsettocstyle 1011 if twocolumn restonecoltrue onecolumn else restonecolfalse fi 1012 chapter contentsname 1013 if restonecol twocolumn fi 87 35 Implementation 1014 let etocreportstyle etocbookstyle 1015 let etocreportstylenomarks etocbookstylenomarks 1016 def etocmemoirtoctotocfmt 1 2 1017 def Etoc addsuitablecontentsline addcontentsline toc 1 2 1018 renewcommand etocaftertitlehook 1019 ifmem em starred listof 1020 else phantomsection aftergroup Etoc addsuitablecontentsline fi 1021 def etocmemoirstyle 1022 etocsettocstyle 1023 ensureonecol par begingroup nameuse tocmaketitle 1024 Etoc aftertitlehook let Etoc aftertitlehook relax 1025 parskip cftparskip nameuse cfttocbeforelisthook 1026 nameuse cfttocafterlisthook endgroup restorefromonecol placeholder for comments 1027 def etocscrartclstyle 1028 etocsettocstyle 1029 let if dynlist if tocleft 1030 iftocfeature toc onecolumn 1031 iftocfeature toc leveldown 1032 1033 if twocolumn aftergroup twocolumn onecolumn fi 1034 1 07k next line to do as within current scrartcl 2013 12 19 v3 12 KOMA Script article class 1035 ifto
13. sible to use etoc concurrently with package tocloft 2 License installation Package etoc Version 1 071 2014 04 22 License LPPL 1 3c or later Copyright C 2012 2013 2014 Jean Francois Burnol lt jfbu at free dot fr gt Copyright C 2014 Christine Roemer lt Christine_Roemer at t online dot de gt and collaborators for the translation into German of the documentation This Work may be distributed and or modified under the conditions of the LaTeX Project Public License either version 1 3c of this license or at your option any later version This version of this license is in http www latex project org lppl lppl 1 3c txt and the latest version of this license is in http www latex project org lppl txt and version 1 3 or later is part of all distributions of LaTeX version 2005 12 01 or later The Authors of this Work are Jean Francois Burnol lt jfbu at free dot fr gt for the source code and English documentation and Christine Roemer lt Christine_Roemer at t online dot de gt and collaborators for the translation into German of the documentation This Work consists of the main source file etoc dtx and the derived files etoc sty etoc ins etoc tex etoc DE tex etoc pdf etoc DE pdf etoc dvi etoc DE dvi Extraction of the package sty and driver tex files if etoc ins is present tex etoc ins without etoc ins tex etoc dtx It is also possi
14. 1 p 32 xii The etocskipfirst prefix command 21 2 p 33 xiii The etocnumber command 21 3 p 33 xiv The etocthename etocthenumber and etoc thepage commands 21 4 p 34 xv The etoclink com mand 21 5 p 34 xvi The etocthelinked name etocthelinked number etocthelinked page and etocthelink commands 21 6 p 35 xvii Testing the scope 23 1 p 36 xviii This is a pale red subsection for illustrative purposes 23 2 p 37 xix The command etoc settocstyle 25 1 p 38 32 4 Displaying statistics xx The commands etoc multicolstyle etoc multicol and etoclo calmulticol 25 2 p 38 xxi The commands etoc ruledstyle etocruled and etoclocalruled 25 3 p 39 xxii The commands etoc framedstyle etocframed and etoclocalframed 25 4 p 39 xxiii Headings titles eto coldpar etocinnertop sep 25 5 p 40 xxiv The compatibility mode etocstandard displaystyle 25 6 p 40 xxv The command etoc inline 25 7 p 41 xxvi Testing the compati bility mode 27 1 p 41 xxvii A framed display 27 2 p 42 xxviii A crazy inline dis play 27 3 p 43 xxix Setting up local styles 28 1 p 45 xxx Setting up toc display styles 28 2 p 45 xxxi Displaying tables of contents 28 3 p 46 xxxii Labels and refer ences 28 4 p 46 xxxiii Customizing the etoc pre defined line styles 30 1 p 50 xxxiv Custom
15. 1 in the article class just before tableofcontents does not prevent Parts from appearing in the Table of Contents One has to set it to 2 for that whether in the article or in the book class The canonical levels a priori known to etoc are those of relevance to the tocdepth counter in the standard classes and are recapitulated in this table memoir class book 2 part 1 chapter 0 section 1 subsection 2 subsubsection 3 paragraph 4 subparagraph 5 With etoc the user can easily print a local table of contents inside a given subsec tion where subsubsections will be printed in the style of sections paragraphs in the style of subsections and subparagraphs in the style of subsubsections if so desired One can also decide to set everything to be at the level 6 never displayed by etoc except for example paragraphs promoted to be at level 1 and then one obtains a nice table of contents of all the paragraphs from the document tocdepth at least 1 10 The etocsettocdepth and etocsetnexttocdepth commands The tocdepth counter has no bearing on what gets written to the toc file its action is only on the actual typesetting of the table of contents in the standard classes there is only one tableofcontents possible whereas with etoc arbitrarily many are allowed so one may change tocdepth to the appropriate value which decides the finest sectioning level displayed again and again each time a table of conte
16. 39 25 2 1 2 Do we really want paragraph entries in the TOC 39 25 2 1 3 really eg en tg ei heed 39 25 3 The commands etocruledstyle etocruled and etoclocal ke NEE 39 25 4 The commands etocframedstyle etocframed and etoclocalframed i camsiesi a aaa aia ad e 0 Da a ia d 39 58 32 5 Using depth tags 25 5 Headings titles etocoldpar etocinnertopsep 40 25 6 The compatibility mode etocstandarddisplaystyle 40 25 7 The command etocinline 4 26 Starred variants of the tableofcontents etc commands 41 27 Table of contents for this part 41 27 1 Testing the compatibility mode 41 27 2 A framed display ae e ee eh actin ds a Ee SN EN AEN i d i al 42 27 3 A crazy inline display 00 43 VI Using and customizing etoc 45 VII Tips 33 etocsetnexttocdepth all begingroup parindent Opt leftskip Ocm rightskip 75cm parfillskip rightskip newcommand EndParWithPagenoInMargin nobreak hfill nobreak makebox 0 75cm r mdseries normalsize etocpage par renewcommand etoctoclineleaders hbox normalfont normalsize hbox to 75ex hss hss newcommand EndParWithPagenoInMarginAndLeaders nobreak leaders etoctoclineleaders hfill nobreak makebox 0 75cm r mdseries normalsize etocpage par etocsetstyle part 1 leavevmode leftskip 1cm relax bfs
17. 8 Labeling and reusing elsewhere Part Il Arbitrarily many TOCs and local ones too Here are some statistics for this part it contains 7 sections and 6 subsections The name of the first section is Labeling and reusing elsewhere and the corresponding number is 8 The name of the last section is Two Examples and its number is 14 The name of the first subsection is The hyperref option bookmarksdepth and the corresponding number is 10 1 The name of the last subsection is A TOC with a background color and its number is 14 2 8 Labeling and reusing elsewhere 12 9 A powerful functionality of etoc the re assignment of levels with etoc setlevel 13 10 The etocsettocdepth and etocsetnexttocdepth commands 14 10 1 The hyperref option bookmarksdepth cc 15 11 The command etocsettocdepth toc 15 11 1 The commands etocobeytoctocdepth and etocignoretoctocdepth 16 12 The commands etocdepthtag toc and etocsettagdepth 16 12 1 The commands etocobeydepthtags and etocignoredepthtags 16 13 Adding commands to the toc file 17 13 1 The hyperref option hidelinks 17 14 Two Examples 18 14 1 A Beautiful Thesis example cc 18 14 2 A TOC with a background color LL 19 8 Labeling and reusing elsewhere etoc allows arbitrarily many tableofcontents commands in your document The line styles and the toc display style may of c
18. In 1 071 the deactivation of etoc settocdepth done at the start of the toc file for the case this file is used after having removed etoc from the document or imported in another document is done via letting it to gobble rather than count which would not be ok as what follows would be undefined too The reason for the count also used originally in etocignoretoctocdepth is that when I first worked on 1 079 I possibly had more than one token after etoc settocdepth but I changed that later 1141 def Etoc storetocdepth global c etoc tocdepth c tocdepth 1142 def Etoc resettocdepth global c tocdepth c etoc tocdepth 1143 def etocobeytoctocdepth def etoc settocdepth 1144 afterassignment Etoc nottoodeep global c tocdepth 1145 def Etoc nottoodeep ifnum c tocdepth gt c etoc tocdepth 1146 global c tocdepth c etoc tocdepth fi 1147 def etocignoretoctocdepth let etoc settocdepth gobble 1148 def etocsettocdepth futurelet Etoc nexttoken Etoc set tocdepth 1149 def Etoc set tocdepth ifx Etoc nexttoken bgroup 1150 expandafter Etoc set tocdepth 1151 else expandafter Etoc set toctocdepth 1152 fi 1153 def Etoc set tocdepth 1 ifundefined Etoc 1 1154 PackageWarning etoc 1155 Unknown sectioning unit 1 protect etocsettocdepth space ignored 90 1156 global c tocdepth csname Etoc 1 endcsname 1157 1158 def Etoc set toctocdepth 1 Etoc set toctocdepth 1159 def Eto
19. TOC Sections and subsections are printed exactly as in the default except for the subsections of one specific user chosen sec tion and except for the color of the section numbers with no need to specify explicitely any length font or other formatting instructions But we had to examine the scrartcl sources to determine what to use for leftskip and rightskip for our customized sec tion entries 19 The TOC as a tree Using tikz and the package forest we shall display the table of contents of this part as a tree The technique is to use the etoc modified command tableofcontents not for typesetting but to prepare a macro or rather here a token list variable with all the instructions to be executed later LESLIE Lamport s book has no mention whatsoever of token lists and ATEX gives the impression to not really expect the general user to ever hear about them or delimited macros this whole section and the next are thus for advanced users Putting the etocnumber and etocname commands in treetok would be of no use to which number or name would they then refer to in a delayed execution We need to store not the macro names but the macro contents And also we wish to maintain the correct hyperref hyperlinks The hyperlink information put by etoc in 4nttp ctan org pkg pgf Shttp ctan org pkg forest 16This manual up to the version of May 14 2013 used package tikz qtree but there were problems with hyperlinks No s
20. csname Etoc 1 endcsname Etoc minusone 55 expandafter let csname Etoc 0 endcsname Etoc zero 56 expandafter let csname Etoc 1 endcsname Etoc one 57 expandafter let csname Etoc 2 endcsname Etoc two 58 expandafter let csname Etoc 3 endcsname Etoc three 59 expandafter let csname Etoc 4 endcsname Etoc four 60 expandafter let csname Etoc 5 endcsname Etoc five 61 expandafter let csname Etoc 6 endcsname Etoc six 62 let Etoc all Etoc five 63 let Etoc none Etoc minf placeholder for comments 64 let Etoc levellist empty 65 def Etoc newlevel 1 66 def Etoc levellist elt noexpand Etoc levellist elt noexpand 67 edef Etoc levellist Etoc levellist Etoc levellist elt 1 68 def etocsetlevel 1 2 69 expandafter Etoc newlevel csname 1 1 endcsname 70 ifcase 2 relax 71 expandafter let csname Etoc 1 endcsname Etoc zero 72 expandafter let csname Etoc 1 endcsname Etoc zero 73 or 74 expandafter let csname Etoc 1 endcsname Etoc one 75 expandafter let csname Etoc 1 endcsname Etoc one 76 or 77 expandafter let csname Etoc 1 endcsname Etoc two 78 expandafter let csname Etoc 1 endcsname Etoc two 79 or 80 expandafter let csname Etoc 1 endcsname Etoc three 81 expandafter let csname Etoc 1 endcsname Etoc three 82 or 83 expandafter let csname Etoc 1 endcsname Etoc four 84 expandafter let csname Etoc 1 endc
21. document but the numbering itself is from the order of the TOCs in the source of this document 20 contents this provides most of the time a better link destination than any counter manip ulated from inside etocaftertitlehook for which the link would target the area just after the title So rather than including refstepcounter visibletoc inside etoc aftertitlehook we just put there stepcounter visibletoc followed by the com mand etoctoccontentsline visibletoc thevisibletoc This etoc command etoctoccontentsline level_name name has the same effect as addcontentsline toc level_name name but its usefulness is to circumvent the patching for automatic creation of bookmarks done to addcontentsline by the hyperref package as pdf bookmarks don t make much sense here and would elicit a complaint of hyperref that the bookmark level is unknown Finally the preamble of the document did etocsetlevel visibletoc 6 The level 6 or anything with a higher number is ignored even if tocdepth has value 10 for exam ple this is independently of whether etoc uses the document class default line styles or its own line styles or the ones defined by the user with the etocsetstyle command So there is no need to worry that something could go wrong Then only here we have set etocsetlevel visibletoc 0 And to display only this kind of entries we assign temporarily to part and chapter level 1 or any thi
22. etoc startlocaltoc gobble 1 07g suppresses the printing of unknown etoc ref run latex again as sometimes one uses localtableofcontents to prepare something else and one does not want any text output even in intermediate runs Also 1 07g adds etocaftertochook to help with invisiblelocaltableofcontents and then I did etocsetnexttocdepth 1 07h makes the hook used by etocsetnexttocdepth pri vate 511 def Etoc localtableofcontents 1 512 edef Etoc tmp 1 513 ifnum Etoc tmp lt ne 514 PackageWarning etoc 515 Unknown toc id run LaTeX to get references right 516 let Etoc next gobble else let Etoc next firstofone fi 517 Etoc next 518 edef etoc startlocaltoc 1 519 noexpand etoc startlocaltoc 1 1 520 Etoc localtoctrue 521 let Etoc localtop Etoc minustwo 522 global Etoc stoptocfalse 523 global Etoc notactivetrue 524 Etoc tableofcontents 525 endgroup ifEtoc mustclosegroup endgroup fi 526 Etoc aftertochook 1 97h 527 etocaftertochook 1 07g 528 2013 03 07 I discover a namedef trick to construct the Etoc again space delimited macro namedef Etoc again stuff Original version was copied from analogous stuff in source2e def 1 Etoc again expandafter gdef 1 stuff and in the end now that I think about it I simply use firstofone 529 def Etoc getrefno 1 2 etoc 1 530 def Etoc getref 1 ifundefined r 1 0 expandafter expandafter ex
23. etocpage this last one will have a link only if hyperref was passed option linktoc all 21 2 The etocskipfirstprefix command The chosen subsubsection style also uses the command etocskipfirstprefix which if present must be the very last one in the start code It instructs to not use for the first item the specified prefix code With this style one would have to be imaginative to design something then for para graph and subparagraph entries perhaps as superscripts Well usually one does not need paragraphs and subparagraphs numbered and listed in the TOC so our putative user here chose a design where no provision is made for them and added the definitive etocsetstyle paragraph etocsetstyle subparagraph This is also the situation with the default package line styles 21 3 The etocnumber command So far our specifications would use the numbering generated by the enumerate environ ments but of course we generally want the actual numbers as found in the toc file This is available via the etocnumber command To get the labels in the enumerate list to use it we can proceed with the syntax label from the package enumi tem etocsetstyle section begin enumerate label etocnumber normalsize bfseries rmfamily item etocname page etocpage end enumerate Rather than just etocnumber we then used something like fbox etocnumber Note that etocnumber is a robust command whic
24. example one may wish to use the unit or page number in some kind of numeric context or change its formatting This is provided by etocthename etocthenumber and etocthepage These commands are not protected so in moving argument contexts for example in a label specification they should be preceded by protect 21 5 The etoclink command The command etoclink linkname can be used in the line style specifications in a manner analogous to the argument less commands etocname etocnumber and etoc page It creates a link if such a link was added by hyperref to the toc file entry whose destination is the corresponding document unit and whose name is the given ar gument Hence etoclink etocthename is like the original etocname Notice that if hyperref was not instructed to put a link in the page number via its option linktoc al then etoc s etocpage contains no link either but etoclink etocthepage does The command etoclink is robust 1995 seen we use fcolorbox rather than fbox Due to some redefinition made by package xcolor had we used fbox and not used hyperref we would have needed protect fbox 34 21 6 The etocthelinkedname etocthelinkednumber etocthelinkedpage and etocthelink commands 21 6 The etocthelinkedname etocthelinkednumber etocthelinkedpage and etocthelink commands This is for advanced uses by advanced users The etocthename macro has been men tioned before using it in instr
25. from the source file with timestamp 18 05 2014 at 11 51 45 CEST CONTENTS Part III Surprising uses of etoc The TOC of TOCS 15 p 20 Arbitrary Lists Of etoctoccontentsline 16 p 22 A TOC with a fancy layout 17 p 23 Another compatibility mode 18 p 24 The TOC as a tree e e 19 p 26 The TOC as a molecule 20 p 29 Part IV Commande for the toc line styles The etocsetstyle command 21 p 32 The etocname and etocpage commands The etocskipfirstprefix command The etocnum ber command The etocthename etocthenumber and etocthepage commands The etoclink command The etocthelinkedname etocthelinkednumber etocthelinkedpage and etocthe link commands The etocsetlevel command 22 p 35 Scope of commands added to the toc file 23 p 36 Testing the scope This is a pale red subsection for illustrative purposes Am l also red a 2A 37 Part V Commande for the toc display style Specifying the toc display style 25 p 38 The command etocsettocstyle The commands EE etocmulticol and etoc localmulticol The commands etocruledstyle etocruled and etoclocalruled The commands etocframedstyle etocframed and etoclocalframed Hea
26. inline display Setting up local styles Setting up toc display styles Displaying tables of contents Labels and references Customizing the etoc pre defined line styles Customizing the toc display styles Hacking framed parboxes Interverting the levels All subsections of this document Dis playing statistics Using depth tags Typesetting the TOC as a table Compatibility with other packages TRXnical matters Errors and catastrophes 44 Part VI Using and customizing etoc Here are some statistics for this part it contains 4 sections and 6 subsections The name of the first section is Summary of the main style commands and the corresponding number is 28 The name of the last section is One more example of colored TOC layout and its number is 31 The name of the first subsection is Setting up local styles and the corresponding number is 28 1 The name of the last subsection is Customizing the toc display styles and its number is 30 2 Summary of the main style commands 28 p 45 Setting up local styles 28 1 p 45 Setting up toc display styles eo lt 22 28 2 p 45 Displaying tables of contents 28 3 p 46 Labels and references 28 4 p 46 The package default line styles etoc defaultlines 29 p 46 Customizing etoc 30 p 50 Customizing the etoc pre defined line styles 30 1 p 50 Customizing the toc display styles 30 2 p 51 One more exa
27. just wants to keep the same layout as in the default one may question why using etoc there is one good reason numbers and names are separately hyperref links whereas normally there is only one link holding both the number and the name corresponding to one toc entry 13For the memoir class one needs a bit more each of the command booknumberline partnumber line and chapternumberline will have to be saved with a let and one then specifies etocsetstyle chapter savedchapterline savedchapternumberline etocnumber etocname etocpage and analogously for part respectively book 25 19 The TOC asa tree This example only has sections and subsections and the code used in MyStandardTOC was etocsetstyle section ifnum etocthenumber 3 etocsetstyle subsection par nopagebreak begingroup leftskip1 5em rightskip tocrmarg parfillskip flushglue parindent Opt normalfont normalsize rmfamily itshape columnseplem begin minipage dimexpr linewidth leftskip rightskip relax begin multicols 2 etocskipfirstprefix allowbreak etocname textup etocnumber par endgroup par end multicols end minipage par endgroup else etocsetstyle subsection savedsubsectionline numberline etocnumber etocname etocpage 3 fi savedsectionline numberline color cyan etocthenumber etocname etocpage 3 Notice the page head mark added by this standard
28. newcommand etocabbrevpagename p initial of page newcommand etocpartname partname utilisateurs de frenchb attention car donne partie sans majuscule newcommand etocbookname Book to be modified according to language No customizing of the standard line styles is possible from within etoc As already explained when etocstandardlines has been issued the package just makes itself very discrete and acts only at the global level and the TOC entries are hopefully formatted as would have happened in the absence of etoc The etocstandardlines compatibility mode will work also with sectioning com mands made known to etoc via etocsetlevel under the condition of course that these sectioning commands are accompanied with all the relevant definitions for typesetting toc entries in the IATEX default manner existence of the macros 1 something Using the command etocsetstyle be it in the preamble or in the body of the docu ment has the secondary effect of switching off the compatibility mode 40with the KOMA script classes we noticed that etocstandarddisplaystyle was apparently needed for the KOMA options toc left to be active at the level of the line entries 50 30 2 Customizing the toc display styles 30 2 Customizing the toc display styles Again we list the relevant macros what they do should be legible from their names Note that renewcommand s and not setlength s have to be used for what ap
29. specify a style for parts too we defined a subsubsection line style but as it turns out there are no subsubsections in this part The two commands used are etocsetstyle for specifying the line styles and etocruledstyle for the TOC global style The rightskip is shared by all and creates space where the page numbers get printed For an elaboration of this technique see the next section 6 as well as subsection 32 5 which provides a TOC with parts and paragraphs Both allow multi line headings and employ a technique for putting page numbers in the right margin which was inspired from what BTIEX2e s dottedtocline macro does begingroup parindent Opt parfillskip Opt leftskip Ocm rightskip 1cm etocsetstyle section 1 leavevmode leftskip cm relax bfseries normalsize makebox 5cm 1 etocnumber etocname nobreak hfill nobreak rlap makebox 1cm mdseries etocpage par 1 etocsetstyle subsection 1 leavevmode leftskip 5cm relax mdseries normalsize makebox 1cm 1 etocnumber etocname nobreak hfill nobreak rlap makebox 1cm etocpage par 1 etocsetstyle subsubsection 1 leavevmode leftskip 1 5cm relax mdseries normalsize makebox 1cm 1 etocnumber etocname nobreak hfill nobreak rlap makebox 1cm etocpage par 1 etocruledstyle 1 bfseries Large My first etoc TOC of autoref part overview nameref part overview tableofcontents ref toc overview endgroup 6 A sec
30. tableofcontents endgroup 32 6 Typesetting the TOC as a table Tabular cells create groups definitions of etocname etocnumber etocpage made by etoc are local thus if the first cell of a row is where the toc file line is read and etocname and etocnumber get defined these definitions will be lost after the tabulation character amp The source code of etoc does allow the begin and finish parts of the line styles to open or close groups but the possibility of a group closed by a amp for example in the prefix part of the line style is not anticipated Another similar matter regards the redefinition of contentsline made by etoc each time it typesets a TOC It is done after the first argument to etocsettocstyle has been executed hence if this argument opens a tabular the etoc redefinition of contentsline will be done in the first cell of the first row and get lost thereafter Thus one can not typeset a TOC directly as a tabular with the opening and closing specified via etocsettocstyle and using amp and inside the level styles The etoc source code could be modified to make some relevant definitions global but I decided against it Typesetting as a tabular or rather longtable will appeal only to advanced users and advanced users can employ the technique explained in section 19 Here is an example giving again a fully hyperlinked table of contents The code follows after the table TABLE OF CONT
31. the automatic par automatically before the TOC etocsettocstyle etocsetnexttocdepth 2 localtableofcontents to be used at the top level of a Part endgroup And now the variant with macros rather than boxes this variant as it stands here is for using within a section makeatletter newcommand firstsubname newcommand lastsubname newcommand firstsubnumber newcommand lastsubnumber newcommand thisspecialstatsaux newcommand thisspecialstats setcounter mycounti 0 def thisspecialstatsaux let firstsubname etocthelinkedname let firstsubnumber etocthelinkednumber def thisspecialstatsaux begingroup etocsetstyle subsection thisspecialstatsaux stepcounter mycounti let lastsubname etocthelinkedname 57 32 and tricks let lastsubnumber etocthelinkednumber Here are some statistics for this section It contains arabic mycounti subsections The name of its first is emph firstsubname and the corresponding number is firstsubnumber The name of the last subsection is emph lastsubname and its number is lastsubnumber etocsettocstyle etocinline etocsetnexttocdepth 1 localtableofcontents to be used within a section endgroup makeatother 32 5 Using depth tags We want a TOC which will have a heading for each part except the last part with the code source which we decide not to include and will additionally open up P
32. using etoc default line styles but with sections as chapters and subsections as sections 711 etocdefaultlines etocsetnexttocdepth 1 begingroup etocsetlevel section 0 etocsetlevel subsection 1 renewcommand etocfontone normalfont normalsize renewcommand etoctoclineleaders hbox normalfont normalsize hbox to lex hss hss sloppy tableofcontents endgroup This is the global table of contents on two columns us ing etoc default line styles but with sections as chap ters and subsections as sections Abstract 4 Line styles and toc display style 1 Foreword etocsetstyle for the line styles CITE TON TO O RIO 4 1 p 7 2 License installation etocsettocstyle for the toc display CORE 300 a pa e m e 4 2 p 7 Part I Overview Compatibility mode 4 3 p 8 3 Do I need to be a geek to use f etoc 5 A first example Limitations in the use of list environments for tables of contents 3 1 0 6 6 A second example 47 29 The package default line styles etocdefaultlines 7 Linked list of the main package commands Part II Arbitrarily many TOCs and local ones too 8 Labeling and reusing elsewhere 9 A powerful functionality of etoc the re assignment of levels with etocsetlevel 10 The etocsettocdepth and etoc setnexttocdepth commands The hyperref option bookmarksdepth EE reni a Au 10 1 p 15 11 The command etocsettoc depth toc The
33. we have few sub sub sections and it is more interesting to drop them and print in a visually different manner sections and subsections 23 Scope of commands added to the toc file 23 1 Testing the scope Let us switch to the color red and also add this command to the toc file color red 50 changing text color addtocontents toc string color red 50 and also in the toc file 36 23 2 This is a pale red subsection for illustrative purposes 23 2 This is a pale red subsection for illustrative purposes Actually this title here was printed black due to the way the scrartcl class works it would have been red in the article class but we are more interested in how it looks in the tables of contents it does appear red in the main table of contents at the beginning of this document and also in the table of contents for this part Both entries obey as expected the color red 50 command inserted in the toc file But let us now close this subsection and start a section 24 Amlalso red The question is about how it appears in the tables of contents the answer is that yes it is red in the main TOC and no it is not red in the local TOC for this part The reason is that the finish code for the subsection level closed a group as it used end enumerate This illustrates the discussion from subsection 3 1 The default package line styles do not contain group opening and closing instructions the influ ence of a
34. xt linewidth color begingroup etocbottomrulecolorcmd 924 leaders etocbottomrule hss color endgroup 925 addvspace etocbelowtocskip placeholder for comments 926 newcommand etoc multicoltoc 2 etocdefaultnbcol 927 etocmulticolstyle 1 2 928 tableofcontents 929 newcommand etoc multicoltoci 2 etocdefaultnbcol 930 etocmulticolstyle 1 2 931 tableofcontents 932 newcommand etoc local multicoltoc 2 etocdefaultnbcol 933 etocmulticolstyle 1 2 934 localtableofcontents 935 newcommand etoc local multicoltoci 2 etocdefaultnbcol 936 etocmulticolstyle 1 2 937 localtableofcontents placeholder for comments 938 newcommand etoc ruledtoc 2 etocdefaultnbcol 939 etocruledstyle 1 2 940 tableofcontents 941 newcommand etoc ruledtoci 2 etocdefaultnbcol 942 etocruledstyle 1 2 943 tableofcontents 944 newcommand etoc local ruledtoc 2 etocdefaultnbcol 945 etocruledstyle 1 2 946 localtableofcontents 947 newcommand etoc local ruledtoci 2 etocdefaultnbcol 948 etocruledstyle 1 2 949 localtableofcontents placeholder for comments 950 newcommand etoc framedtoc 2 etocdefaultnbcol 951 etocframedstyle 1 2 952 tableofcontents 953 newcommand etoc framedtoci 2 etocdefaultnbcol 954 etocframedstyle 1 2 955 tableofcontents 956 newcommand etoc local fra
35. AtEndDocument PackageWarning etoc 1121 Please load tocloft before etoc fi 1122 cftnctoctrue 1123 1124 3 1125 3 1126 placeholder for comments 1127 def Etoc addtocontents 1 2 1128 ifEtoc hyperref 1129 addtocontents toc protect contentsline 1130 1 2 1131 thepage currentHref 1132 else 1133 addtocontents toc protect contentsline 1134 1 2 thepage 1135 fi 1136 def Etoc addcontentsline 1 2 3 1137 namedef toclevel 1 3 1138 addcontentsline toc 1 2 1139 DeclareRobustCommand etoctoccontentsline 1140 ifstar Etoc addcontentsline Etoc addtocontents All the following added for version 1 07g 2013 10 13 Motivated by a demand about tovsec2 But it is impossible to make tocvsec2 compatible if not re doing all toc macros in tocvsec2 v1 3 2011 08 07 I do not retain the stack idea which does not convince me as useful The empty line in the toc file is put there by tocvsec2 see its code line 143 I take this opportunity to add to the start of the toc file let etoc startlocaltoc gobble in case etoc is not detected I should possibly have done that long ago like I did in tableof In 1 07h I decide that I should not have used Etoc but etoc for Etoc settocdepth So I now use lowercase and add a temporary line for transition in the very improbable situation that someone actually did already use the just released 1 079
36. ENTS Abstract Foreword License installation Overview Do I need to be a geek to use etoc 3 1 Limitations in the use of list environ ments for tables of contents 4 Line styles and toc display style 7 w N 53 2 2 W 60 32 6 Typesetting the TOC as a table 4 1 etocsetstyle for the line styles 7 4 2 etocsettocstyle for the toc dis 7 play 4 3 Compatibility mode 8 5 A first example 8 6 A second example 9 7 Linked list of the main package commands 11 II Arbitrarily many TOCs and local ones too 12 8 Labeling and reusing elsewhere 12 9 A powerful functionality of etoc the re 13 assignment of levels with etocsetlevel 10 The etocsettocdepth and etocsetnext 14 tocdepth commands 10 1 The hyperref option bookmarksdepth 15 11 The command etocsettocdepth toc 15 11 1 The commands etocobeytoc 16 tocdepth and etocignoretoc tocdepth 12 The commands etocdepthtag toc and 16 etocsettagdepth 12 1 The commands etocobeydepth 16 tags and etocignoredepthtags 13 Adding commands to the toc file 17 13 1 The hyperref option hidelinks 17 14 Two Examples 18 14 1 A Beautiful Thesis example 18 14 2 A TOC with a background color 19 III Surprising uses of etoc 20 15 The TOC of TOCs 20 16 Arbitrary Lists Of etoctoccon 22 tentsline 17 ATOC witha fancy layout 23 18 Another compatibility mode 24 19 The TOC as a tree 26 20 The TOC as a
37. The etoc package JEAN FRANGOIS BURNOL jfbu at free dot fr Package version v1 071 2014 04 22 TABLE OF CONTENTS Abstract Gus RRS RH RE A a daa eaw POS Foreword 1 p 3 License installation 2 pi Part Overview Do I need to be a geek to use etoc awa da Bypp 6 Limitations in the use of list environments for tables of contents Line styles and toc display style 4 p 7 etocsetstyle for the line styles etocsettocstyle for the toc display Compatibility mode A first example e 5 p 8 A second example 6p 9 Linked list of the main package commands 7 p 11 Part II Arbitrarily many TOCs and local ones too Labeling and reusing elsewhere 8 p 12 A powerful functionality of etoc the re assignment of levels with etocsetlevel 9 p 13 The etocsettocdepth and etocsetnexttocdepth commands 10 14 The hyperref option bookmarksdepth The command etocsettocdepth toc ew 11 p 15 The commands etocobeytoctocdepth and The commands etocdepthtag toc and etocsettagdepth 12 0 16 The commands etocobeydepthtags and etocignoredepthtags Adding commands to the toc file a 13 p 17 The hyperref option hidelinks Two Examples e 14 p 18 A Beautiful Thesis example A TOC with a background color Documentation 2014 04 29 generated
38. ableofcontents ref toc globalcmds endgroup 22 The etocsetlevel command As already explained in Part III one can inform etoc of a level to associate to a given sectioning command with etocsetlevel For example etocsetlevel cell 0 etocsetlevel molecule 1 etocsetlevel atom 2 etocsetlevel nucleus 3 In compatibility mode it will be assumed that the macros 1 ce11 1 molecule have been defined somewhere either by the user or a class doing only etocsetlevel is not enough for the corresponding level to work out of the box in compatibility mode However if no table of contents is typeset in compatibility mode then all that mat ters is that the various line styles have been set If for example section is at level 1 then there is no need to do some etocsetstyle molecule after 35 23 Scope of commands added to the toc file etocsetlevel molecule 1 if etocsetstyle section has al ready been done and it has been done by the package itself in its definition of its own line styles The accepted levels run from 2 to 6 inclusive Anything else is mapped to 6 which is a dummy level never displayed The package does etocsetlevel book 2 etocsetlevel part 1 etocsetlevel chapter 0 etocsetlevel section 1 etocsetlevel subsection 2 etocsetlevel subsubsection 3 etocsetlevel paragraph 4 etocsetlevel subparagraph 5 etoc own custom styles are activated
39. ableofcontents done by tocloft at begin document As long as etoc is left in compatibility mode the customization done by tocloft will be obeyed for both the line styles and the TOC title One may still benefit from the depth tags man agement by etoc from its localtableofcontents from its label ref mechanism One may use etocsetstyle to define via etoc the layout for one TOC and then use rather tocloft for another one if tableofcontents follows etocstandardlines and etocstandarddisplaystyle In this compatibility mode etocsetlevel divi sion unit 6 will render invisible the chosen division level but exchanging levels is otherwise not possible One should load etoc after tocloft A warning is issued if otherwise Release 1 071 has also improved the compatibility with the memoir class its appendix level has been made known to etoc It is at the same level as chapter thus the chapter line style should possibly do a test for some user defined boolean whose activation may be added to the toc file at the suitable location via addtocontents toc if one needs to distinguish the two kinds of divisions The contents of the toc file if it already exists are read into memory by etoc once at the time of usepackage etoc The toc file remains available to other packages for read operations until the location of the first table of contents at which time a write stream is opened by etoc and from that point the file is era
40. amed al http ctan org pkg tcolorbox 22this command etocoldpar working par in the argument to etocmulticolstyle is not related to the switch etocinline whose purpose is to tell etoc not to do a par before the table of contents 40 25 7 The command etocinline 25 7 The command etocinline With etocinline or its synonym etocnopar the tableofcontents command and its variants do not first issue a par to close the previous paragraph Hence the table of contents can be printed in an inline style or if used only for preparing some token list or macro it will leave nothing in the token stream on execution 26 Starred variants of the tableofcontents etc commands The tableofcontents localtableofcontents etocmulticol and all their cousins and variants have starred variants the star must be before the other arguments For all but the memoir class they are like the original For the memoir class the original prints an entry in the toc file as is the usage for the original tableofcontents command in that class whereas the starred variants do not as is the habit in that class As soon as one starts using local table of contents one discovers that the default memoir thing which is to create a chapter entry for each TOC is not convenient The command etocmemoirtoctotocfmt kind name will change the format kind is chapter section subsection and name can be for example contentsname The initial set
41. and p 33 31 21 The etocsetstyle command 21 3 The etocnumber command p 33 21 4 The etocthename etocthenumber and etocthepage commands p 34 21 5 The etoclink command p 34 21 6 The etocthelinkedname etocthelinkednumber etocthelinkedpage and etoc thelink commands p 35 The etocsetlevel command page 35 Scope of commands added to the toc file page 36 23 1 Testing the scope p 36 23 2 This is a pale red subsection for illustrative purposes p 37 Am also red page 37 21 The etocsetstyle command 21 1 The etocname and etocpage commands Let us explain how etoc was used to produce the table of contents displayed at the be ginning of this second part This is a local table of contents and we used the command localtableofcontents We shall distinguish between the line styles and the toc display style The line styles were essentially obtained in the following manner etocsetstyle section begin enumerate normalsize bfseries rmfamily item etocname page etocpage end enumerate etocsetstyle subsection begin enumerate normalfont item etocname p etocpage end enumerate etocsetstyle subsubsection par nobreak begingroup normal font footnotesize itshape etocskipfirstprefix allowbreak etocname hfil par endgroup pagebreak 3 These provisory style definitions rely on the automatic numbering generated by the en
42. art V up to paragraphs To achieve this we added to this source various etocdepthtag toc com mands and it remains now to set the levels for each tag using etocsettagdepth this was used earlier in this document in section 6 within a group hence it did not affect the other tables of contents However the package line styles do not display paragraphs and the standard line styles of the document class give too much vertical spacing in this context when displaying a Part heading in the TOC So we cook up our own quickly designed line styles in the style of section 5 but with a way to put page numbers on the right which is more like the method used by KIEX2e s dottedtocline and multi line headings now leave empty the area underneath the numbers contrarily to the code from section 5 And after a few minutes for choosing lengths now that this has been done once it can be recycled easily we get A TOC using depth tags ben I Overview 6 II Arbitrarily many TOCs and local ones too 12 III Surprising uses of etoc 20 IV Commands for the toc line styles 31 V Commands for the toc display style 37 25 Specifying the toc display style anan 38 25 1 The commandketocsettocstvle 38 25 2 The commands etocmulticolstyle etocmulticol and Vetoclocalmlticol ei 38 25 2 1 The command etoctocstyle 39 25 2 1 1 etoctocstylewithmarks
43. ated in this manual etoc is quite versatile especially as it allows to re define at any point in the document the hierarchy of sectioning units and one can achieve surprising effects with it Part III is devoted to this and some more is to be found in Part VII A very important aspect of etoc is that it is geared towards making many TOCs in the same document using only one toc file The present documentation contains 36 visible tables of contents and a few invisible ones and uses only one toc file So one should think twice before adding manually extra commands to the toc file see section 13 3 1 Limitations in the use of list environments for tables of contents There are some limitations to the use of list environments for typesetting TOCs One of them is intrinsic to the scope limitations created by the groups associated to the environ ments the toc file may contain besides the information to be typeset in the TOCs some http ctan org pkg enumitem and the counting itself has been achieved by a table of contents which was inserted in the framed paragraph the technique for this kind of effect will be explained later other commands such as language changing commands which do not expect to see their scope limited in this way inside a group IAT X s environments create groups Therefore the built in line styles proposed by etoc as an example and which are illustrated by the main table of
44. ax and not let etocbkgcolorcmd relax Regarding the dimensions of the top rule they can be specified in ex s or em s as in this example renewcommand etoctoprule hrule height lex The package code is done in such a manner that it is the font size in instance at the end of typesetting the title argument to etocruledtoc or etocframedtoc which will be used for the meaning of the lex Of course also the other rule commands can have their dimensions in font relative units but their values are decided on the basis of the font in effect just before the table of contents The top and bottom rules do not have to be rules and can be horizontal leaders of a specified height in the general TEX sense However the left and right rules are not used as 51 31 One more example of colored TOC layout horizontal leaders but as objects of a given specified width Note that only the Plain TEX syntax for rules is accepted here 31 One more example of colored TOC layout The command etocframedstyle puts the title on the top rule in a centered position This is not very convenient for this example so we included the title as part of the start code at section level to get it inside the frame begingroup definecolor subsecnum RGB 13 151 225 definecolor secbackground RGB 0 177 235 definecolor tocbackground RGB 212 237 252 renewcommand etocbkgcolorcmd color tocbackground renewcommand etocleftrulecolorcmd color t
45. bal Etoc iifalse global Etoc itrue or global Etoc vfalse global Etoc ivfalse global Etoc iiifalse global Etoc iitrue or global Etoc vfalse global Etoc ivfalse global Etoc iiitrue or global Etoc vfalse global Etoc ivtrue or global Etoc vtrue else Etoc 1 endcsname Etoc six 141 ifnum 1 m ne 142 global Etoc vfalse 143 global Etoc ivfalse 144 global Etoc iiifalse 145 global Etoc iifalse 146 global Etoc ifalse 147 global Etoc false 148 global Etoc jtrue 149 else 150 global Etoc vfalse 151 global Etoc ivfalse 152 global Etoc iiifalse 153 global Etoc iifalse 154 global Etoc ifalse 155 global Etoc false 156 global Etoc jfalse 157 global Etoc jjtrue 158 fi 159 fi placeholder for comments 160 AtBeginDocument 161 ifpackageloaded parskip Etoc parskiptrue 162 ifpackageloaded hyperref Etoc hyperreftrue 163 def Etoc et hop 1 2 3 4 5 1 3 4 5 2 164 long def Etoc gobblesixorfive 1 2 3 4 5 6 165 def Etoc et hop 1 2 3 4 1 3 4 2 166 long def Etoc gobblesixorfive 1 2 3 4 5 167 placeholder for comments 168 def Etoc swa 1 169 Etoc et hop 170 Etoc savedcontentsline 1 171 Etoc prefix Etoc contents 172 def Etoc swb 1 173 Etoc et hop 174 Etoc savedcontentsline 1 175 Etoc contents 176 let etocskipfirstprefix thirdofthree placeholder for comments 177 def Etoc etoccontentsline 1 178 global expandaft
46. bility mode in order to achieve effects like the following all things being otherwise equal to the document class defaults 1 get the hyperref link to encapsulate only the names but not the numbers of each entry of the table of contents 2 use the document class style for chapters and sections but modify it only for sub sections 3 do either of the above only for some portions of the table of contents Here is how to proceed One puts in the preamble makeatletter newcommand MyStandardTOC begingroup let savedpartline l part let savedchapterline l chapter remove if article scrartcl class let savedsectionline l section let savedsubsectionline l subsection and so on if subsubsection etc is used for the book or article classes etocsetstyle part savedpartline etocnumber hspace lem etocname etocpage for the scrbook or scrartcl classes etocsetstyle part 24 Contents savedpartline numberline etocnumber etocname etocpage identical in book article scrbook scrartcl classes etocsetstyle chapter only for book and scrbook savedchapterline numberline etocnumber etocname etocpage etocsetstyle section savedsectionline numberline etocnumber etocname etocpage etocsetstyle subsection savedsubsectionline numberline etocnumber etocname etocpage etc if further sectioning units are used see the text for what to do w
47. ble the package will be at begin document in this compatibility mode hence just adding usepackage etoc should hopefully not change anything to the look of a previously existing document under the article book report scrartcl scrbook scrreprt and memoir classes Any use of etocsetstyle in the preamble or body of the document turns off from that point on the compatibility mode for line styles but maintains the compatibility mode for the TOC title One re activates the compatibility mode for line styles with etocstan dardlines and etoctoclines will re activate the line styles as defined with the help of etocsetstyle if their scope was not limited to a group or environment The command etocdefaultlines resets the line styles as pre defined internally by etoc and described in section 29 Even if etocsetstyle has been used the global display style remains initially as de fined by the document class or the tocloft package one needs to use the command etocsettocstyle or its variants to exit from this compatibility mode at the toc display style level It will be re activated if use if made of etocstandarddisplaystyle 5 A first example Let us present a first example of specification for line styles Immediately after the start of Part I we inserted in the source file invisiblelocaltableofcontents label toc overview This sets up the label toc overview and we can use it at any location in the document tableofcontents
48. ble to run latex pdflatex directly on etoc dtx DL 85 SL BL IL s L Bf s IL L IL s N s KM KL KL s KR L LL se se se se se se se At least three ways to produce etoc pdf method 3 is preferred 1 latex etoc dtx three times then dvips then ps2pdf 2 pdflatex etoc dtx three times 3 latex etoc tex three times then dvipdfmx Method 3 produces the smallest pdf files Options can be set in etoc tex scrdoc class options paper size font size with or without source code with dvipdfmx or with latex dvips or pdflatex To produce etoc DE pdf German documentation run tex on etoc ins or etoc dtx to produce etoc DE tex then compile etoc DE tex with latex thrice then dvipdmx or set first to 0 Withdvipdfmx in etoc DE tex to allow compilation with pdflatex Um etoc DE pdf zu erzeugen ist latex dreimal mit etoc DE tex laufen zu lassen dann dvipdfmx mit etoc DE dvi Im Falle von Problemen mit dvipdfmx ist Withdvidpdfmx auf 9 in etoc DE tex zu setzen dann ist pdflatex dreimal mit etoc DE tex laufen zu lassen Installation etoc sty gt TDS tex latex etoc etoc sty etoc dtx gt TDS source latex etoc etoc dtx etoc pdf gt TDS doc latex etoc etoc pdf etoc DE pdf gt TDS doc latex etoc etoc DE pdf The other files may be discarded 3 Do need to be a geek to use etoc Part Overview Here are some statistics for this part it contains 5 sections and 4 subsections The name of the fir
49. by etocdefaultlines They are illustrated by the main table of contents of this document These level assignments can be modified at anytime see Part III for various applications of this technique As one further example let s mention here that the main table of contents of this document was typeset following these instructions etocsettocdepth subsubsection set the initial tocdepth etocdefaultlines use the package default line styles At this early stage in the document they had not yet been modified by etocsetstyle commands so etoctoclines could have been used too etocmarkboth contentsname etocmulticolstyle 1 one column display pdfbookmark 1 Table of contents MAINTOC create a bookmark in the pdf noindent bfseries Large leaders hrule heightipt hfill MakeUppercase Table of Contents begingroup use a group to limit the scope of the etocsetlevel subsection 3 subsection level change etocsetlevel subsubsection 4 anything gt tocdepth 3 tableofcontents label toc main endgroup In this way the subsections used the style originally designed for subsubsections the sub subsections were not printed Without this modification the appearance would have been very different the package line styles were targeted to be employed in documents with many many sub sub sections in a two column layout giving thus a more compact output that what is achieved by the default IST X table of contents But here
50. c set toctocdepth 1 1160 ifundefined Etoc 1 1161 PackageWarning etoc 1162 Unknown sectioning depth 1 protect etocsettocdepth toc ignored 1163 addtocontents toc 1164 protect etoc settocdepth expandafter protect csname Etoc 1 endcsname 1165 1 07h adds the depth tags and an even more general mechanism could be added at some point we could insert action tags and have the user map them to arbitrary commands For the time be ing we just provide etocdepthtag toc name and etocsettagdepth tag_name level where level is numeric or alphabetical The numeric level 3 is now again not accepted by etocsetlevel it can be used with etocsettagdepth which accepts equivalently none 1166 def etocdepthtag 1 Etoc depthtag etocdepthtag toc name 1167 def Etoc depthtag 1 addtocontents toc protect etoc depthtag 1 1168 def etocignoredepthtags let etoc depthtag gobble 7 1169 def etocobeydepthtags let etoc depthtag Etoc depthtag 1170 def Etoc depthtag 1 ifundefined Etoc depthof 1 1171 ignore in silence if tag has no associated depth 1172 afterassignment Etoc nottoodeep 1173 global c tocdepth csname Etoc depthof 1 endcsname 1174 1175 def etocsettagdepth 1 2 ifundefined Etoc 2 0 1176 PackageWarning etoc 1177 Unknown sectioning depth 2 protect etocsettagdepth space ignored 1178 namedef Etoc depthof 1 nameuse Etoc 2 1179
51. c setstyle five 467 else 468 def Etoc levellist elt 1 let 1 Etoc lxyZ 469 Etoc levellist 470 let booknumberline numberline 471 let partnumberline numberline 472 let chapternumberline numberline 473 fi 474 the Etoc toctoks 475 ifEtoc notactive else 476 ifEtoc v Etoc end five fi 477 ifEtoc iv Etoc end four fi 478 ifEtoc iii Etoc end three fi 479 ifEtoc ii Etoc end two fi 480 ifEtoc i Etoc end one fi 481 ifEtoc Etoc end zero fi 482 ifEtoc j Etoc end minusone fi 483 ifEtoc jj Etoc end minustwo fi 484 fi placeholder for comments 485 def etoc startlocaltoc 1 2 486 let Etoc next relax 487 ifEtoc localtoc 488 ifEtoc notactive 489 ifnum 1 2 relax 490 ifEtoc jj let Etoc localtop Etoc minusone fi 491 ifEtoc j let Etoc localtop Etoc zero fi 492 ifEtoc let Etoc localtop Etoc one fi 493 Ni fEtoc i let Etoc localtop Etoc two fi 494 ifEtoc ii let Etoc localtop Etoc three fi 495 ifEtoc iii let Etoc localtop Etoc four fi 496 ifEtoc iv let Etoc localtop Etoc five fi 497 Ni fEtoc v let Etoc localtop Etoc six fi 498 def Etoc next global Etoc notactivefalse 499 global Etoc vfalse 500 global Etoc ivfalse 77 35 Implementation 501 global Etoc iiifalse 502 global Etoc iifalse 503 global Etoc ifalse 504 global Etoc false 505 global Etoc jfalse 506 global Etoc jjfalse 507 fi 508 fi fi 509 Etoc next 510 let
52. cbaselinespreadminustwo 1 632 def etocbaselinespreadminusone 1 633 def etocbaselinespreadzero 1 634 def etocbaselinespreadone 1 635 def etocbaselinespreadtwo 1 636 def etocbaselinespreadthree 9 placeholder for comments 637 def etocminustwoleftmargin 1 5em plus 0 5fil 638 def etocminustworightmargin 1 5em plus 0 5fil 639 def etocminusoneleftmargin lem 640 def etocminusonerightmargin lem 641 def etoctoclineleaders 642 hbox normalfont normalsize hb xt 2ex hss hss 643 def etocabbrevpagename p 644 def etocpartname partname 645 def etocbookname Book 80 placeholder for comments The macro etocdefaultlines was initially called etoctoclines Now etoctoclines just does Etoc standardfalse Version 1 07e has rewritten entirely the stuff related to penalties and addvspace as this was not satisfactory in the earlier versions which were written at a early stage in the development of the package Actually I am not fully satisfied with these line styles 646 def etocdefaultlines Etoc standardfalse 647 book 648 etoc setstyle minustwo 649 addpenalty M etocskipfirstprefix 650 addpenalty secpenalty 651 begingroup 652 etocfontminustwo 653 addvspace etocsepminustwo 654 parindent z 655 leftskip etocminustwoleftmargin 656 rightskip etocminustworightmargin 657 parfillskip flushglue 658 vbox etocifnumbered etocbookname enspace etocnumbe
53. cfeature toc numberline def nonumberline numberline 1036 tocbasic listhead listoftocname 1037 begingroup expandafter expandafter expandafter 1038 endgroup expandafter 1039 ifx 1040 csname microtypesetup endcsname relax 1041 else 1042 iftocfeature toc noprotrusion 1043 microtypesetup protrusion false 1044 PackageInfo tocbasic 1045 character protrusion at toc deactivated 1046 fi 1047 setlength parskip z 1048 setlength parindent z 1049 setlength parfillskip z plus 1fil 1050 csname tocbasic before hook endcsname 1051 csname tb toc before hook endcsname 1052 csname tb toc after hook endcsname 1053 csname tocbasic after hook endcsname 1054 let etocscrbookstyle etocscrartclstyle 1055 let etocscrreprtstyle etocscrartclstyle placeholder for comments 1056 def etocstandarddisplaystyle etocarticlestyle 1057 newcommand etocmarkboth 1 1058 mkboth MakeUppercase 1 MakeUppercase 1 1059 newcommand etocmarkbothnouc 1 mkboth 1 1 1060 newcommand etoctocstyle 3 section etocmulticolstyle 2 1061 csname 1 endcsname 3 1062 newcommand etoctocstylewithmarks 4 section etocmulticolstyle 2 1063 csname 1 endcsname 3 etocmarkboth 4 1064 newcommand etoctocstylewithmarksnouc 4 section etocmulticolstyle 2 1065 csname 1 endcsname 3 etocmarkbothnouc 4 placeholder for comments 88 1066 de
54. command added to the toc file will propagate until cancelled by another explicit such command inserted in the toc file normalcolor addtocontents toc string normalcolor Back to black Note that this scope problem arises in real life in a multi lingual docu ment as the babel package writes to the toc file the language changes occurring in the document Part V Commands for the toc display style Here are some statistics for this part it contains 3 sections and 10 subsections The name of the first section is Specifying the toc display style and the corresponding number is 25 The name of the last section is Table of contents for this part and its number is 27 The name of the first subsection is The command etocsettocstyle and the corresponding number is 25 1 The name of the last subsection is A crazy inline display and its number is 27 3 25 Specifying the toc display style 38 25 1 The command etocsettocstyle LL 38 25 2 The commands etocmulticolstyle etocmulticol and etoclo CIAIMULTICOL ni ia i ee A Ba he doa ue da A 38 25 3 The commands etocruledstyle etocruled and etoclocalruled 39 25 4 The commands etocframedstyle etocframed and etoclocalframed 39 25 5 Headings titles etocoldpar etocinnertopsep 40 25 6 The compatibility mode etocstandarddisplaystyle 40 25 7 The command etocinline LL 41 37 25 Specifying
55. commands etocobeytoctocdepth and etocignoretoctocdepth E i ea 11 1 p 16 12 The commands etocdepth tag toc and etocsettagdepth The commands etocobeydepthtags and etocignoredepthtags 13 Adding commands to the toc file The hyperref option hidelinks 14 Two Examples A Beautiful Thesis example 14 1 0 18 A TOC with a background color EE 14 2 p 19 Part III etoc Surprising uses of 15 The TOC of TOCs 48 16 Arbitrary Lists Of etoc toccontentsline 17 A TOC with a fancy layout 18 Another compatibility mode 19 The TOC as a tree 20 The TOC as a molecule Part IV Commands for the toc line styles 21 The etocsetstyle command The etocname and etocpage com MANS cina 21 1 0 32 The etocthename etocthenumber and etocthepage commands The etoclink command 21 5 p 34 The etocthelinkedname etocthe linkednumber etocthelinkedpage and etocthelink commands 21 6 0 35 22 The etocsetlevel command 23 Scope of commands added to the toc file Testing the scope 23 1 p 36 This is a pale red subsection for illus trative purposes Lian 232 car 24 Amlalso red Part V Commande for the toc display style 25 Specifying the toc display style The command etocsettocstyle The commands etocmulticolstyle etocmulticol and etoclocalmulti COl ici aliena 25 2 p 38 The commands
56. contents in this document do not make use of environ ments Actually in this user manual only the table of contents at the start of Part IV and the subsection 32 3 which is a TOC have their line styles expressed in terms of enumerate environments 4 Line styles and toc display style A distinction shall be made between the line styles i e the way the name number and page numbers are used at each level and the toc display style for lack of a better name which tells how the title should be set whether an entry in the toc file should be made whether the contents should be typeset with multiple columns etc the latter is governed by the command etocsettocstyle or some higher level commands and the former by the command etocsetstyle 4 1 etocsetstyle for the line styles The command to inform etoc of what to do with etocname etocnumber and etoc page is called etocsetstyle It has five mandatory arguments The first one is the name of the sectional unit a priori known names are book part chapter section subsection subsubsection paragraph and subparagraph and any other name can be declared and assigned to a numeric level via the etocsetlevel command The four other arguments of etocsetstyle specify 1 what to do when this level is first encountered down from a more general one then 2 amp 3 two arguments a prefix and a contents what to do when a new entry of that type is found and 4 the
57. cuted inside a table of contents will enact this change The command etocsettocdepth toc like etocsettocdepth accepts both numeric and named arguments In the case of a named argument the actual numeric value to be used is not yet decided at the time the toc file is created it will be the value cur rently specified for the named level at the time each table of contents not having done etocignoretoctocdepth is typeset The tocdepth counter will never be set to a value finer than its initial value at the start of the table of contents so adding commands etocsettocdepth toc in the document is a way to restrict locally the depth of the table of contents For example to prevent inclusion in the tables of contents of the sub sub sections of a given chapter This gets executed in ALL tables of contents Shttp ctan org pkg tocvsec2 thank D B for drawing my attention to the incompatibility of this package with etoc 15 12 The commands etocdepthtag toc and etocsettagdepth 11 1 The commands etocobeytoctocdepth and etocignoretoctocdepth So etocignoretoctocdepth is provided to cancel the etocsettocdepth toc mech anism when needed and etocobeytoctocdepth will re activate it The package does initially etocobeytoctocdepth 12 The commands etocdepthtag toc and etocsettagdepth As mentioned above when the argument to etocsettocdepth toc isn t numeric but a named level the actual numeric level used i
58. cy layout 23 18 Another compatibility mode 24 19 The TOC as a tree 26 20 The TOC as a molecule 29 15 The TOC of TOCs Here is the numbered and linked list of all tables of contents which are displayed within this document 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 31 32 30 33 34 35 36 And to obtain it here we just wrote Here is the numbered and linked list of all tables of contents which are displayed within this document tableofcontents The preparatory work was the following First we defined a counter visibletoc whose vocation is to get incremented at each displayed toc etoc has its own private counter but it counts all TOCs even those not displayed because the tocdepth value was 2 or 3 We could have added manually refstepcounter visibletoc and label com mands at all suitable locations in the document source and we would then have used here ref commands but this imposes heavy manual editing of the source There is a much better way there is a hook etocaftertitlehook and we told it to increment the visibletoc counter and to write a line to the toc file in a manner anal ogous to what sectioning commands such as chapter section or subsection do As etoc increments its own private counter even before typesetting the title of a table of The TOCs put in floats may change the order the numbers are listed in the order the TOCs are typeset in the
59. d brutal doings of some pack ages with tableofcontents 566 let etocaftertitlehook empty 567 let etocaftercontentshook empty 568 def etoctableofcontents 569 Etoc openouttoc 570 Etoc par 571 begingroup closed in Etoc t bleofcontents or Etoc localtableofcontents 572 def etoc startlocaltoc 1 etoc startlocaltoc 1 c etoc tocid 573 ifstar 574 def Etoc aftertitlehook Etoc table fcontents 575 let Etoc aftertitlehook etocaftertitlehook Etoc table fcontents 576 let tableofcontents etoctableofcontents 577 newcommand localtableofcontents 578 Etoc openouttoc 579 Etoc par 580 begingroup closed in Etoc t bleofcontents or Etoc localtableofcontents 581 ifstar 582 def Etoc aftertitlehook Etoc localtable fcontents 583 let Etoc aftertitlehook etocaftertitlehook Etoc localtable fcontents placeholder for comments 584 newcommand etocsettocstyle 2 585 def Etoc tableofcontents 586 ifnum c tocdepth gt Etoc minf 587 let Etoc next firstofone else 588 let Etoc next gobble 589 fi 590 Etoc next Etoc storetocdepth 1 07g 591 1 ifEtoc parskip parskip z skip fi 1 07d 592 Etoc aftertitlehook 593 let Etoc savedcontentsline contentsline 594 let contentsline Etoc etoccontentsline 595 Etoc toctoc 79 35 Implementation 596 let Etoc next relax 597 ifEtoc tocwithid else 598 ifEtoc localtoc 599 Ni fEtoc notactive 600 def Etoc next Etoc localtocfa
60. de to see if truly adding a par is a reasonable idea in the case of single column mode 785 newcommand etocmulticolstyle 2 etocdefaultnbcol 786 etocsettocstyle 787 let etocoldpar par 788 addvspace etocabovetocskip 789 ifnum 1 gt ne let Etoc next firstoftwo 790 else let Etoc next secondoftwo fi 791 Etoc next 792 multicolpretolerance etocmulticolpretolerance 793 multicoltolerance etocmulticoltolerance 794 setlength columnsep etoccolumnsep 795 setlength multicolsep etocmulticolsep 796 begin multicols 1 2 etocoldpar addvspace etocinnertopsep 797 2 ifvmode else begingroup interlinepenalty M parskip z skip 798 par endgroup 799 fi 800 nobreak addvspace etocinnertopsep 801 pretolerance etocmulticolpretolerance 802 tolerance etocmulticoltolerance 803 ifnum 1 gt ne let Etoc next firstofone 804 else let Etoc next gobble fi 83 35 Implementation 805 Etoc next end multicols 806 addvspace etocbelowtocskip placeholder for comments 807 def etocinnerbottomsep 3 5ex 808 def etocinnerleftsep 2em 809 def etocinnerrightsep 2em 810 def etoctoprule hrule 811 def etocleftrule vrule 812 def etocrightrule vrule 813 def etocbottomrule hrule 814 def etoctoprulecolorcmd relax 815 def etocbottomrulecolorcmd relax 816 def etocleftrulecolorcmd relax 817 def etocrightrulecolorcmd relax 1 071 moves the nobreak to before t
61. dings titles etocoldpar etocinner topsep The compatibility mode etocstandarddisplaystyle The command etocinline Starred variants of the tableofcontents etc commands 26 p 41 Table of contents for this part 27 p 41 Testing the compatibility mode A framed display A crazy inline display Part VI Using and customizing etoc Summary of the main style commande 28 45 Setting up local styles Setting up toc display styles Displaying tables of contents Labels and refer ences The package default line styles etocdefaultlines 29 p 46 Customizing etoc 50 p 50 Customizing the etoc pre defined line styles Customizing the toc display styles One more example of colored TOC layout 31 p 52 Part VII Tips and tricks lt oe Mw a owe d we ee oe e aaa A 82 Pe 54 Hacking framed parboxes Interverting the levels All subsections of this document Displaying statistics Using depth tags Typesetting the TOC as a table Compatibility with other packages TEXnical matters Errors and catastrophes Part VIII The code Timestamp e 38 p 67 Change history 84 0 67 Implementation 35 p 68 Abstract The etoc package gives to the user complete control on how the entries of the table of contents should be constituted from the name number a
62. e document class defaults to benefit from the etoc styles it is mandatory to use either tableofcontents or localtableof contents or one of the other etoc commands and tableof v1 1 will influence the outcome only if nexttocwithtags required forbidden was added before the table of contents typesetting command 32 8 TeXnical matters The etocname etocnumber etocpage commands are protected against premature expansion They contain suitable hyperref links if package hyperref is loaded and active for the TOC The commands etoclink and etocifnumbered are also protected against premature expansion On the other hand etocthename etocthenumber etocthepage do not represent hyperref links and are not protected against expansion The commands such as etocsetstyle etocsetlevel etocsettocstyle etoc multicolstyle etocruledstyle etocframedstyle obey ISIKX s groups All TOCs are typeset inside groups 4contrarily to etocaftertochook etocaftercontentshook is not executed if the tocdepth did not allow the printing of the TOC 44http ctan org pkg tocvsec2 4Shttp ctan org pkg tableof 65 32 and tricks 32 9 Errors and catastrophes After using etocsetstyle for one level the remaining uncustomized levels use the etoc default styles those which are activated by etocdefaultlines One has to make sure that all levels needed for the next table of contents are mutually compatible in particular the etoc d
63. e exercise number would then have been available via etocnumber and etocname would have been empty It doesn t matter which one of the two methods is used The etoc command etoctoccontentsline is provided as a substitute to addcon tentsline toc this is to avoid the patching which is done by hyperref to addcontentsline in its process of creation of bookmarks If one wants to authorize hyperref to create bookmarks at a specific level n one can use here with n 2 the starred variant etoctoccontentsline which has an additional argument newcommand exercisetotoc etoctoccontentsline exercise theexerci 2 The counter exerci is already incremented by the exerci theorem environment and provides the correct destination for the link added by package hyperref The command exercisetotoc adds for each exercise a line to the toc file corresponding to a fictitious document unit with name exercise A four column list including the sections can then be typeset with the following code etocsetnexttocdepth 2 sections are at level 1 and will show up begingroup etocsetlevel exercise 2 but etocsetlevel chapter 3 no chapters etocsetlevel subsection 3 no subsections etocsetlevel part 3 no parts etocsetstyle exercise etocname exercise number noindent etocname strut leaders etoctoclineleaders hfill etocpage par pagebreak 2 vskip baselineskip etocsetstyle section
64. ecedent 23 25 PART II Government 3 The Accusative Case nr n ni 17 General uses et re D 26 30 Particular uses sa Se Ss 31 37 4 Verbs governing two Accusatives 38 41 23 5 The Causal Se m i 42 49 25 23 18 Another compatibility mode 6 The Instrumental Case lai im isi 27 General uses es hg i 50 54 Particular uses ees Hi sii 55 59 7 The Dative Case _ da a ee 33 General uses ni SN na 60 65 Particular uses ne RA 66 71 8 The Ablative Case vu pei ve 39 General uses s i a ie 72 75 Particular uses si A 76 86 9 The Locative Case Hi A a 45 General uses ai ay ais 87 92 Particular uses es Ae 93 100 18 Another compatibility mode As explained in subsection 4 3 the commands etocstandardlines and etocstan darddisplaystyle tell etoc to essentially act as an observer The document class layout for the table of contents is then perfectly obeyed There is no way to customize this stan dard layout change fonts margins vertical spacings etc from within the package For this use some package dedicated to this task because etoc either is temporarily perhaps in compatibility mode with no customization on its part possible or the user has specified the layout in etocsetstyle commands and etocsettocstyle and is supposedly in complete control Well there is actually an alternative It is possible to use the etocsetstyle commands to recreate an artificial compati
65. ect tableofcontents space reverted Use 1207 protect etocsettocdepth toc as a replacement4A4 1208 for the tocvsec2 toc related commands 1209 1210 1 979 1211 def invisibletableofcontents etocsetnexttocdepth 3 tableofcontents 1212 def invisiblelocaltableofcontents 1213 etocsetnexttocdepth 3 localtableofcontents 1214 def etocsetnexttocdepth 1 1215 ifundefined Etoc 1 1216 PackageWarning etoc 1217 Unknown sectioning unit 1 protect etocsetnextocdepth space ignored 1218 edef Etoc aftertochook global c tocdepth the c tocdepth space 1219 let noexpand Etoc aftertochook noexpand empty 1220 global c tocdepth csname Etoc 1 endcsname 1221 1 07h In order for the toc file to be usable without error even without etoc In 1 071 use of gobble for etoc settocdepth 1222 addtocontents toc protect ifundefined etoctocstyle 1223 let protect etoc startlocaltoc protect gobble 1224 let protect etoc settocdepth protect gobble 1225 let protect etoc depthtag protect gobble Initializations 1226 def etocstandardlines Etoc standardtrue 1227 def etoctoclines Etoc standardfalse 1228 etocdefaultlines 1229 etocstandardlines 1230 etocstandarddisplaystyle 1231 etocobeytoctocdepth 1232 etocobeydepthtags 1233 let Etoc aftertochook empty private for etocsetnexttocdepth 1234 let etocaftertochook empty public for end user 1235 endinput 92
66. ee if two column mode is on and switch to one column style and the after_toc part would then reenact the two column mode The commands to be described next etocmulticolstyle etocruledstyle and etocframedstyle all call etocsettocstyle as a lower level routine to start a multi cols environment in before_toc and close it in after_toc 25 2 The commands etocmulticolstyle etocmulticol and etoclocalmulticol This is a command with one optional and one mandatory argument etocmulticolstyle number_of_columns heading The number_of_columns can go from 1 to 10 it defaults to 2 if its value is 1 naturally no multicols environment is then created The heading will typically be some vertical material like heading section title but one may also have horizontal material like fbox Hello World etoc adds automatically a par at the end of this heading argument to etocmulticolstyle Here is for example how the main table of contents of this document was configured etocmulticolstyle noindent bfseries Large leaders hrule heightipt hfill MakeUppercase Table of Contents 38 25 3 The commands etocruledstyle etocruled and etoclocalruled After etocmulticolstyle all future tableofcontents will use the specified style if it does not get changed in between A shortcut for just one table of contents and no impact on the styles of later TOCs is etocmulticol number_of_columns headin
67. ef Etoc getnb hyp 1 2 3 4 5 6 etoc 339 def Etoc getname 1 relax relax etoc 340 namedef etocname leavevmode 1 2 3 1 5 341 def etocthename 1 342 toks 1 343 edef etocthelinkedname noexpand hyperlink 3 the toks 344 345 def Etoc getnbr 1 2 3 etoc 346 ifx 1 numberline 347 namedef etocnumber leavevmode 1 2 3 2 5 348 def etocthenumber 2 349 toks 2 350 edef etocthelinkednumber noexpand hyperlink 3 the toks 351 Etoc numbertrue 352 Etoc getname 3 etoc 353 else 354 namedef etocnumber leavevmode 355 let etocthenumber empty 356 let etocthelinkednumber empty 357 Etoc numberfalse 358 def etocthename 4 359 toks 4 360 edef etocthelinkedname noexpand hyperlink 3 the toks 361 fi 362 3 363 namedef fetoclink 1 leavevmode 1 2 3 1 5 364 edef etocthelink 1 noexpand hyperlink 3 1 365 Etoc getnbr 4 relax relax etoc 366 placeholder for comments 367 def Etoc getit nohyp 1 hspace 2 3 etoc 368 def Etoc getname 1 hspace relax etoc 369 namedef etocname leavevmode 1 370 def etocthename 1 371 def etocthelinkedname 1 372 373 ifx relax 2 else 374 namedef etocnumber leavevmode 1 375 def etocthenumber 1 376 def etocthelinkednumber 1 377 Etoc numbertrue 378 Etoc getname 3 etoc 379 fi 380
68. efault line styles expect each to be started in vertical mode When using multiple tableofcontents commands in a document one should beware from adding typesetting instructions directly in the toc file as they will be executed by etoc for all TOCs even for a localtableofcontents it doesn t matter if that instruc tion seems to concern material outside of its scope it will get executed nevertheless If absolutely necessary but this should never be these instructions should be done in such a way that they can be activated or deactivated easily from the document source as need be As is usual with toc and labels after each change one has to run latex a certain number of times to let the produced document get its final appearance at least twice 66 Part VIII The code 33 Timestamp This is the documentation as of 2014 04 29 printed from the source file with the time stamp 18 05 2014 at 11 51 45 CEST The package version is v1 071 of 2014 04 22 34 Change history v1 071 doc of 2014 04 29 v1 07g 2013 10 13 added to the documentation an example of new commands etocsettocdepth etocset use of etocthelinkedname together with an tocdepth toc etocobeytoctocdepth etoc enumitem inline itemize environment moved ignoretoctocdepth which emulate part of main TOC to immediately after the title and li tocvsec2 functionality measures to make cense to the first pages tocvsec2 partially compatible with etoc incorporat
69. ep pt colorbox uses fboxsep also when no frame noindent colorbox secbackground parbox linewidth vskip5pt noindent color 1 2 par nointerlineskip vskip3pt par nointerlineskip etocsetstyle section coloredstuff white hfil hyperref toc b bfseries large I am a twin of that other TOC click me hfil vskip3pt sffamily small coloredstuff white leftskip1 5cm rightskip 5cm parfillskip rightskip makebox Opt r makebox 5cm r etocnumber hspace 2cm etocname hfill makebox 5cm r etocpage hspace 2cm vskip6pt etocframedstyle 1 tableofcontents label toc clone ref toc globalcmds endgroup The TOC has been put in a float which appears on the next page The coding is a bit involved as it does not use any additional package Also it was written at some early stage and I have not revised it since A better solution would be to use some package to set up a background color possibly extending accross pages as the framed style which we used to get this background color can only deal with material short enough to fit on one page Regarding colors generally speaking all color commands inside etoc are initially de fined to do nothing and the choice to use or not colors is left to the user Part VII Tips Here are some statistics for this part it contains 1 section and 9 subsections The name of the first section is and tricks and the correspondi
70. er let expandafter Etoc tmp csname Etoc 1 endcsname 179 Etoc skipthisonefalse 180 let Etoc next Etoc gobblesixorfive 181 ifnum Etoc tmp Etoc six 182 Etoc skipthisonetrue 183 else 184 ifEtoc localtoc 185 let Etoc prenext relax 186 ifEtoc stoptoc 187 Etoc skipthisonetrue 188 fi 189 ifnum Etoc tmp lt Etoc localtop 190 def Etoc prenext global Etoc stoptoctrue 191 Etoc skipthisonetrue 192 fi 193 ifEtoc notactive 71 35 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 72 Implementation def Etoc prenext Etoc setflags Etoc tmp Etoc skipthisonetrue fi Etoc prenext fi fi ifnum c tocdepth lt Etoc tmp relax else ifEtoc skipthisone else global let Etoc next relax ifcase Etoc tmp ifEtoc v Etoc end five fi ifEtoc iv Etoc end four fi ifEtoc iii Etoc end three fi ifEtoc ii Etoc end two fi ifEtoc i Etoc end one fi ifEtoc else def Etoc next Etoc begin zero fi def Etoc contents Etoc contents zero def Etoc prefix Etoc prefix zero or ifEtoc v Etoc end five fi ifEtoc iv Etoc end four fi ifEtoc iii Etoc end three fi ifEtoc ii Etoc end two fi ifEtoc i else def Etoc next Etoc begin one fi def Etoc contents Etoc contents
71. eries large llap makebox 1cm r etocnumber etocname EndParWithPagenoInMargin smallskip 1 etocsetstyle section 1 leavevmode leftskip 1 75cm relax bfseries normalsize llap makebox 75cm 1 etocnumber etocname EndParWithPagenoInMarginAndLeaders 1 etocsetstyle subsection 1 leavevmode leftskip 2 75cm relax mdseries normalsize llap makebox 1cm 1 etocnumber etocname EndParWithPagenoInMarginAndLeaders 1 etocsetstyle subsubsection 1 leavevmode leftskip 4cm relax mdseries normalsize llap makebox 1 25cm 1 etocnumber etocname EndParWithPagenoInMarginAndLeaders 1 etocsetstyle paragraph 1 leavevmode leftskip 5 5cm relax mdseries normalsize llap makebox 1 5cm 1 etocnumber 59 32 and tricks etocname EndParWithPagenoInMarginAndLeaders etocsettagdepth preamble none etocsettagdepth overview part etocsettagdepth arbitrarily part etocsettagdepth surprising part etocsettagdepth linestyles part etocsettagdepth globalcmds paragraph etocsettagdepth custom part etocsettagdepth tips part etocsettagdepth code none renewcommand etoctoprule hrule height 3pt relax renewcommand etoctoprulecolorcmd color blue renewcommand etocaftercontentshook medskip begingroup color blue hrule height 3pt endgroup etocruledstyle 1 Large bfseries fbox makebox 8cm A TOC using depth tags sloppy
72. es so the problem of the appearance of the links does not arise then e the typesetting of the TOC as a table see subsection 32 6 there we also will have to issue hypersetup hidelinks after having collected the names numbers and page numbers in a token list register e and the two additional tree examples in the next section 20 The TOC as a molecule It is also possible to construct a TOC tree obeying the TikZ syntax for trees but this is a more complicated task for the etoc line styles for reasons related to the way braces are handled by TEX they need when filling up the token list to be always balanced at each step else complicated tricks must be employed The simplest strategy is to allocate a token list or use a macro for each level used we may need a parttok a chaptertok a sectiontok and a subsectiontok to help in the task of filling up the total treetok As we are interested here in the table of contents of this or another document part only a sectiontok and a subsectiontok will be needed newtoks treetok already done earlier newtoks sectiontok newtoks subsectiontok newcommand treenode newcommand appendchildtree 2 token list t1 becomes t1 child t2 edef tmp the 1 child the 2 1 expandafter tmp newcommand preparetreenode tmptok expandafter etocthelinkednumber expanded one time mandatory edef treenode node the tmptok etocsetstyle section et
73. es a second counter this could be avoided but ok let s not be that strict 68 v v 1 1 and this will be taken into account by etoc for the TOCs typeset in compatibility mode 05 2012 12 01 localtableofcontents replaces tableofcontents for compatibility with the memoir class compatibility with KOMA script and memoir document classes 04 2012 11 24 a possibly local table of contents can be la beled tableofcontents label toc 1 and reproduced elsewhere in the document with a possibly completely different layout tableofcontents ref toc 1 v1 02 2012 11 18 initial version 32 newcounter etoc tocdepth 1 07g placeholder for comments 33 ifclassloaded memoir def Etoc minf thr def Etoc minf tw 34 def Etoc minustwo tw 35 let Etoc minusone m ne 36 let Etoc zero z 37 let Etoc one ne 38 let Etoc two tw 39 let Etoc three thr 40 chardef Etoc four 4 41 chardef Etoc five 5 42 chardef Etoc six 6 43 let Etoc localtop Etoc minustwo 44 def Etoc minustwo minustwo 45 def Etoc minusone minusone 46 def Etoc zero zero 47 def Etoc one one 48 def Etoc two two 49 def Etoc three three 50 def Etoc four four 51 def Etoc five five 1 07g 52 expandafter def csname Etoc 3 endcsname thr 53 expandafter let csname Etoc 2 endcsname Etoc minustwo 54 expandafter let
74. f Etoc redefetocstyle 1 1067 renewcommand etoctocstylewithmarks 4 1 1068 etocmulticolstyle 2 1069 csname 1 endcsname 3 etocmarkboth 4 1070 renewcommand etoctocstylewithmarksnouc 4 1 1071 etocmulticolstyle 2 1072 csname 1 endcsname 3 etocmarkbothnouc 4 1073 renewcommand etoctocstyle 3 1 1074 etocmulticolstyle 2 csname 1 endcsname 3 1075 ifclassloaded scrartcl 1076 renewcommand etocstandarddisplaystyle etocscrartclstyle 1077 ifclassloaded book 1078 renewcommand etocfontone normalfont normalsize 1079 renewcommand etocstandarddisplaystyle etocbookstyle 1080 Etoc redefetocstyle chapter 1081 ifclassloaded report 1082 renewcommand etocfontone normalfont normalsize 1083 renewcommand etocstandarddisplaystyle etocreportstyle 1084 Etoc redefetocstyle chapter 1085 ifclassloaded scrbook 1086 renewcommand etocfontone normalfont normalsize 1087 renewcommand etocstandarddisplaystyle etocscrbookstyle 1088 Etoc redefetocstyle chapter 1089 ifclassloaded scrreprt 1090 renewcommand etocfontone normalfont normalsize 1091 renewcommand etocstandarddisplaystyle etocscrreprtstyle 1092 Etoc redefetocstyle chapter 1 07k 2014 03 06 adds the appendix to the list of known levels if class memoir is detected 1093 ifclassloaded memoir 1094 etocsetlevel appendix 0 1095 renewcommand etocfontone no
75. f com mands etocsettagdepth tag_name lt level where the level may be either numeric from 3 to 5 or the name of a division unit known to etoc or none or all The effect of the tag inside the toc file will then be to set the tocdepth counter to the desired value in real time as mentioned already this can not get finer than the initial value of tocdepth at the start of the TOC The added flexibility is thus that etocsetlevel has not been used in a kind of hacky way that one may use named level depths and the keywords none and all As usual once the tag depths have been set they remain in effect until getting redefined or seeing their scope expire via the closing of a group or of a surrounding environment For an example see subsection 32 5 12 1 The commands etocobeydepthtags and etocignoredepthtags After etocignoredepthtags the toc depth tags are ignored but etocdepthtag toc still works The package does initially etocobeydepthtags which makes etoc react to the found tags in the toc file 16 13 Adding commands to the toc file We described above etocsettocdepth toc and etocdepthtag toc which both insert commands inside the toc file An even more general mechanism of adding action tags to the toc file could be envisioned but this would just be a wrapper for direct use of addtocontents toc something One should be cautious when adding in this way things to the toc file For exam ple in
76. framedmphook ifnum 1 gt ne let Etoc next firstoftwo else let Etoc next secondoftwo fi Etoc next multicolpretolerance etocmulticolpretolerance multicoltolerance etocmulticoltolerance setlength columnsep etoccolumnsep setlength multicolsep etocmulticolsep begin multicols 1 pretolerance etocmulticolpretolerance tolerance etocmulticoltolerance ifnum 1 gt ne let Etoc next firstofone else let Etoc next gobble fi Etoc next end multicols unskip end minipage egroup vskip etocinnerbottomsep egroup vbox hsize linewidth ifx etocbkgcolorcmd Etoc relax else kern ht etoc framed titlebox kern dp etoc framed titlebox hb xt linewidth color begingroup etocleftrulecolorcmd etocleftrule etocbkgcolorcmd leaders vrule height ht etoc framed contentsbox depth dp etoc framed contentsbox hss 85 35 Implementation 908 etocrightrulecolorcmd etocrightrule 909 color endgroup nointerlineskip 910 vskip dp etoc framed contentsbox 911 vskip ht etoc framed contentsbox 912 vskip dp etoc framed titlebox 913 vskip ht etoc framed titlebox 914 fi 915 box etoc framed titlebox nointerlineskip 916 hb xt linewidth color begingroup 917 etocleftrulecolorcmd etocleftrule 918 hss box etoc framed contentsbox hss 919 etocrightrulecolorcmd etocrightrule color endgroup 920 nointerlineskip 921 vskip ht etoc framed contentsbox 922 vskip dp etoc framed contentsbox 923 hb
77. fter Etoc toctoks Etoc buffer 419 expandafter Etoc readtoc 420 fi 421 422 Etoc toctoks superfluous but for clarity 423 IfFileExists jobname toc 424 endlinechar 1 425 makeatletter 426 newread Etoc tf 427 openin Etoc tf filef und 428 Etoc readtoc 429 global Etoc toctoks expandafter the Etoc toctoks 430 closein Etoc tf 431 typeout No file jobname toc 1 07d parskip and nobreakfalse stuff moved to Etoc tableofcontents 432 def Etoc openouttoc 433 ifEtoc hyperref 434 ifx hyper last undefined 435 IfFileExists jobname toc 436 Hy WarningNoLine 437 old toc file detected not used run LaTeX again cheers from etoc 438 global Etoc toctoks 439 440 441 fi 442 fi 443 if filesw 444 newwrite tf toc 445 immediate openout tf toc jobname toc relax 76 446 fi 447 global let Etoc openouttoc empty 448 placeholder for comments 449 def Etoc toctoc 450 global Etoc vfalse 451 global Etoc ivfalse 452 global Etoc iiifalse 453 global Etoc iifalse 454 global Etoc ifalse 455 global Etoc false 456 global Etoc j false 457 global Etoc jjfalse 458 ifEtoc standard 459 etoc setstyle minustwo 460 etoc setstyle minusone 461 etoc setstyle zero 462 etoc setstyle one 463 etoc setstyle two 464 etoc setstyle three 465 etoc setstyle four 466 eto
78. g And there is also etoclocalmulticol number_of_columns heading 25 2 1 The command etoctocstyle etoctocstyle kind number_of_columns title etocmulticolstyle number_of_columns kind title where kind is one of chapter section and defaults to chapter or section depend ing on the document class 25 2 1 1 etoctocstylewithmarks kind number_of_columns title mark etocmulticolstyle number_of_columns kind title markboth MakeUppercase mark where kind is one of chapter section The actual display of the marks depends on the settings of the page style There is variant etoctocstylewithmarksnouc which does not uppercase 25 2 1 2 Do we really want paragraph entries in the TOC 25 2 1 3 really 25 3 The commands etocruledstyle etocruled and etoclocalruled The general format of etocruledstyle is etocruledstyle number of columns title of the toc The title is horizontal material the LR mode of ATEX a document preparation system if it does not fit on one line it should be put in a parbox of a given width The green frame for the heading of the table of contents at the start of the second part of this document was obtained with etocruledstyle 1 etocfontminusone color green fboxrulelpt fboxseplex framebox linewidth normalcolor hss Contents of this part hss As a shortcut to set the style with etocruledstyle and then issue a tableofcon
79. h compatibility with package tocloft and im produces the smallest file proved compatibility with class memoir Novel v1 07f 2013 03 07 TOC example in Overview new macros etocthelinkedname etocthe v1 07j 2013 12 03 linkednumber etocthelinkedpage and etoc some issues with the documentation format thelink ting now two sided have been addressed v1 07e 2013 03 01 and a novel documentation section Typeset improvements in the package own line styles ting the TOC as a table has been added Very with regards to penalties and vertical spaces minor code change Etoc readtoc addition to the documentation of an example v1 07i 2013 10 21 of a tree like table of contents uses tikz changes to the etocmulticolstyle and etoc more such examples added 2013 03 03 ruledstyle codes to lessen the risk of a page v1 07d 2013 02 24 break after the title in the one column case minor code improvements and new documen v1 07h 2013 10 16 tation section Another compatibility mode new commands etocdepthtag toc etocset v1 07b 2013 02 02 tagdepth etocobeydepthtags etocignore removal of the xspace from the macros etoc depthtags name etocnumber etocpage 67 35 Implementation additional examples in the documentation v1 07 2013 01 29 new commands etocthename etocthenumber etocthe page etoclink etoctoccontentsline etoctoccontentsline etocnopar etocaftercontentshook modified co
80. h explains why it can be used inside the label specification without needing an added protect 33 21 The etocsetstyle command 21 3 1 The etocifnumbered switch The fbox would give an unaesthetic result in the case of an unnumbered section which ended up in the table of contents via an addcontentsline command The etocifnumbered A B command executes A if the number exists and BY if not So we use it in the code which was finally chosen for the section level etocsetstyle section begin enumerate leftmargin 75cm label etocifnumbered fboxrulelpt fcolorbox green white etocnumber normalsize bfseries rmfamily item etocname page etocpage end enumerate etocsetstyle subsection begin enumerate leftmargin cm label etocnumber normalfont item etocname p etocpage end enumerate If we had changed only the section level and not the subsection level an error on compilation would have occurred because the package style for subsections expects to start in vertical mode An additional par token in the contents part of the section level would have fixed this page etocpage par 21 4 The etocthename etocthenumber and etocthepage commands It is sometimes desirable to have access to the name number and page number without the hyperref link data something similar to the starred variant of the ref command when package hyperref is used For
81. he vskip etocinnertopsep especially important for the single column case 818 def etoc ruledheading 1 819 hb xt linewidth color begingroup 820 hss 1 hss hskip linewidth 821 etoctoprulecolorcmd leaders etoctoprule hss 822 phantom 1 823 leaders etoctoprule hss color endgroup 824 nointerlineskip nobreak vskip etocinnertopsep 825 newcommand etocruledstyle 2 etocdefaultnbcol 826 etocsettocstyle 827 addvspace etocabovetocskip 828 ifnum 1 gt ne let Etoc next firstoftwo 829 else let Etoc next secondoftwo fi 830 Etoc next 831 multicolpretolerance etocmulticolpretolerance 832 multicoltolerance etocmulticoltolerance 833 setlength columnsep etoccolumnsep 834 setlength multicolsep etocmulticolsep 835 begin multicols 1 etoc ruledheading 2 836 etoc ruledheading 2 837 pretolerance etocmulticolpretolerance 838 tolerance etocmulticoltolerance 839 ifnum 1 gt ne let Etoc next firstofone 840 else let Etoc next gobble fi 841 Etoc next end multicols 842 addvspace etocbelowtocskip 1 07k defines Etoc relax and etocbkgcolorcmd as long the user manual says to use renewcommand etocbkgcolorcmd and an ifx test is used in the framed style It was thus a bug to have non long definitions before Or I could have said in the user manual to use renewcommand or in etocframedstyle I should test for the two or I should pause to try to remember ab
82. ikzparentnode tikzchildnode the treetok end tikzpicture end figure This TikZ TOC is fully hyperlinked like the previous Forest TOC On the side the fully hyperlinked table of contents of Part V etocsettocstyle treetok node autoref part globalcmds global appendtotok treetok etocsetnexttocdepth subsection tableofcontents ref toc globalcmds noindent parbox 4cm hypersetup hidelinks begin tikzpicture grow cyclic level 1 style level distance 2 5cm sibling angle 60 level 2 style level distance 1cm sibling angle 45 every node style ball color red 50 circle text black edge from parent path very thick color cyan tikzparentnode tikzchildnode the treetok end tikzpicture Part IV Commands for the toc line styles Here are some statistics for this part it contains 4 sections and 8 subsections The name of the first section is The etocsetstyle command and the corresponding number is 21 The name of the last section is Am I also red and its number is 24 The name of the first subsection is The etocname and etocpage commands and the corresponding number is 21 1 The name of the last subsection is This is a pale red subsection for illustrative purposes and its number is 23 2 Contents of Part IV The etocsetstyle command page 32 21 1 The etocname and etocpage commands p 32 21 2 The etocskipfirstprefix comm
83. ing depth tags e e 24 0G deka ee YR RS eS Ha wees 32 6 Typesetting the TOC as a table cc 32 7 Compatibility with other packages 32 8 TeXnical matters ee 32 9 Errors and catastrophes and tricks 32 1 Hacking framed parboxes etocdefaultlines renewcommand etoctoprule hrule height 2pt depth 2pt etocruled color green fboxrule2pt fboxseplex 54 fbox raisebox fontdimen22 textfont2 color blue parbox 5 linewidth normalfont This text is perfectly centered vertically with respect to the surrounding horizontal rules ref toc globalcmds 32 2 Interverting the levels This text is perfectly centered vertically with respect to the surrounding horizontal rules Specifying the toc display style 25 p 38 The command etocsettocsiyle 25 1 p 38 The commands etocmulticolstyle etocmulticol and etoclocalmulti col 25 2 0 38 The commands etocruledstyle etoc ruled and etoclocalruled i 25 3 p 39 The commande etocframedstyle etoc framed and etoclocalframed 25 4 p 39 Headings titles etocoldpar etocin nertopsep 25 5 p 40 32 2 Interverting the levels The compatibility mode etocstandard displaystyle 25 6 p 40 The command etocinline ss 25 7 p 41 Starred variants of the tableofcon tents etc commands 26 p 41 Tab
84. ing tree has been put in a float which appears on the preceding page Here is the code used for its production newtoks treetok newtoks tmptok newcommand appendtotok 2 1 toks variable 2 macro expands once 2 1 expandafter expandafter expandafter expandafter the expandafter 1 2 newcommand PrepareSectionNode tmptok centering bfseries appendtotok tmptok etocthelinkedname edef foresttreenode noexpand parbox 2cm the tmptok newcommand PrepareSubsectionNode tmptok raggedright appendtotok tmptok etocthelinkedname edef foresttreenode noexpand parbox 6cm the tmptok etocsetstyle section etocskipfirstprefix appendtotok treetok PrepareSectionNode appendtotok treetok foresttreenode appendtotok treetok etocsetstyle subsection etocskipfirstprefix appendtotok treetok PrepareSubsectionNode appendtotok treetok foresttreenode appendtotok treetok etocsettocstyle treetok hyperref part overview Overview global appendtotok treetok forest does not like the treetok if treetok is empty On first latex run this will be the case because the TOC style defined above will not have been executed as the label toc overview does not refer to a valid TOC yet So we must give a safe default value to treetok treetok run latex again begin figure th centering etocsetnexttocdepth subsection tableofconte
85. inustwo 263 def Etoc prefix Etoc prefix minustwo 264 fi 265 fi 266 ifnum Etoc tmp m ne Etoc parttrue else Etoc partfalse fi 267 Etoc setflags Etoc tmp 268 fi fi 269 Etoc next 270 firstoftwo Etoc swa 1 Etoc swb 1 2013 03 07 Up to 1 06 etoc defined only etocname etocnumber and etocpage The hyperref added data is recycled in the simplest manner prefixing it with leavevmode The included Hy tocdestname is left unexpanded We have to spend some time with delimited macros to dis entangle the toc data and reconstruct the possible hyperref data If the page number is not hyperlinked etocpage does not add the link found possibly in the name Then 1 07 added etocthename etocthenumber etocthepage which are left fragile and do not have the links data and etoclink linkname which is robust and reconstructs an arbi trarily named link A need for things like building up a token list to be used in a tikzpicture arose later to have some form of the link which could be saved by a simple command like one can do global let lastname etocthename and avoid having to manipulate Hy tocdestname So 1 07 adds etocthelinkedname etocthelinkednumber etocthelinkedpage etocthe link they use hyperlink with an expanded Hy tocdestname One could now define etocname etc to be the robust versions of etocthelinkedname etc but the original definitions are kept by sentimentalism 1 07 also adds
86. ion of the translation into German new commands etocsetnexttocdepth invis done on the initiative of Christine R mer by ibletableofcontents invisiblelocaltableofcon Felix Baral Weber Jenny Rothkr mer Vogt tents Daniel B ttner Claudia Dahl Christian Otto switched from tikz qtree to forest for the first and Christine R mer FSU Jena My grateful toc as tree example thanks to all command names are linked to their descrip v1 071 2014 04 22 tions and many other changes in the docu mentation fixes a bug with the 1 07k compatibility layer with tocloft which had broken the 1 07k sic compatibility with memoir yes memoir class 1 07k testing had been done before adding the tocloft thing to the source code Also etoc when detecting tocvsec2 now checks if this is under the memoir class as then nothing spe removed printing of temporary message when the local toc id is not yet stabilized indeed lo caltableofcontents can have many uses such as filling up some token list register and one may wish to not have anything typeset even in an intermediate run cial needs to be done to rescue tableofcon all of tex etoc dtx etex etoc dtx xetex etoc dtx tents contrarily to the situation with the native latex etoc dtx pdflatex etoc dtx are now possi tocvsec2 ble and the extracted file etoc tex allows easy customization of compilation options for the V1 07K 2014 03 06 documentation default is via dvipdfmx whic
87. ith the memoir class etocstandarddisplaystyle this is for the title page marks etc tableofcontents endgroup makeatother Of course if the document has only one table of contents then there is no need to put the commands inside a macro or even inside a group With these commands etoc will con struct a TOC completely identical to what would have been done by one of the document class article book scrartcl scrbook The number and the name of each entry are each separately an hyperref link as is always the case with etoc when not in compat ibility mode Replacing etocnumber with etocthenumber will give a TOC where the numbers are not links anymore but the names still are Or one may decide to use etoc thename and keep an hyperlinked number with etocnumber Here is a subtler example where one only marginally modifies the sections adding color to the number and removing the hyperref link and keeps the subsections as in the default except for those of one specific section for which the layout is completely modified Contents 3 Do l need to be a geek to use etoc 6 3 1 Limitations in the use of list environments for tables of contents 6 4 Line styles and toc display style 7 etocsetstyle for the line styles 4 etocsettocstyle for the toc display 4 2 Compatibility mode 4 3 5 A first example 8 6 A second example 9 7 Linked list of the main package commands 11 2and if moreover one
88. izing the toc display styles 30 2 p 51 xxxv Hacking framed par boxes 32 1 p 54 xxxvi Interverting the lev els 32 2 p 55 xxxvii All subsections of this document 32 3 p 55 xxxviii Displaying statis tics 32 4 p 56 xxxix Using depth tags 32 5 p 58 xl Typesetting the TOC as a table 32 6 p 60 xli Compatibility with other packages 32 7 p 64 xlii TEXnical matters 32 8 p 65 xliii Errors and catastro phes 32 9 p 66 Each part of this document starts with a paragraph telling how many sections and subsec tions it has Well each one of this paragraph is a table of contents We designed a macro thispartstats to do that It uses storage boxes to keep the information about the first and last section or subsection Using boxes is the simplest manner to encapsulate the hyperref link for later use whether there is one or none However one cannot modify then the font or the color using the TEX primitive setbox rather than the IX sbox would allow to change the color of the un boxed saved box If such a need arises one must switch from using boxes to using macros and store the hyperref data for later use as was done in the code presented in section 20 We present also this second method But first the code of thispartstats newsavebox firstnamei newsavebox lastnamei newsavebox firstnumberi newsavebox lastnumberi newsavebox firstnameii newsavebox firstnumberii ne
89. last argument is the code to execute when a division unit of higher importance is again hit upon 4 2 etocsettocstyle for the toc display The etocsettocstyle command allows to specify what should be done before and after the line entries of the TOC are typeset and in particular how the title should be printed It has two arguments the first one is executed before the TOC contents typically it will print Contents and define suitable marks for the page headings and the second is executed after the TOC contents etoc provides four customizable higher level toc styles etocmulticolstyle etoctocstyle etocruledstyle and etocframedstyle All use the multicol pack age with a default of two columns single column mode is obtained with the optional ar gument 1 These commands must be followed either by tableofcontents or localtableof contents Swith a twist subsections having been downgraded to the subsubsection style 4under the memoir class etoc knows appendix as a sectioning name 5 A first example 4 3 Compatibility mode Both for the line styles and the toc display style it is possible to switch into a compat ibility mode which uses the defaults from the document class This is activated by etocstandardlines line entries as without usepackage etoc etocstandarddisplaystyle toc display as without usepackage etoc If the command etocsetstyle has not been used in the pream
90. le of contents for this part a Ge ce ee 27 p 41 Testing the compatibility mode 27 1 p 41 A framed display 27 2 p 42 A crazy inline display 27 3 p 43 Let us display and count all subsections occurring in this document see Part III for other uses of this technique etocsetnexttocdepth 2 begingroup etocsetlevel part 3 etocsetlevel section 3 etocsetstyle subsection small begin enumerate itemsep 0pt label leftmargin 0pt normalfont bfseries item roman enumi mdseries etocname etocnumber p etocpage end enumerate renewcommand etoccolumnsep 2 75em renewcommand columnseprule 1pt etocmulticol 3 subsection All subsections of this document endgroup 32 3 All subsections of this document i Limitations in the use of iv list environments for tables 4 3 p 8 of contents 3 1 p 6 Compatibility mode cignoretoctocdepth 11 1 p 16 vii The commands etoc ii etocsetstyle for the line styles 4 1 p 7 iii etocsettocstyle for the toc display 4 2 p 7 v The hyperref option bookmarksdepth 10 1 p 15 vi The commands etoc obeytoctocdepth and eto obeydepthtags and etoc ignoredepthtags 12 1 p 16 viii The hyperref option 55 32 and tricks hidelinks 13 1 p 17 ix A Beautiful Thesis ex ample 14 1 p 18 x A TOC with a back ground color 14 2 p 19 xi The etocname and etocpage commands 21
91. leavevmode to etoclink which should have been done earlier as it was included in etocname etc attention namedef A B and not namedef A B on the other hand this gives a simple way to insert a space as the first token in the paramaters For Etoc again which appears later in the code a firstofone construct is however the simplest of all 271 def Etoc lxyz 1 2 272 namedef etoclink leavevmode fall back 273 let etocthelink empty fall back 274 namedef etocname leavevmode 1 fall back perhaps linked 275 def etocthename 1 if link will be removed later 276 def etocthelinkedname 1 will probably get redefined 277 namedef etocpage leavevmode 2 perhaps linked 278 Etoc getthepage 2 etoc defines also etocthelinkedpage and etoclink 279 Etoc getnb 1 relax relax etoc gets number and name and etoclink 280 ifEtoc number else 281 Ni fEtoc part 282 Etoc getit 1 hspace relax etoc additional job for parts 283 fi 284 fi placeholder for comments 285 def Etoc getthepage 1 73 35 Implementation 286 let Etoc next Etoc getthepage nohyp 287 ifEtoc hyperref ifx 1 hyper linkstart 288 let Etoc next Etoc getthepage hyp 289 fi fi 290 Etoc next 1 291 292 def Etoc getthepage nohyp 1 etoc 293 def etocthepage 1 294 def etocthelinkedpage 1 295 1 07k corrects a bug here with an extra space before 441 in namedef etoclink
92. leofcontents one should be aware that package hyperref by default takes into account the current value of the tocdepth counter to decide whether the pdf file will contain a bookmark corresponding to sectioning commands encountered in the source file Thus one typically needs to reset tocdepth to its previous value after having temporarily modified it for a given table of contents Or there is the bookmarksdepth n option of package hyperref with n the desired doc ument bookmarks maximal depth which can be numeric or the name of a level known to hyperref This documentation previously passed bookmarksdepth 3 as option to hyperref so even if tocdepth was left to 1 by inadvertance after printing a certain table of contents this did not modify the bookmark tree of the pdf file Now that etocset nexttocdepth has been added to the package we have used it systematically and there was no need for bookmarksdepth 3 anymore 11 The command etocsettocdepth toc This command etocsettocdepth toc implements some functionality of tocvsec25 a package which however was incompatible with etoc it can still be used for its secnumdepth related commands but its toc related activities will get canceled by etoc and more or less designed for a single table of contents The action of etocsettocdepth toc is totally different than the one of etocset tocdepth Rather than modifying the tocdepth counter immediately it adds a line to the toc file which when exe
93. linkedname toks4 expandafter etocthelinkedpage edef toctablepiece the toks0 amp the toks2 amp the toks4 noexpand new version for 1 07k 2014 03 06 newcommand PrepareSubsection toks0 expandafter etocthelinkednumber toks2 expandafter expandafter itshape etocthelinkedname strut toks4 expandafter expandafter itshape etocthelinkedpage edef toctablepiece amp noexpand makebox 1cm c the toks0 noexpand parbox t dimexpr6cm tabcolsep relax noexpand sloppy the toks2 amp the toks4 noexpand etocsetstyle part PreparePart appendtotok toctabletok toctablepiece etocsetstyle section PrepareSection appendtotok toctabletok toctablepiece etocsetstyle subsection PrepareSubsection appendtotok toctabletok toctablepiece etocsettocstyle toctabletok hypersetup hidelinks 63 32 and tricks begin longtable gt bfseries c p 7cm r hline multicolumn 3 c Large bfseries strut TABLE OF CONTENTS hline hline global toctabletok expandafter the toctabletok hline end longtable etocsettocdepth subsection tableofcontents the toctabletok 32 7 Compatibility with other packages etoc loads the package multicol It is hyperref aware and hopefully hyperref compat ible It doesn t matter whether etoc or hyperref is loaded first Release 1 07k adds compatibility with package tocloft steps are taken to prevent the redefinition of t
94. llow 10 set up the top and bottom rules renewcommand etoctoprule hrule height 1pt renewcommand etoctoprulecolorcmd color red 25 renewcommand etocbottomrule hrule height 1pt renewcommand etocbottomrulecolorcmd color red 25 set up the left and right rules renewcommand etocleftrule vrule width 5pt renewcommand etocrightrule vrule width 5pt renewcommand etocleftrulecolorcmd color red 25 renewcommand etocrightrulecolorcmd color red 25 use fcolorbox to set up a colored frame for the title fboxrulelpt renewcommand etocbelowtocskip pt relax 24inside the figure environment and before the framed toc which uses multicols we added normal color as work around to an interaction bug related to the color red command we added to the toc file between multicols color and the figure environment This bug has nothing to do with etoc 42 27 3 A crazy inline display etocframedstyle normalsize rmfamily itshape fcolorbox red white parbox 8 linewidth centering This is a table of contents a la etoc but just for the sections and subsections in this part As it is put in a frame it has to be small enough to fit on one page It has the label toc b begin figure ht centering normalcolor work around to a bug involving color and multicols and figure tableofcontents label toc b ref toc globalcmds end figure endgroup This is a table of contents
95. lse 601 global Etoc notactivefalse 602 Etoc toctoc 603 fi fi 604 fi 605 Etoc next 606 Etoc resettocdepth 1 07g 607 etocaftercontentshook 608 2 nobreakfalse 1 07d nobreakfalse moved here placeholder for comments 609 def etocsetstyle Etoc standardfalse etoc setstyle 610 long def etoc setstyle 1 2 3 4 5 611 long expandafter def 612 csname Etoc begin csname Etoc 1 endcsname endcsname 2 613 long expandafter def 614 csname Etoc prefix csname Etoc 1 endcsname endcsname 3 615 long expandafter def 616 csname Etoc contents csname Etoc 1 endcsname endcsname 4 617 long expandafter def 618 csname Etoc end csname Etoc 1 endcsname endcsname 5 placeholder for comments 619 def etocfontminustwo normalfont LARGE bfseries 620 def etocfontminusone normalfont large bfseries 621 def etocfontzero normalfont large bfseries 622 def etocfontone normalfont normalsize bfseries 623 def etocfonttwo normalfont normalsize 624 def etocfontthree normalfont footnotesize placeholder for comments 625 def etocsepminustwo 4ex plus 5ex minus 5ex 626 def etocsepminusone 4ex plus 5ex minus 5ex 627 def etocsepzero 2 5ex plus 4ex minus 4ex 628 def etocsepone 1 5ex plus 3ex minus 3ex 629 def etocseptwo 5ex plus 161 minus lex 630 def etocsepthree 25ex plus 05ex minus 05ex placeholder for comments 631 def eto
96. medtoc 2 etocdefaultnbcol 957 etocframedstyle 1 2 958 localtableofcontents 959 newcommand etoc local framedtoci 2 etocdefaultnbcol 960 etocframedstyle 1 2 86 961 localtableofcontents placeholder for comments 962 def etocmulticol begingroup 963 Etoc mustclosegrouptrue 964 ifstar 965 etoc multicoltoci 966 etoc multicoltoc 967 def etocruled begingroup 968 Etoc mustclosegrouptrue 969 ifstar 970 etoc ruledtoci 971 etoc ruledtoc 972 def etocframed begingroup 973 Etoc mustclosegrouptrue 974 ifstar 975 etoc framedtoci 976 etoc framedtoc 977 def etoclocalmulticol begingroup 978 Etoc mustclosegrouptrue 979 ifstar 980 etoc local multicoltoci 981 etoc local multicoltoc 982 def etoclocalruled begingroup 983 Etoc mustclosegrouptrue 984 ifstar 985 etoc local ruledtoci 986 etoc local ruledtoc 987 def etoclocalframed begingroup 988 Etoc mustclosegrouptrue 989 ifstar 990 etoc local framedtoci 991 etoc local framedtoc placeholder for comments 992 def etocarticlestyle 993 etocsettocstyle 994 section contentsname 995 mkboth MakeUppercase contentsname 996 MakeUppercase contentsname 997 171 998 def etocarticlestylenomarks 999 etocsettocstyle 1000 section contentsname 1001 placeholder for comments 1002 def etocbookstyle 1003 etocsettocstyle 1004 if twocolumn
97. mmand etocmulticolstyle new documentation section Surprising uses of etoc which explains how to do Lists of ar bitrary things in addition to the tables of con tents v1 06 2012 12 07 the standard macros l section etc are modified only during the calls to tableofcon tents they can thus be customized as will by the user with the help of a package like tocloft 35 Implementation 1 NeedsTeXFormat LaTeX2e 2 ProvidesPackage etoc 3 2014 04 22 v1 071 Completely customisable 1065 jfB 4 RequirePackage multicol 5 DeclareOption PackageWarning etoc Option CurrentOption is unknown 6 ProcessOptions relax placeholder for comments 7 newtoks Etoc toctoks 8 def Etoc par par 9 def etocinline def Etoc par 10 let etocnopar etocinline 11 newif ifEtoc jj book 12 newif ifEtoc j part 13 newif ifEtoc chapter 14 newif ifEtoc i section 15 newif ifEtoc ii subsection 16 newif ifEtoc iii subsubsection 17 newif ifEtoc iv paragraph 18 newif ifEtoc v subparagraph 19 newif ifEtoc number 20 newif ifEtoc hyperref 21 newi f ifEtoc parskip 1 07d 22 newif ifEtoc tocwithid 23 newif ifEtoc standard 24 newi f ifEtoc part placeholder for comments 25 newif ifEtoc localtoc 26 newi f ifEtoc skipthisone 27 newi f ifEtoc stoptoc 28 newif ifEtoc notactive 29 newcounter etoc tocid 30 newi f ifEtoc mustclosegroup 31 def etoc etoc 1 07g us
98. molecule 29 IV Commands for the toc line styles 31 21 The etocsetstyle command 32 21 1 The etocname and etocpage com 32 mands 21 2 The etocskipfirstprefix com 33 mand 21 3 The etocnumber command 33 21 4 The etocthename etocthenum 34 ber and etocthepage commands 21 5 The etoclink command 34 61 32 62 and tricks 21 6 The etocthelinkedname etoc 35 thelinkednumber etocthe linkedpage and etocthelink commands 22 The etocsetlevel command 35 23 Scope of commands added to the toc file 36 23 1 Testing the scope 36 23 2 This is a pale red subsection for il 37 lustrative purposes 24 AmlIalso red 37 V Commande for the toc display style 37 25 Specifying the toc display style 38 25 1 The command etocsettocstyle 38 25 2 The commands etocmulti 38 colstyle etocmulticol and etoclocalmulticol 25 3 The commands etocruledstyle 39 etocruled and etoclocalruled 25 4 The commands etocframedstyle 39 etocframed and etoclocal framed 25 5 Headings titles etocoldpar 40 etocinnertopsep 25 6 The compatibility mode etocstan 40 darddisplaystyle 25 7 The command etocinline 41 26 Starred variants of the tableofcontents 41 etc commands 27 Table of contents for this part 41 27 1 Testing the compatibility mode 41 27 2 A framed display 42 27 3 A crazy inline display 43 VI Using and customizing etoc 45 28 Summary of the main
99. mple of colored TOC layout 31 p 52 28 Summary of the main style commands 28 1 Setting up local styles etocsetstyle evelname start prefix contents finish etocname etocnumber etocpage etocifnumbered A B etocthename etocthenumber etocthepage etoclink linkname 28 2 Setting up toc display styles etocmulticolstyle number_of_columns heading etoctocstyle kind number_of_columns title etoctocstylewithmarks kind number_of_columns title mark etoctocstylewithmarksnouc kind number_of_columns title mark etocruledstyle number_of_columns title etocframedstyle number_of_columns Ktitle etocsettocstyle before_toc after_toc 45 29 The package default line styles etocdefaultlines 28 3 Displaying tables of contents tableofcontents localtableofcontents etocmulticol number_of_columns heading etoclocalmulticol number_of_columns heading etocruled number_of_columns title etoclocalruled number_of_columns title etocframed number_of_columns title etoclocalframed number_of_columns title and their starred variants 28 4 Labels and references The commands starred or not to actually display the table of contents can be followed with optional labels or references tableofcontents label toc here tableofcontents ref toc far tableofcontents label toc he
100. nd etoclocalmulticol 25 2 p 38 The commands etocruled style etocruled and etoclocalruled 25 3 p 39 The commands etocframedstyle etocframed and etoclocalframed 25 4 p 39 Headings titles etocoldpar etoc innertopsep 25 5 p 40 The compatibility mode etocstandarddisplaystyle 25 6 p 40 The command etocinline 25 7 p 41 26 STARRED VARIANTS OF THE TABLEOFCONTENTS ETC COMMANDS 0000000000000 41 27 TABLE OF CONTENTS FOR THIS PART nun dl Testing the compatibility mode 27 1 0 41 A framed display 27 2 p 42 A crazy inline display 27 3 p 43 The code begingroup newcommand DotsAndPage nobreak leaders hbox bfseries normalsize hbox to 75ex hss hss hfill nobreak makebox rightskip r bfseries normalsize etocpage par etocsetstyle part parindent Opt nobreak etocskipfirstprefix pagebreak 3 bigskip large rmfamily bfseries scshape centering etocifnumbered Part etocnumber etocname par 1 etocsetstyle section leftskip Opt rightskip 75cm parfillskip rightskip nobreak medskip 10 etocskipfirstprefix leftskip Opt rightskip 75cm parfillskip rightskip pagebreak 1 smallskip normalsize rmfamily bfseries scshape etocnumber etocname DotsAndPage parfillskip Opt plus 1fil relax etocsetstyle subsection leftskiplcm rightskip 75cm
101. nd page number of each sectioning unit This goes via the definition of line styles for each sectioning level used in the document The package provides its own custom line styles Simpler ones are given as examples in the documentation The simplest usage will be to take advantage of the layout facilities of packages dealing with list environments Regarding the global toc display etoc provides pre defined styles based on a multi column format with optionally a ruled title or framed contents The tableofcontents command may be used arbitrarily many times and it has a variant localtableofcontents which prints tables of contents local to the cur rent surrounding document unit An extension of the label ref syntax allows to reproduce with another layout a local table of contents defined somewhere else in the document Via depth tags one gets an even finer control for each table of contents of which sectioning units it should or not display The formatting inherited and possibly customized by other packages from the document class will be used when in compatibility mode The assignment of levels to the sectioning units can be changed at any time and etoc can thus be used in a quite general manner to create custom lists of addition ally to the tables of contents related to the document sectioning units No auxiliary file is used additionally to the standard toc file 1 Foreword Popular packages dealing with TOC
102. nes 23the present document uses the scrartcl class and we check here that the etoc compatibility mode does respect the customizing done via the class commands 41 Contents tableofcontents ref toc globalcmds Contents 25 Specifying the toc display style 38 25 1 The command etocsettocstyle 38 25 2 The commands etocmulticolstyle etocmulticol and etoclocal MUITICOL aa ai a Be wal e a e dk at oma d 38 25 3 The commands etocruledstyle etocruled and etoclocalruled 39 25 4 The commands etocframedstyle etocframed and etoclocalframed 39 25 5 Headings titles etocoldpar etocinnertopsep 40 25 6 The compatibility mode etocstandarddisplaystyle 40 25 7 The command etocinline 41 26 Starred variants of the tableofcontents etc commands 41 27 Table of contents for this part 41 27 1 Testing the compatibility mode 41 27 2 Aframeddisplay 42 27 3 A crazy inline display aaa 43 27 2 A framed display We now opt for a framed style using the package default line styles and some colors added it has been put in a float which appears on the facing page etocdefaultlines begingroup renewcommand etoccolumnsep 2em renewcommand etocinnerleftsep 1 5em renewcommand etocinnerrightsep 1 5em specify a background color for the toc contents renewcommand etocbkgcolorcmd color ye
103. ng higher than zero and set tocdepth to the value 0 We also did etocset style visibletoc etocskipfirstprefix etocname which defines an inline display with the comma as separator Finally as etoc issues par automatically by default just before typesetting a table of contents we used the command etocinline also known as etocnopar which turns off this behavior Here are the implementation details lt in the preamble gt newcounter visibletoc renewcommand etocaftertitlehook stepcounter visibletoc etoctoccontentsline visibletoc thevisibletoc etocsetlevel visibletoc 6 begin document lt document body gt subsection Surprising uses of etoc begingroup etocinline etocsetlevel part 1 etocsetlevel chapter 1 no chapters in scrartcl class etocsetlevel visibletoc 0 etocsetstyle visibletoc etocskipfirstprefix color niceone etocname etocsettocstyle don t set any title rules or frame or multicol etocsetnexttocdepth visibletoc display only the visibletoc entries from toc Here is the numbered and linked list of all tables of contents which are displayed within this document tableofcontents endgroup using addtocontents rather than addcontentsline The package provides a starred variant etoctoccontentsline which does allow the creation of bookmarks and has a third mandatory argument which is the Level to be used by these bookmarks depending on
104. ng number is 32 The name of the last section is and tricks and its number is 32 The name of the first subsection is Hacking framed parboxes and the corresponding number is 32 1 The name of the last subsection is Errors and catastrophes and its number is 32 9 32 and tricks 54 32 1 Hacking framed parboxes 54 32 2 Interverting the levels cc 55 32 3 All subsections of this document 55 land reveals the author s preference for the TEX syntax 53 32 32 aie and tricks lama twin of that other TOC click me 25 Specifying the toc display style 38 38 25 1 The command etocsettocstyle 25 2 The commands etocmulticolstyle etocmulticol and 06106314 1 161 lt lt 44 lt 4 2 38 25 3 The commands etocruledstyle etocruled and Netoclocalruled EE 39 25 4 The commands etocframedstyle etocframed and Netoclocaliframe OU 39 25 5 Headings titles etocoldpar etocinnertopsep 40 25 6 The compatibility mode etocstandarddisplaystyle 40 25 7 The command etocinline 41 26 Starred variants of the tableofcontents etc commands 41 27 Table of contents for this part EN 41 27 1 Testing the compatibility mode 2m2 KEE ee Ter ent 42 213 A crazy ininedisplay m e e 43 32 4 Displaying statistics o oo 32 5 Us
105. nts label toc forest ref toc overview hypersetup hidelinks bracketset action character begin forest for tree anchor center child anchor west grow east draw thick edge draw thick dashed color teal where level 1 circle thick fill blue 5 before computing xy 1 3cm where level 2 fill red 5 before computing xy 1 6cm rectangle thick fill cyan 5 inner sep 6pt 28 the treetok end forest end figure Why hypersetup hidelinks as explained in subsection 13 1 I prefer the links in TOCS not to be colorized nor framed so this document inserts a command hypersetup hidelinks in the toc file But at the time the treetok contents are unpacked the hyperlink commands originating in etocthelinkedname etc will be executed in the normal environment for links which in this document is to colorize them Rather than having etoc s code try to guess what the current style for links is a concept not really provided by hyperref it seems and store it in etocthelinkedname etc Iopted for the simpler solution to leave it up to the user to recreate whatever conditions are desired So here it is necessary to re issue hypersetup hidelinks in the figure environment There are some other examples in this documentation where tableofcontents is used to prepare material for later typesetting e printing the statistics at the start of each Part see subsection 32 4 is done using save box
106. nts needs to be typeset etoc provides etocsettocdepth level whose mandatory argument is either nu meric from 3 to 5 or a division name such as subsection or subsubsection or any name previously declared to etoc with etocsetlevel the keywords all and none are recognized although not corresponding to a document division This does the appropriate setcounter tocdepth numeric_level As is explained in the next subsection tocdepth is used by hyperre f and one must take steps to prevent its changes from influencing the bookmarks too So etoc has etocset nexttocdepth evel whose influence ceases immediately after the next table of con and one should naturally not print this TOC of paragraphs in compatibility mode which would insist on inserting a gigantic left margin 14 10 1 The hyperref option bookmarksdepth tents Thus invisibletableofcontents is essentially etocsetnexttocdepth none tableofcontents The simplest course is thus to have after begin document and before the first tableofcontents a single instance of the etocsettocdepth command with argu ment the deepest level or most commonly used deepest level among the tables of con tents of the document and to use locally where needed etocsetnexttocdepth before tableofcontents or localtableofcontents 10 1 The hyperref option bookmarksdepth When modifying the counter tocdepth for the purposes of multiple uses of tableof contents or localtab
107. nvironments for tables of contents 6 Chapter 4 Line styles and toc display style 7 4 1 etocsetstyle for the line styles 7 4 2 etocsettocstyle for the toc display 7 4 3 Compatibility mode 8 Chapter 5 A first example 8 Chapter 6 A second example 9 Chapter 7 Linked list of the main package commands 11 14 2 A TOC with a background color Let us now try out some more sophisticated line styles The display will use the etoc framedstyle package command which requires that the produced table of contents fits on a single page We wrap it up in a figure environment showing up on the current page tableofcontents ref toc overview cf subsection 14 2 and this other toc The actual design is not pre built in etoc it uses its framed style with a background 19 15 The TOC of TOCs color The frame borders have been set to have the same color as the one serving as back ground for the entire thing This design with other colors is in use also for this other toc and the reader is referred to its subsection for the coding used Part III Surprising uses of etoc Here are some statistics for this part it contains 6 sections and 0 subsection The name of the first section is The TOC of TOCs and the corresponding number is 15 The name of the last section is The TOC as a molecule and its number is 20 15 The TOC of TOCs 20 16 Arbitrary Lists Of etoctoccontentsline 22 17 A TOC with a fan
108. ocbackground renewcommand etocrightrulecolorcmd color tocbackground renewcommand etocbottomrulecolorcmd color tocbackground renewcommand etoctoprulecolorcmd color tocbackground renewcommand etocleftrule vrule width 1cm renewcommand etocrightrule vrule width 5cm renewcommand etocbottomrule hrule height 12pt renewcommand etoctoprule hrule height 12pt renewcommand etocinnertopsep O0pt renewcommand etocinnerbottomsep Opt renewcommand etocinnerleftsep 0pt renewcommand etocinnerrightsep 0pt newcommand shiftedwhiterule 2 hbox to linewidth color white hskip 1 leaders vrule heightipt hfil nointerlineskip vskip 2 etocsetstyle subsubsection etocskipfirstprefix shiftedwhiterule leftskip 6pt sffamily footnotesize leftskip2 5cm hangindentlcm rightskiplcm noindent hbox to 1cm color subsecnum etocnumber hss color black etocname leaders hbox to 2cm hss hfill rlap hbox to 1cm hss etocpage hskip 2cm par nointerlineskip vskip3pt 1 etocsetstyle subsection etocskipfirstprefix shiftedwhiterule 1 5cm 6pt sffamily small leftskip1 5cm hangindentlcm rightskiplcm noindent hbox to 1cm color subsecnum etocnumber hss color black etocname leaders hbox to 2cm hss hfill rlap hbox to 1cm hss etocpage hskip 2cm par nointerlineskip vskip6pt newcommand coloredstuff 2 52 NleftskipOptirightskipOptiparskipOpt fboxs
109. ocname etocsetstyle section itshape etocskipfirstprefix mdseries etocname etocsetstyle subsection begin lrbox forsubsections upshape etocskipfirstprefix 1 etocname end lrbox footnote unhbox forsubsections etocsetstyle subsubsection itshape etocskipfirstprefix etocname upshape etocsettocstyle Here is the inline table of contents par tableofcontents endgroup 2 The hyperref option bookmarksdepth 2The commands etocobeytoctocdepth and etocignoretoctocdepth 2The commands etocobeydepthtags and etocignoredepthtags 3 The hyperref option hidelinks A Beautiful Thesis example A TOC with a background color The etocname and etocpage commands The etocskipfirstprefix command The etocnumber command The etocthename etocthenumber and etocthe page commands The etoclink command The etocthelinkedname etocthe linkednumber etocthelinkedpage and etocthelink commands Testing the scope This is a pale red subsection for illustrative purposes The command etocsettocstyle The commands etocmulticolstyle etoc multicol and etoclocalmulticol The commands etocruledstyle etoc ruled and etoclocalruled The commands etocframedstyle etocframed and etoclocalframed Headings titles etocoldpar etocinnertopsep The compat ibility mode etocstandarddisplaystyle The command etocinline Testing the compatibility mode A framed display A crazy
110. ocskipfirstprefix 29 20 The TOC as a molecule appendchildtree treetok sectiontok preparetreenode sectiontok expandafter treenode appendchildtree treetok sectiontok etocsetstyle subsection etocskipfirstprefix appendchildtree sectiontok subsectiontok preparetreenode subsectiontok expandafter treenode appendchildtree sectiontok subsectiontok etocsettocstyle treetok node hyperref part overview Overview global appendtotok treetok moved to the inside of the figure environment for correct pageref toc molecule etocsetnexttocdepth subsection tableofcontents label toc molecule ref toc overview A table of contents as a molecule The tableofcontents command appears just above the tikzpicture environment in a figure float for the label of the table of contents to certainly refer to the same page as the one where the picture will actually be printed We thus get the table of contents as a molecule which appears above Here is the code actually producing it begin figure th centering etocsetnexttocdepth subsection tableofcontents label toc molecule ref toc overview 30 hypersetup hidelinks begin tikzpicture grow cyclic level 1 style level distance 4cm sibling angle 72 level 2 style level distance 2cm sibling angle 60 every node style ball color red circle text SkyBlue edge from parent path dashed very thick color cyan t
111. of Contents or horizontal mode material like in the simple etocmulticolstyle Hello World No explicit par or empty line can be inserted in the mandatory argument of etocmul ticolstyle but etoc provides etocoldpar as a substitute it does let etocoldpar par before the multicols environment and inserts this etocoldpar at the end of the head ing then does a vertical skip of value etocinnertopsep The command etocoldpar can also be used explicitely if needed in the mandatory argument to etocmulticolstyle it is not allowed to insert an empty line in this argument On the other hand the commands etocruledstyle and etocframedstyle expect an argument in LR mode to use the terminology from LaTeX a document preparation sys tem This means that multiline titles are only possible if enclosing them inside something like a parbox An important dimension used by all three of etocmulticolstyle etocruledstyle and etocframedstyle is etocinnertopsep It gives the amount of separation between the heading and the start of the contents Its default value is 2ex and it is changed with Nrenewcommand etocinnertopsep new_value not with setlength 25 6 The compatibility mode etocstandarddisplaystyle etoc will then emulate what the document class would have done regarding the global display style of the table of contents in its absence All customizing from inside the class should be obeyed too 2http ctan org pkg mdfr
112. ond example This second example displays only the contents from Part IV and Part V This selection is done via the technique of depth tags described in section 12 and subsection 32 5 Its 6 A second example layout is a bit like the one of the main document TOC although the line styles are coded very differently CONTENTS PART IV COMMANDS FOR THE TOC LINE STYLES 21 THE ETOCSETSTYLE COMMAND 32 The etocname and etocpage commands 21 1 p 32 The etocskipfirstprefix com mand 21 2 p 33 The etocnumber command 21 3 p 33 The etocthename etoc thenumber and etocthepage commands 21 4 p 34 The etoclink command 21 5 p 34 The etocthelinkedname etocthelinkednumber etocthelinkedpage and etoc thelink commands 21 6 p 35 22 THE ETOCSETLEVEL COMMAND 35 23 SCOPE OF COMMANDS ADDED TO THE 106 PFULE AEN 30 Testing the scope 23 1 0 36 This is a pale red subsection for illustrative purposes 23 2 p 37 24 AMI S 2 37 24 AL TEE PART V COMMANDS FOR THE TOC DISPLAY STYLE 25 SPECIFYING THE TOC DISPLAY STYLE nun 38 The command etocsettocstyle 25 1 p 38 The commands etocmulticolstyle etocmulticol a
113. one def Etoc prefix Etoc prefix one or ifEtoc v Etoc end five fi ifEtoc iv Etoc end four fi ifEtoc iii Etoc end three fi ifEtoc ii else def Etoc next Etoc begin two fi def Etoc contents Etoc contents two def Etoc prefix Etoc prefix two or ifEtoc v Etoc end five fi ifEtoc iv Etoc end four fi ifEtoc iii else def Etoc next Etoc begin three fi def Etoc contents Etoc contents three def Etoc prefix Etoc prefix three or ifEtoc v Etoc end five fi ifEtoc iv else def Etoc next Etoc begin four fi def Etoc contents Etoc contents four def Etoc prefix Etoc prefix four or ifEtoc v else def Etoc next Etoc begin five fi def Etoc contents Etoc contents five def Etoc prefix Etoc prefix five else ifnum Etoc tmp m ne ifEtoc v Etoc end five fi ifEtoc iv Etoc end four fi ifEtoc iii Etoc end three fi ifEtoc ii Etoc end two fi ifEtoc i Etoc end one fi ifEtoc Etoc end zero fi ifEtoc j else def Etoc next Etoc begin minusone fi 251 def Etoc contents Etoc contents minusone 252 def Etoc prefix Etoc prefix minusone 253 else 254 ifEtoc v Etoc end five fi 255 ifEtoc iv Etoc end four fi 256 ifEtoc iii Etoc end three fi 257 ifEtoc ii Etoc end two fi 258 ifEtoc i Etoc end one fi 259 ifEtoc Etoc end zero fi 260 ifEtoc j Etoc end minusone fi 261 ifEtoc jj else def Etoc next Etoc begin minustwo fi 262 def Etoc contents Etoc contents m
114. ourse be changed in between Furthermore lo caltableofcontents will print local tables of contents i e all sections and sub units inside a given chapter or all subsubsections and lower inside a given subsection etc etoc allows the labeling of a TOC with for example label toc A and will re display it elsewhere when told tableofcontents ref toc A The actual layout title inclusive used for the cloned TOC will be decided locally The line styles and toc display style including the title will be the current ones and the current value of the tocdepth counter is obeyed As an example the table of contents of Part VI is in a float which appears on the facing page 12 am from far away 28 Summary of the main style commands 45 28 1 Setting up local styles 45 28 2 Setting up toc display styles 45 28 3 Displaying tables of contents 46 28 4 Labelsandreferences e 46 29 The package default line styles etocdefaultlines 46 30 Customizing etoc 50 30 1 Customizing the etoc pre defined line styles 50 30 2 Customizing the toc display styles 51 31 One more example of colored TOC layout 52 We used this begin figure ht centering begingroup etocstandardlines renewcommand etocbkgcolorcmd color green 5 renewcommand etocbelowtocskip pt relax fboxseplex etocframedstyle 1 fbox makeb
115. out this code and think about it 843 def etocframedmphook relax 844 long def etocbkgcolorcmd relax 845 long def Etoc relax relax placeholder for comments 846 newbox etoc framed titlebox 847 newbox etoc framed contentsbox 848 newcommand etocframedstyle 2 etocdefaultnbcol 849 etocsettocstyle 850 addvspace etocabovetocskip 84 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 sbox z 2 dimen z dp z ifdim wd z lt linewidth dp z z else dimen z z fi setbox etoc framed titlebox hb xt linewidth color begingroup hss ifx etocbkgcolorcmd Etoc relax else sbox tw color white vrule width wd z height ht z depth dimen z ifdim wd z lt linewidth dp tw z fi box tw hskip wd z fi copy z hss hskip linewidth etoctoprulecolorcmd leaders etoctoprule hss hskip wd z etoctoprulecolorcmd leaders etoctoprule hss color endgroup setbox z hbox etocleftrule etocrightrule dimen tw linewidth advance dimen tw wd z advance dimen tw etocinnerleftsep advance dimen tw etocinnerrightsep setbox etoc framed contentsbox vbox bgroup hsize dimen tw kern dimen z vskip etocinnertopsep hbox bgroup begin minipage hsize etoc
116. ox 5 linewidth etocfontminusone hyperref toc c I am from far away tableofcontents label toc d ref toc c endgroup end figure Important one should not use elsewhere tableofcontents ref toc d To clone again one must use a reference to the original label tableofcontents ref toc c 9 A powerful functionality of etoc the re assignment of levels with etocsetlevel The intrinsic levels manipulated by etoc are numeric from 2 which corresponds to book in the memoir class down from the big to the small to 5 subparagraph But the assignment of a numeric level to a given name can be modified at any time with the command etocsetlevel level_name number In conjunction with the use of the BIEX tocdepth counter this has powerful applications level_name does not have to coincide with an actual document sectioning command and etoc can be used to print arbitrary lists of things using no other auxiliary file than the toc file This is explained further in Part III 13 10 The etocsettocdepth and etocsetnexttocdepth commands It is often said that in the standard classes the sectioning level of part is 0 in the classes not having a chapter command and 1 in classes having a chapter command This is correct for what regards the automatic numbering as is governed by the value of the secnumdepth counter but it is wrong for what regards the effect of the tocdepth counter setting the tocdepth to
117. package commands Arbitrarily many TOCs and local ones too Labeling and reusing elsewhere A powerful functionality of etoc 25Limitations in the use of list environments for tables of contents 26 etocsetstyle for the line styles etocsettocstyle for the toc display Compatibil ity mode 43 Contents the re assignment of levels with etocsetlevel The etocsettocdepthand etocset nexttocdepth commands The command etocsettocdepth tocX8 The commands etocdepthtag toc and etocsettagdepth Adding commands to the toc file Two Examples Surprising uses of etoc The TOC of TOCs Arbitrary Lists Of etoc toccontentsline A TOC with a fancy layout Another compatibility mode The TOC as a tree The TOC as a molecule Commands for the toc line styles The etocset style command The etocsetlevel command Scope of commands added to the toc files Am I also red Commands for the toc display style Specifying the toc display style Starred variants of the tableofcontents etc commands Table of contents for this part Using and customizing etoc Summary of the main style commands The package default line styles etocdefaultlines Customizing etoc One more exam ple of colored TOC layout Tips and tricks 5 The code Timestamp Change history Implementation The code used begingroup newsavebox forsubsections etocsetstyle part upshape etocskipfirstprefix upshape bfseries et
118. pandafter 531 Etoc getrefno csname r 1 endcsname relax etoc 532 def Etoc ref 1 Etoc localtableofcontents Etoc getref 1 533 def Etoc label 1 label 1 futurelet Etoc nexttoken Etoc t bleofcontents 534 firstofone def Etoc again futurelet Etoc nexttoken Etoc t bleofcontents placeholder for comments 535 def Etoc t bleofcontents 536 ifx Etoc nexttoken label 537 def Etoc next expandafter Etoc label gobble else 538 ifx Etoc nexttoken sptoken 539 let Etoc next Etoc again else 540 ifEtoc tocwithid 541 def Etoc next Etoc localtableofcontents c etoc tocid 542 else 543 ifx Etoc nexttoken ref 78 544 def Etoc next expandafter Etoc ref gobble 545 else 546 def Etoc next Etoc localtocfalse 547 global Etoc notactivefalse 548 Etoc tableofcontents 549 endgroup 550 ifEtoc mustclosegroup endgroup fi 551 Etoc aftertochook 1 97h 552 etocaftertochook 1 07g 553 3 554 fi 555 fi fi fi Etoc next 1 07g for consistency Etoc prefix added 556 def Etoc table fcontents 557 refstepcounter etoc tocid 558 Etoc tocwithidfalse 559 futurelet Etoc nexttoken Etoc t bleofcontents 560 def Etoc localtable fcontents 561 refstepcounter etoc tocid 562 addtocontents toc 563 string etoc startlocaltoc arabic etoc tocid 564 Etoc tocwithidtrue 565 futurelet Etoc nexttoken Etoc t bleofcontents 1 07g defines etoctableofcontents to be able to undo the evil an
119. parfillskip Opt plus 1fil relax nobreak smallskip footnotesize sffamily mdseries itshape etocname etocnumber p etocpage par medskip etocsettagdepth preamble etocsettagdepth overview none none etocsettagdepth arbitrarily none etocsettagdepth surprising none etocsettagdepth linestyles subsection etocsettagdepth globalcmds subsection etocsettagdepth custom etocsettagdepth tips etocsettagdepth code none none none etocsettocstyle centering LARGE textsc contentsname par nobreak medskip etocsetnexttocdepth subsection tableofcontents endgroup 7 Linked list of the main package commands etocstandardlines etocdefaultlines etoctoclines etocsetstyle etocname etocpage etocskipfirstprefix etocnumber etocifnumbered etocthename etocthenumber etocthepage etoclink etocthelinkedname etocthelinkednumber etocthelinkedpage etocthelink etocsetlevel etocsettocdepth etocsetnexttocdepth etocsettocdepth toc etocobeytoctocdepth etocignoretoctocdepth etocdepthtag toc etocsettagdepth etocobeydepthtags etocignoredepthtags etocmulticol etoclocalmulticol etocruledstyle etocruled etoclocalruled etocframedstyle etocframed etoclocalframed etocinline etocaftertitlehook etocaftercontentshook etocaftertochook etocstandarddisplaystyle etoctoccontentsline etocsettocstyle etocmulticolstyle 11
120. pear to be lengths and that color commands are not just color specifications they must include color and are canceled by re defining them to do relax newcommand etocabovetocskip 3 5ex plus lex minus 2ex newcommand etocbelowtocskip 3 5ex plus lex minus 2ex newcommand etoccolumnsep 2em newcommand etocmulticolsep 0ex newcommand etocmulticolpretolerance 1 newcommand etocmulticoltolerance 200 newcommand etocdefaultnbcol 2 newcommand etocinnertopsep 2ex newcommand etoctoprule hrule newcommand etoctoprulecolorcmd relax for the framed style only newcommand etocinnerleftsep 2em newcommand etocinnerrightsep 2em newcommand etocinnerbottomsep 3 5ex newcommand etocleftrule vrule newcommand etocrightrule vrule newcommand etocbottomrule hrule newcommand etocleftrulecolorcmd relax newcommand etocrightrulecolorcmd relax newcommand etocbottomrulecolorcmd relax newcommand etocbkgcolorcmd relax hooks newcommand etocframedmphook relax The etocframedmphook is positioned immediately after the beginning of a minipage environment where the contents of the framed TOC are typeset The colorcmd commands are initially set to expand to relax hence do not require package color or xcolor to be loaded If one has modified a command such as etocbkgcolorcmd to expand to a color command and wants to reset it to do nothing one must use renewcommand etocbkgcolorcmd rel
121. r quad etocname 659 baselineskip etocbaselinespreadminustwo baselineskip 660 par 661 addpenalty M addvspace etocsepminusone 662 endgroup 663 664 part 665 etoc setstyle minusone 666 addpenalty M etocskipfirstprefix 667 addpenalty secpenalty 668 begingroup 669 etocfontminusone 670 addvspace etocsepminusone 671 parindent z 672 leftskip etocminusoneleftmargin 673 rightskip etocminusonerightmargin 674 parfillskip flushglue 675 vbox etocifnumbered etocpartname enspace etocnumber quad etocname 676 baselineskip etocbaselinespreadminusone baselineskip 677 par 678 addpenalty M addvspace etocsepzero 679 endgroup 680 681 chapter 682 etoc setstyle zero 683 addpenalty M etocskipfirstprefix 684 addpenalty itempenalty 685 begingroup 686 etocfontzero 687 addvspace etocsepzero 688 parindent z parfillskip flushglue 689 vbox etocifnumbered etocnumber enspace etocname 690 baselineskip etocbaselinespreadzero baselineskip 691 par 692 endgroup 693 addpenalty Ghighpenalty addvspace etocsepminusone 694 section 695 etoc setstyle one 696 addpenalty M etocskipfirstprefix 697 addpenalty itempenalty 81 35 Implementation 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727
122. re ref toc far localtableofcontents label toc here similarly with etocmulticol etc The commands for local tables of contents do not react to a ref following them When re displaying another toc only its contents are transferred both the line styles and the toc display style are the ones currently defined not the ones from the cloned toc 29 The package default line styles etocdefaultlines These line styles were written at an early stage in the development of the package although the next section explains how to customize the font choicess or vertical spaces etc used by these line styles most other changes would require copying them from the sources and modify them directly Admittedly they have been written at a rather scary low TgX level and will not serve as a very friendly starting point Activating their use is done via etocdefaultlines or etoctoclines if the line styles have not been modified with etocsetstyle Sections and sub sections are printed in essentially the same manner except that the leading for sub sections is a bit smaller with document classes lacking a chapter command the sections are printed in bold typeface this is the case in the present document Sub sub sections are printed inline in one paragraph with no numbers or page numbers This style was designed and tested with documents having lots of sub sub sections and should be used on a two column layout it provides only in that si
123. ref toc overview And as we used invisible the local TOC will exist only through its clones else where in the document We could use the line styles defined by etoc with etocdefaultlines or the de fault document class styles with etocstandardlines but we were a bit more ambitious here and wanted to design our own The technique is a simple one each heading is in its own paragraph which may extend on multiple lines it is responsible for setting its own leftskip My first etoc TOC of Part I Overview 3 Do I need to be a geek to use etoc 6 3 1 Limitations in the use of list environments for tables of contents 6 4 Line styles and toc display style 7 4 etocsetstyle for the line styles 7 Sfor the toc display style etoc checks if it knows the class and if not defaults to the article class layout It will also check if tocloft has customized the TOC title Sthis is a shortcut for setting temporarily the tocdepth to 3 which has the effect to tell etoc not to print the TOC and not even the heading 4 2 etocsettocstyle for the toc display 7 4 3 Compatibility mode 8 5 A first example 8 6 A second example 9 7 Linked list of the main package commands 11 This is a simple design which does not make provisions for page breaks which should be discouraged in between a section and a subsection etc as we only used it for the table of contents of this part thus with sections as top levels there was no need to
124. rmalfont normalsize 1096 etocmemoirtoctotocfmt chapter contentsname 1097 renewcommand etocstandarddisplaystyle etocmemoirstyle 1098 Etoc redefetocstyle chapter 1 07k 2014 03 06 adds the compatibility with the tocloft package in compatibility mode etoc will obey the tocloft customisation for the division headings as well as for the toc title 1 071 2014 04 02 fixes the bug from the tocloft compatibility layer which was memoir incompatible memoir has its version of tocloft which doesn t have the if cftnctoc boolean 1099 def etoctocloftstyle 1100 etocsettocstyle 1101 cfttocstart par begingroup 1102 parindent z parskip cftparskip cftmaketoctitle 1103 if cfttocbibind cftdobibtoc fi 1104 endgroup cfttocfinish 1105 1106 ifclassloaded memoir 1107 ifpackageloaded tocloft 1108 if cftnctoc else 1109 renewcommand etocstandarddisplaystyle etoctocloftstyle 1110 AtBeginDocument let tableofcontents etoctableofcontents 1111 fi gt 1112 AtBeginDocument 1113 ifpackageloaded tocloft 1114 if cftnctoc else 1115 PackageWarning etoc 1116 Package tocloft was loaded after etoc A44J 89 35 Implementation 1117 to prevent it from overwriting protect tableofcontents it will be tricked44J 1118 into believing to have been loaded with option titles For better44J 1119 compatibility please load tocloft before etoc 1120
125. s decided at the time the TOC gets typeset thus with the shuffling abilities of etoc one may obtain a very flexible control in the following way one first declares with etocsetlevel some dummy named level say partIII assigning it the invisible numeric level 6 Then before the actual third part command in the source one inserts etocsettocdepth toc partIII At the location where the effect should cease one inserts in the source etocsettocdepth toc all It is now possible to specify each time one wants to typeset a TOC what will be the finest level for the entries originating in the third part one just has to do etocsetlevel partIII 1 for example This will limit to sections if tocdepth was at least at that level at the time tableofcontents is encountered This method has some limitations i the second argument to etocsetlevel must be numeric ii it can not be set to 3 which would be necessary if one wanted to exclude an entire Book from a TOC in a memoir document with multiple such Books admittedly a possibly rare case iii it is a bit of a hack as partIII is not a real division unit but just a tag Release 1 07h has a command etocdepthtag toc which makes it easier to achieve this variable local control of the tocdepth at the time of typesetting TOCs It is used as etocdepthtag toc tag_name where the tag_name is anything and this will put the tag in the toc file When typesetting a TOC one issues a series o
126. s include tocloft titletoc and minitoc Why an other one I started etoc for my own use and found out only later about these mentioned packages As is well explained in the tocloft package documentation the standard ATEX lay out for the Table of Contents is buried in the class definitions In particular most of the 2 License installation lengths therein are hardcoded and the only way for the user to change them is to recopy the class definitions into the document and then change them to obtain what is desired within suitable makeatletter and makeatother The more reasonable alternative is to use a dedicated package such as tocloft or to use another flexible document class However although now things are hopefully not hard coded one still has to go through the package or class interface This means one has to memorize a possibly large num ber of macros which will serve only to this task and one will always be constrained to customizing one initially given layout The spirit of etoc is something else The user will deal with the name the number and the page number corresponding to each document sectional division and found in a line of the toc file in a completely arbitrary manner they are made available via the etocname etocnumber and etocpage commands etoc appears to be at least partially compatible with the article book report scrartcl scrbook scrreprt and memoir classes Starting with release 1 07k it is pos
127. sed until its contents are again written to the disk by ISTFX at the end of the compilation etoc can not really cohabit with packages modifying the tableofcontents command some sort of truce can be achieved if etoc is loaded last hence is the winner Do not modify the tableofcontents command like this let oldtableofcontents tableofcontents renewcommand tableofcontents oldtableofcontents mystuff as this will make the label ref mechanism impossible Rather you may do renewcommand etocaftertochook mystuff and there is also etocaftercontentshook which is executed a bit earlier just be fore the closing part of the toc display style and thus still within a group http ctan org pkg tocloft 64 32 8 TgXnical matters etoc used to be incompatible with package tocvsec2 it now cohabits sort of as it deactivates tocvsec2 s modification of tableofcontents done in the style above and also cancels its other toc related macros but reimplements partially their functionality with etocsettocdepth toc By the way at least two latex runs are necessary for new uses of this command in a document to have an effect in tables of contents When a localtableofcontents is inserted by the user in the document a line con taining an etoc inner command and an identification number is added to the toc file The correct local table of contents will be displayed only on the next latex run etoc expects the documen
128. serting addtocontents toc string clearpage just before a part to fix the problem when some part entry in the table of contents is isolated at the bottom of one page will cause problems with multiple TOCs this clearpage will be executed by etoc each time a tableofcontents or localtableofcontents command is encountered The more prudent thing is to do rather addtocontents toc string myclearpage to have a let myclearpage relax at the top level of the document and to use where needed something like let myclearpage clearpage tableofcontents let myclearpage relax The memoir class has the command settocdepth which writes a changetocdepth command inside the toc file This will impact the typesetting by etoc of all tables of contents with possibly unexpected results imagine the document has settocdepth chapter at some point to avoid having the sections from subsequent chapters be listed in the main table of contents Then a local table of contents in one of these chapters will print a title but will be without any entry As the memoir class by itself allows multiple tableofcontents these issues already arise there independently of etoc see page 170 of the memoir manual For this specific issue the commands etocsettocdepth toc etocignoretoc tocdepth and etocobeytoctocdepth are the way to go or their variants etocdepth tag toc and etocsettagdepth As an aside any setcounter tocdepth n command added directly to
129. sname Etoc four 69 35 Implementation Etoc 1 endcsname Etoc five Etoc 1 endcsname Etoc five Etoc 1 endcsname Etoc six Etoc 1 endcsname Etoc minusone Etoc 1 endcsname Etoc minusone Etoc 1 endcsname Etoc minustwo Etoc 1 endcsname Etoc minustwo unexpected value 2 in string etocsetlevel XA Should be 2 1 0 1 2 3 4 5 or 6 Set to 6 ignored 85 or 86 expandafter let csname 87 expandafter let csname 88 or 89 expandafter let csname 90 else 91 ifnum 2 m ne 92 expandafter let csname 93 expandafter let csname 94 else 95 ifnum 2 tw 96 expandafter let csname 97 expandafter let csname 98 else 99 PackageWarning etoc 100 101 102 expandafter let csname 103 fi fi fi 104 etocsetlevel book 2 105 etocsetlevel part 1 106 etocsetlevel chapter 0 107 etocsetlevel section 1 108 etocsetlevel subsection 2 109 etocsetlevel subsubsection 3 110 etocsetlevel paragraph 4 111 etocsetlevel subparagraph 5 placeholder for comments 112 def Etoc setflags 1 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 70 ifcase 1 relax global Etoc vfalse global Etoc ivfalse global Etoc iiifalse global Etoc iifalse global Etoc ifalse global Etoc true or global Etoc vfalse global Etoc ivfalse global Etoc iiifalse glo
130. st section is Do I need to be a geek to use etoc and the corresponding number is 3 The name of the last section is Linked list of the main package commands and its number is 7 The name of the first subsection is Limitations in the use of list environ ments for tables of contents and the corresponding number is 3 1 The name of the last subsection is Compatibility mode and its number is 4 3 3 Do I need to be a geek to use etoc Not quite The simplest way is to use enumerate environments with the customizing fa cilities of packages such as enumi tem to display the data fetched by etoc from the toc file The data consists of the name etocname number etocnumber and page number etocpage as extracted from the toc file This is illustrated at the start of Part IV More sophisticated examples would use more sophisticated enumitem options One may say then that again the user has to memorize some customizing indeed but the syntax and option names to memorize are in no way related only to matters of tables of contents hence an economy of use of the poor brain Next in ease of use perhaps is the method explained later in this part section 5 For this some knowledge of leftskip rightskip etc is necessary And a slight elaboration of this method whose code is to be found in subsection 32 5 allows to mimick very well if so desired the standard looks As will be amply illustr
131. style commands 45 28 1 Setting up local styles 45 28 2 Setting up toc display styles 45 28 3 Displaying tables of contents 46 28 4 Labels and references 46 29 The package default line styles etocde 46 faultlines 30 Customizing etoc 50 30 1 Customizing the etoc pre defined 50 line styles 30 2 Customizing the toc display styles SI 31 One more example of colored TOC layout 52 VII Tips 53 32 6 Typesetting the TOC as a table 32 and tricks 54 32 1 Hacking framed parboxes 54 32 2 Interverting the levels 55 32 3 All subsections of this document 55 32 4 Displaying statistics 56 32 5 Using depth tags 58 32 6 Typesetting the TOC as a table 60 32 7 Compatibility with other packages 64 32 8 TEXnical matters 65 32 9 Errors and catastrophes 66 VII The code 67 33 Timestamp 67 34 Change history 67 35 Implementation 68 newtoks toctabletok newcommand appendtotok 2 1 toks variable 2 macro expands once 2 1 expandafter expandafter expandafter expandafter the expandafter 1 2 newcommand PreparePart toks0 expandafter etocthelinkednumber toks2 expandafter etocthelinkedname toks4 expandafter etocthelinkedpage edef toctablepiece noexpand hline strut the toks0 amp noexpand bfseries the toks2 amp the toks4 noexpand noexpand hline newcommand PrepareSection toks0 expandafter etocthelinkednumber toks2 expandafter etocthe
132. t sectioning units to write their data into the file having ex tension toc in the form of lines containing the contentsline command and its ar guments The macros etocname etocnumber and etocpage contain the hyperref links if present note that the linktoc all option of hyperref tells it to put a link also in the page number corresponding to a given toc entry For example the tables of contents of the present document are all fully linked It is possible to customize using package tocloft for example throughout the docu ment the macros 1 section 1 subsection and the effect will be seen in the next table of contents typeset by etoc in compatibility mode It is possible to use simultaneously etoc and tableof For the advanced uses such as what is done in section 20 it is important to know that tableof adds one level of group ing inside the toc file itself So when one needs to make some information global one can not wait to be at the level of the second argument of etocsettocstyle as tableof will already have closed the group then The global things on volatile data must be done at the latest in the finish part of the top or last sectioning level used This only applies of course to tableofcontents or localtableofcontents following the nexttocwithtags required forbidden command from tableof And when the commands tableof or tablenotof of package tableof are used they typeset the table of contents according to th
133. the toc file sees its effect since release 1 07g canceled at the end of each table of contents which automatically does a setcounter tocdepth previous_value with the value active on entering the table of contents 13 1 The hyperref option hidelinks The colored links and also the rectangle links are a bit annoying when used in tables of contents especially when the document uses etoc and has plenty of them One may wish for having colored links except for those within table of contents Indeed why would things in TOCs need to be either framed in rectangles or colored when the user already expects them to be links I use the following trick either in the preamble using AtBeginDocument or right after begin document I have the command addtocontents toc protect hypersetup hidelinks 17 14 Two Examples All TOCs typeset by etoc have their contents done within a group as if enclosed in an environment So the command hypersetup hidelinks will be executed by each TOC but its effect will be limited to that TOC I found out experimentally that the option hidelinks could indeed be set many times with hypersetup this is not the case of all hyperref options 14 Two Examples 14 1 A Beautiful Thesis example Here is another relatively simple example of use of the package functionalities Let us set up some line styles We choose a style for sections and sub sections which would be suitable for respecti
134. the context the starred as well as the non starred variants may be profitably preceded by phantomsection 21 16 Arbitrary Lists Of etoctoccontentsline After etocsetstyle visibletoc all future TOCs not in com patibility mode will use the defined style for level 0 which is normally the level for chap ters To keep these changes strictly local the simplest manner is to put everything inside a group The subsection 32 2 gives another use of the shuffling of levels 16 Arbitrary Lists Of etoctoccontentsline This idea of interverting the levels is very powerful and allows to let etoc display lists of arbitrary things contained in the document All of that still using nothing else than the toc file Example imagine a document with dozens of exercises perhaps defined as newtheorem exercise section Let us explain how to instruct etoc to display an hyperlinked list of all these exercises For this we put in the preamble newtheorem exerci section the exercice number will be recoverable via etocname v here v newcommand exercisetotoc etoctoccontentsline exercise theexerci newenvironment exercise begin exerci exercisetotoc end exerci etocsetlevel exercise 6 In this way etocname will give the exercise number but etocnumber will be empty Had we used instead newcommand exercisetotoc etoctoccontentsline exercise protect numberline theexerci th
135. the toc display style 26 Starred variants of the tableofcontents etc commands 41 27 Table of contents for this part 41 27 1 Testing the compatibility mode 41 27 2 A framed display 42 27 3 A crazy inline display 43 25 Specifying the toc display style The toc display style says whether the TOC appears with multiple columns or just one whether the title is typeset as in the article or book class or should be centered above the entries with rules on its sides or if the entire TOC should be put in a frame For example to opt for a ruled heading and single column layout one issues commands of the following type etocruledstyle 1 Title tableofcontents or localtableofcontents shortcuts etocruled 1 Title or etoclocalruled 1 Title 25 1 The command etocsettocstyle This is a command with two mandatory arguments etocsettocstyle before_toc after_toc The before_toc part is responsible for typesetting the heading for example it can be something like section contentsname Generally speaking this heading should leave TEX in vertical mode when the actual typesetting of the contents will start the line styles either from the standard classes or the package default line styles all expect to get started in vertical mode The first argument to etocsettocstyle can also contain instructions to mark the page headings Or it could check book class to s
136. tuation with many sub sub sections a more compact presentation than what is achieved by the LIN default On the other hand used with a one column Hand there will never be a Part or Chapter entry alone at the bottom of a column or page except if it has no sub unit 46 layout and with few sub sub sections the style is a bit more spread out vertically than the I amp TFX default sub sections are not visually much different from sections especially for document classes with a chapter command so the result is less hierarchical in appear ance than in the TEX default In this document for the main table of contents we did etocsetlevel subsection 3 hence the sub sections were printed with the sub sub section inline style Let us to the contrary typeset now this main table of contents as if the document had been done with a class having the chapter command we will print sections as chapters and subsections as sections We use etocsetlevel for that and also we need to change the font style of sections which in truth are our subsections to use not the bold but the medium series we modify the etocfontone command for that Also we use dot leaders which are less spread out than in the package default etocruledstyle 2 normalfont normalsize rmfamily itshape fbox parbox 6 linewidth leftskip Opt plus 5fil rightskip Opt plus 5fil parfillskip pt plus 1fil This is the global table of contents on two columns
137. uch problem arises either when using forest or the native tikz syntax for trees which will be illustrated in the next section 26 side etocname etc is just a pointer not storable for later use but the package pro vides etocthelinkednumber etocthelinkedname and etocthelinkedpage whose contents contain the hyperlink in a form which can be stored and later reused For this forest tree we have designed very special etoc styles for sections and subsec tions They use a token list register called treetok and a macro appendtotok whose 1016 is to append to a given token list variable the contents of a macro given as second argument All this will happen in reaction to a tableofcontents command but nothing has yet been printed in the process This is the later job of a forest environment which will be given the contents of treetok Do need tobea Limitations in the use of list i geek to environments for tables of contents i use etoc _ etocsetstyle for the line styles etocsettocstyle for the toc display gt 4 Compatibility mode Line styles and toc display style A first example A second example Linked list of the main package commands A table of contents displayed as a forest tree 17There is always a par which here is not a problem but can be suppressed if need be via the command etocinline or its synonym etocnopar 27 19 The TOC asa tree The result
138. uctions such as global let lastone etocthename in an etoc line style will define the macro lastone to expand to the last name seen at the corresponding level But no facilities was previously available to do the same with the link data The package now provides etocthelinkedname to do the similar thing with the link data included It was used in this documentation when doing the examples with trees Also provided with the similar goal etocthelinkednumber etocthelinked page which contains a link only if hyperref added one to the page number and etocthelink linkname which allows to make a link with an arbitrary name All these commands are fragile Example of use a table of contents done as an inline enumitem environment 25 Spec ifying the toc display style p 38 26 Starred variants of the tableofcontents etc commands p 4 and 27 Table of contents for this part p 4 Example of use begingroup etocsetstyle section begin itemize itemjoin itemjoin and global let TmpEtocNumber etocthelinkednumber global let TmpEtocName etocthelinkedname global let TmpEtocPage etocthelinkedpage the above needed as item closes a group in enumitem inline environments item bfseries TmpEtocNumber TmpEtocName emph p TmpEtocPage end itemize etocsetnexttocdepth section etocsettocstyle a table of contents done as an inline texttt enumitem environment etocinline t
139. umerate environments but it is much better to use the further command etocnum ber inside the item label which gives the real thing The improved definitions will thus be explained later 8the present document has renewcommand familydefault sfdefault in its preamble hence normal font switches to the sans typeface so in the section line style wrote rmfamily instead 32 21 2 The etocskipfirstprefix command Each etocsetstyle command has five mandatory arguments etocsetstyle levelname start prefix contents finish The initially recognized levelname s are the sectioning levels of the standard document classes from part or book which is used by the memoir class down to subparagraph The start code is executed when a toc entry of that level is encountered and the previous one was at a higher level The finish code is executed when one again encounters a higher level toc entry In the mean time all entries for that level are typeset by executing first the prefix code and then the contents code The robust commands etocname etocnumber and etocpage are provided for use inside the prefix and contents parts of the etocsetstyle specification They rep resent of course the name number and page number of the corresponding toc entry If package hyperref is active in the document and has added hyperlinks to the TOC data then these links are kept in the commands etocname etocnumber and
140. vely sections and sub sections in an average length memoir The line style specifications have some redundancy for clarity and do not care about what to do at possible page breaks Also they do not worry about potential multi column use begingroup we start a group to keep the style changes local newlength tocleftmargin setlength tocleftmargin 5cm newlength tocrightmargin setlength tocrightmargin 1cm etocsetstyle section will pretend to be a Chapter addvspace lex parfillskip pt leftskip tocleftmargin already done in title rightskip the tocrightmargin plus 1fil parindent pt color cyan already done bfseries LARGE upshape addvspace lex leavevmode llap Chapter hspace 5em etocnumber hspace 75cm etocname hfill makebox tocrightmargin 1 makebox Opt etocpage par etocsetstyle subsection will pretend to be a Section mdseries large addvspace 5ex leavevmode llap etocnumber hspace 75cm textit etocname hfill makebox tocrightmargin 1 makebox 0pt etocpage par def tmptitle My Beautiful Thesis etocsettocstyle color cyan parindentOpt leftskip tocleftmargin leavevmode leaders hrule height ipt hfill huge textit tmptitle par bigskip tableofcontents ref toc overview endgroup My Beautiful Thesis Chapter 3 Do I need to be a geek to use etoc 6 18 14 2 A TOC with a background color 31 Limitations in the use of list e
141. wd tw ifdim dimen z lt linewidth vbox etocname leaders box z hfil box tw baselineskip etocbaselinespreadtwo baselineskip par else vbox etocname leaders copy z hfil break hbox leaders box z hfil box tw baselineskip etocbaselinespreadtwo baselineskip 755 par 756 fi 757 endgroup 758 addpenalty secpenalty addvspace etocsepone 759 subsubsection 760 etoc setstyle three 761 addpenalty M 762 etocfontthree 763 vspace etocsepthree 764 noindent 765 etocskipfirstprefix 766 allowbreak 767 etocname 768 hfil 769 begingroup 770 baselineskip etocbaselinespreadthree baselineskip 771 par 772 endgroup 773 addpenalty highpenalty placeholder for comments 774 etoc setstyle four 775 etoc setstyle five 776 end of etocdefaultlines The etocinnertopsep default value is too big as well as etocbelowtocskip and etocabovetocskip I guess but if I am remember correctly I chose them to mimick the standard TOC spacings in article class 777 def etocabovetocskip 3 5ex plus lex minus 2ex 778 def etocbelowtocskip 3 5ex plus lex minus 2ex 779 def etoccolumnsep 2em 780 def etocmulticolsep 0ex 781 def etocmulticolpretolerance 1 782 def etocmulticoltolerance 200 783 def etocdefaultnbcol 2 784 def etocinnertopsep 2ex 1 07i adds a nobreak before the etocinnertopsep and a test of vertical mo
142. wsavebox lastnameii newcounter mycounti 56 newsavebox lastnumberii newcounter mycountii 32 4 Displaying statistics newcommand thispartstatsauxi newcommand thispartstatsauxii newcommand oldtocdepth newcommand thispartstats setcounter mycounti 0 setcounter mycountii 0 def thispartstatsauxi sbox firstnamei etocname sbox firstnumberi etocnumber def thispartstatsauxi def thispartstatsauxii sbox firstnameii etocname sbox firstnumberii etocnumber def thispartstatsauxii begingroup etocsetstyle subsection thispartstatsauxii stepcounter mycountii sbox lastnameii etocname sbox lastnumberii etocnumber etocsetstyle section thispartstatsauxi stepcounter mycounti sbox lastnamei etocname sbox lastnumberi etocnumber Here are some statistics for this part it contains arabic mycounti section ifnum value mycounti gt 1 s fi and arabic mycountii subsection ifnum value mycountii gt 1 s fi The name of the first section is unhbox firstnamei and the corresponding number is unhbox firstnumberi The name of the last section is unhbox lastnamei and its number is unhbox lastnumberi The name of the first subsection is unhbox firstnameii and the corresponding number is unhbox firstnumberii The name of the last subsection is unhbox lastnameii and its number is unhbox lastnumberii etocinline cancels
Download Pdf Manuals
Related Search
Related Contents
USER`S MANUAL - Pdfstream.manualsonline.com Druck DBC 150/650 Series FWT 335 - OmniCell Communications Carrier 48GX User's Manual User Guide - Dolphin Computer Access Char-Broil 2584727 Carbon Monoxide Guide - Backus Property Management Pairing the Camera with Your Monitor user manual for the email marketing platform Copyright © All rights reserved.
Failed to retrieve file