========================== xtitletoc.tex begins \documentclass{article} \usepackage{xtitletoc} \IgnoreWhiteSpace \DeclareInstance{contentsobject}{section}{JB1}{ pre-action = \DelayEvaluation{\addvspace{1pc plus 1pt}}, right-adjust = 3pt, title-format = \textbf{#1}, label-format = \textbf{\thecontentslabel}, left-margin = \DelayEvaluation{1.5em}, label-width = \DelayEvaluation{1.5em}, page-format = \textbf{\hfil#1}, leaders-text = .} % current left-margin = previous left-margin + label-width \DeclareInstance{contentsobject}{subsection}{JB1}{ right-adjust = 3pt, left-margin = \DelayEvaluation{3.8em}, label-width = \DelayEvaluation{2.3em}} \DeclareInstance{contentsobject}{subsubsection}{JB1}{ right-adjust = 3pt, left-margin = \DelayEvaluation{7em}, label-width = \DelayEvaluation{3.2em}} %======================== \DeclareCollectionInstance{runin}{contentsobject}{section}{JB2} { pre-action = \addvspace{3pt plus .2pt}, decls = \itshape, right-margin = 0pt, punct-sub = \ (, punct-end = . } \DeclareCollectionInstance{runin}{contentsobject}{subsection}{JB2} { decls = \itshape, right-margin = 0pt, punct-sup = );\ , punct-end = ). } \begin{document} \newcommand\testtoc[1]{ \section*{THE TEST: #1} \contentsobject {1}{1}{section}{1}{A first section}{}{1} \contentsobject {2}{2}{subsection}{1.1}{A first subsection}{}{1} \contentsobject {3}{2}{subsection}{1.2}{A second subsection with an awful long title: some text or other to get us going right?}{}{1} \contentsobject {4}{3}{subsubsection}{1.2.1}{A direct subsubsection}{}{1} \contentsobject {5}{1}{section}{\NoValue }{Heading two as section}{}{1} \contentsobject {6}{2}{subsection}{1.3}{With a direct subsection}{}{1} \contentsobject {7}{3}{subsubsection}{1.3.1}{And some subsubsection}{}{1} \contentsobject {13}{1}{section}{2}{And another section}{}{1}\tracingcode \contentsobject {14}{2}{subsection}{2.1}{that has a subsection}{}{1} \contentsobject {15}{1}{section}{3}{A test}{}{2} \contentsobject {16}{2}{subsection}{\NoValue }{with an unnumbered subsection}{}{2} \csname ttl@finish\endcsname %% Added by titletoc to the toc file } \testtoc{1} \setcounter{tocdepth}{2} \UseCollection{contentsobject}{runin} \testtoc{2} % to add another toc example (chose a collection name FOO) % add some CollectionInstances above and do: %\UseCollection{contentsobject}{FOO} %\testtoc{3} \stop ============================ xtitletoc.tex ends