\ExecuteOptions{leftlabels,nodotinlabels} \ProcessOptions % [...] \def\ttl@toctop{-1000} %[...] \@tempskipa\@pnumwidth \edef\@pnumwidth{\the\@tempskipa} \advance\@tempskipa-\@tocrmarg \edef\ttl@corr{-\the\@tempskipa} % Now the templates: \IgnoreWhiteSpace \newdimen\@tempdimd \newdimen\@tempdime \DeclareTemplateType{contentsobject}{7} \DeclareTemplateType{processcontents}{0} \def\comma{,} \DeclareTemplate{contentsobject}{JB1}{7}{ pre-action =f0 [] \COpre@action, post-action =f0 [] \COpost@action, decls =f0 [] \COobject@decl, left-margin =l [15pt] \@tempdimd, right-margin =l [\@pnumwidth] \@tempdime, right-adjust =l [\ttl@corr] \@tempdimb, label-format =f0 [\thecontentslabel] \COnumber@format, label-width =l [15pt] \@tempdima, title-format =f1 [#1] \COtitle@format, title-format-nolabel =f1 [\COtitle@format{#1}] \COtitle@format@nolbl, page-format =f1 [#1] \COpnum@format, leaders-text =f0 [.] \COleaders@action, leaders-width =l [1pc] \@tempdimc } {\IfNoValueTF{#4} {\let\thecontentslabel\@empty \ttl@numsecfalse} {\gdef\thecontentslabel{#4} \ttl@numsectrue} \gdef\thecontentspage{#7} \DoParameterAssignments \ttl@tocentry {\@ne} {#3} {\@tempdimd} {\contentsmargin[\@tempdimb]{\@tempdime} \COpre@action \COobject@decl} { {\contentslabel[\COnumber@format]{\@tempdima}\COtitle@format} {\hspace*{-\@tempdima}\COtitle@format@nolbl} } {\titlerule*[\@tempdimc]{\COleaders@action} \contentspage[\COpnum@format{\thecontentspage}]} {\COpost@action} {#5} {}} \DeclareTemplate{contentsobject}{JB2}{7}{ pre-action =f0 [] \COpre@action, post-action =f0 [] \COpost@action, decls =f0 [] \COobject@decl, left-margin =l [15pt] \@tempdimd, right-margin =l [\@pnumwidth] \@tempdime, label-format =f0 [\thecontentslabel.\ ] \COnumber@format, title-format =f1 [#1] \COtitle@format, title-format-nolabel =f1 [\COtitle@format{#1}] \COtitle@format@nolbl, page-format =f1 [{,~#1}] \COpnum@format, punct-sep =f0 [;\ ] \COpunct@sep, punct-end =f0 [.] \COpunct@end, punct-sup =f0 [;\ ] \COpunct@sup, punct-sup-sup =f0 [;\ ] \COpunct@supsup, punct-sub =f0 [;\ ] \COpunct@sub } {\IfNoValueTF{#4} {\let\thecontentslabel\@empty \ttl@numsecfalse} {\gdef\thecontentslabel{#4} \ttl@numsectrue} \gdef\thecontentspage{#7} \DoParameterAssignments \expandafter\protected@xdef\csname ttle@#3\endcsname{\COpunct@end} \ttl@tocentry {\z@} {#3} {\@tempdimd} {\contentsmargin[\@tempdimb]{\@tempdime} \COpre@action \COobject@decl} { {\COnumber@format\COtitle@format} {\COtitle@format@nolbl} } {\COpnum@format{\thecontentspage}} {\protect\contentsafter{\COpunct@sub}{\COpunct@sep} {\COpunct@sup}{\COpunct@supsup}} {#5} {}} \DeclareTemplate{processcontents}{JK}{0}{ start-action =f0 [\relax] \COstart@action, end-action =f0 [\relax] \COend@action, file-name =n [\jobname] \COfile@name, file-extension =n \COextension, contents-depth =c [2] \c@tocdepth, collection-id =n [] \COcollection@id, heading =f0 [\section*]\COheading, %actully use some instance name =n [\contentsname] \COname, header-format =f0 [\MakeUpperCase] \COheader@format } { \DoParameterAssignments \COheading{\COname \@mkboth{\CO@header@format\COname}{\CO@header@format\COname}} \begingroup \UseCollection{contentsobject}{\COcollection@id} %Is this wrong? \makeatletter \COstart@action \@input{\[log in to unmask]\COextension} \if@filesw \expandafter\newwrite\csname tf@\COextension\endcsname \immediate\openout \csname tf@\COextension\endcsname \[log in to unmask]\COextension\relax \fi \@nobreakfalse \endgroup } \DeclareInstance{processcontents}{tableofcontents}{JK}{ file-extension = toc } \DeclareDocumentCommand{\contentsobject}{mmmmmmm} {\UseInstance{contentsobject}{#3}{#1}{#2}{#3}{#4}{#5}{#6}{#7}} \DeclareDocumentCommand{\JKtableofcontents}{}{ \UseInstance{processcontents}{tableofcontents} } \newcounter{contentscounter} \DeclareDocumentCommand{\addcontentsobject}{mmmm}{ \stepcounter{contentscounter} %or refstep? \addtocontents{toc}{ \contentsobject{\number\c@contentscounter}{#1}{#2}{#3}{#4}{}{\thepage}}} \endinput ============================== xtitletoc.sty ends