X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil] ["5015" "Mon" "20" "December" "1999" "13:49:45" "+0100" "Javier Bezos" "jbezos@ARRAKIS.ES" nil "163" "A couple of TOC templates (1)" "^Date:" nil nil "12" nil nil nil nil nil] nil) Return-Path: Received: via tmail-4.1(11) (invoked by user schoepf) for schoepf; Mon, 20 Dec 1999 13:51:51 +0100 (MET) Received: from mail.Uni-Mainz.DE (trudi.zdv.Uni-Mainz.DE [134.93.8.159]) by mailserver2.zdv.Uni-Mainz.DE (8.9.1b+Sun/8.9.1) with ESMTP id NAA01750 for ; Mon, 20 Dec 1999 13:51:51 +0100 (MET) Received: from mail.listserv.gmd.de (mail.listserv.gmd.de [192.88.97.5]) by mail.Uni-Mainz.DE (8.9.3/8.9.3) with ESMTP id NAA24502 for ; Mon, 20 Dec 1999 13:51:50 +0100 (MET) Received: from mail.listserv.gmd.de (192.88.97.5) by mail.listserv.gmd.de (LSMTP for OpenVMS v1.1a) with SMTP id <15.D05BC0C7@mail.listserv.gmd.de>; Mon, 20 Dec 1999 13:51:44 +0100 Received: from RELAY.URZ.UNI-HEIDELBERG.DE by RELAY.URZ.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 1.8b) with spool id 445985 for LATEX-L@RELAY.URZ.UNI-HEIDELBERG.DE; Mon, 20 Dec 1999 13:50:56 +0100 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by relay.urz.uni-heidelberg.de (8.8.8/8.8.8) with ESMTP id NAA13839 for ; Mon, 20 Dec 1999 13:50:33 +0100 (MET) Received: from ssmtp01.arrakis.isp ([212.59.199.83]) by relay.uni-heidelberg.de (8.9.1b+Sun/8.9.1) with ESMTP id NAA09941 for ; Mon, 20 Dec 1999 13:51:00 +0100 (MET) Received: from [195.5.78.82] ([195.5.78.82]) by ssmtp01.arrakis.isp (Netscape Messaging Server 4.1 Nov 19 1999 19:47:43) with SMTP id FN1IAY03.R29 for ; Mon, 20 Dec 1999 13:49:46 +0100 x-sender: jbezos@pop.arrakis.es x-mailer: Claris Emailer 2.0, March 15, 1997 Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Message-ID: <199912201251.NAA09941@relay.uni-heidelberg.de> Reply-To: Mailing list for the LaTeX3 project Date: Mon, 20 Dec 1999 13:49:45 +0100 From: Javier Bezos Sender: Mailing list for the LaTeX3 project To: Multiple recipients of list LATEX-L Subject: A couple of TOC templates (1) Status: R X-Status: X-Keywords: X-UID: 3470 (Message in three parts, because LaTeX-L rejects long messages) Below there are two enclosed files corresponding to titletoc with templates added, and a trial file. The main goal is to show a different approach to TOC attributes and how entries could be grouped in a single paragraph. I'm currently working in some improvements and many bugs remain to be fixed, but it provides a mock-up of the main ideas. I have not finished yet partial tocs and hence I removed the code from the sent files; the processcontents is just a copy of the code by James Kilfiger. The attributes of standard toc entries (JB1) are: pre-action: Code to be executed before the entry, post-action: Code to be executed after the entry, decls: declarations (usually paragraph format ones), left-margin: the left margin related to the entry text (*not* the label), right-margin: the right margin related to the entry text, right-adjust: a correction for leaders (the leader chars are not centered in the enclosing box, but aligned to right), this parametes adjusts the entry text so that its right margin and the leaders are algned, label-format: It should include code for making the label hangs, label-width: title-format: self-explanatories title-format-nolabel: if present, overrides the title format in unlabeled entries, page-format: It should include code for making the page hangs, leaders-text: leaders-width: self-explanatories The attributes of "paragraphed" toc entries (JB2) are: pre-action: Only that of the very first grouped entry is executed, decls: left-margin: right-margin: label-format: title-format: title-format-nolabel: page-format: As before, except that neither the label nor the page hang, punct-sep: Default separator, punct-end: Ending puntuation, only that of the very last grouped entry is executed. =f0 [.] \COpunct@end, punct-sup: Separator when the following entry is one level above (eg, subsection section) punct-sup-sup: Id. two levels above (eg subsubsection section) punct-sub: Id. one level below (eg, section subsection) Since the right-margin is usually set for all of entries, the command \contentsmargin[correction]{right} is provided. The default values for the corresponding attributes are taken from a couple of internal macros set by it. \bye \bye Javier ps. As I'm gettting more and more involved in an Omega project, I'm not sure if I can continue with this discussion. I will try it, anyway. =========================== xtitlesec.sty begins \ProvidesPackage{xtitletoc} \RequirePackage{xparse} \RequirePackage{template} % The following tags are used: % ttl@ : the generic one, shared with titlesec % ttle@ : ending puntuation for block format % ttll@ : section level % ttlx@ : file extension \newif\ifttl@numsec \newif\ifttl@fromblock \providecommand\titleline{% \@ifnextchar[{\ttl@line}{\ttl@line[s]}} \def\ttl@line[#1]#2{% \vskip\topskip \hrule \@height \z@ \nobreak \vskip-\topskip \begingroup \parindent\z@ \everypar{}% \leftskip\z@ \rightskip\z@ \@makebox[\hsize][#1]{\ttl@makeline{#2}}% \par \endgroup \hrule height \z@ \nobreak} % Fillers: \providecommand\titlerule{\@ifstar{\ttl@row}{\ttl@rule}} \let\ttl@leaders\xleaders \def\ttl@row{\@ifnextchar[{\ttl@row@i}{\ttl@row@i[\wd\z@]}} \def\ttl@row@i[#1]#2{% \ifvmode\expandafter\titleline\fi {\sbox\z@{#2}% \hspace{-#1}% \hskip\wd\z@ \ttl@leaders\hb@xt@#1{\hss\box\z@}% \hfill\kern\z@}} \def\ttl@rule{\@ifnextchar[{\ttl@rule@i}{\ttl@rule@i[.4pt]}} \def\ttl@rule@i[#1]{% \ifvmode\expandafter\titleline\fi {\leaders\hrule height #1\hfill\kern\z@}} \providecommand\filright{% \gdef\es@filleft##1{\hskip##1}% \gdef\es@filright##1{\hfill}% \let\\\@centercr \advance\rightskip\z@ \@plus 1fil\relax} \providecommand\filleft{% \gdef\es@filleft##1{\hfill}% \gdef\es@filright##1{\hskip##1}% \let\\\@centercr \advance\leftskip\z@ \@plus 1fil \parfillskip\z@} \providecommand\filcenter{\filleft\filright \gdef\es@filleft##1{\hfill}} \providecommand\fillast{% \gdef\es@filleft##1{\hfill}% \gdef\es@filright##1{\hfill}% \let\\\@centercr \filleft\advance\rightskip\z@ \@plus -1fil \parfillskip\z@ \@plus 2fil\relax} % User interface % ~~~~~~~~~~~~~~ % Tools: \DeclareOption{dotinlabels}{\def\ttl@idot{.}} \DeclareOption{nodotinlabels}{\let\ttl@idot\@empty} \DeclareOption{leftlabels}{% \renewcommand\numberline[1]{\hb@xt@\@tempdima{#1\ttl@idot\hfil}}% \newcommand\contentslabel[2][\thecontentslabel\ttl@idot]{% \hspace*{-#2}\hb@xt@#2{#1\hfil}}} \DeclareOption{rightlabels}{% \renewcommand\numberline[1]{\hb@xt@\@tempdima{\hss#1\ttl@idot\enspace}}% \let\contentslabel\relax \newcommand\contentslabel[2][\thecontentslabel\ttl@idot\enspace]{% \hspace*{-#2}\hb@xt@#2{\hfil#1}}} \newcommand\contentspage[1][\thecontentspage]{% \hb@xt@\@pnumwidth{\hfil#1}% \hspace*{-\@pnumwidth}} \newcommand\contentspush[1]{% \sbox\z@{#1}% \advance\leftskip\wd\z@ \leavevmode\llap{\box\z@}}