LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
Mailing list for the LaTeX3 project <[log in to unmask]>
Subject:
From:
James Kilfiger <[log in to unmask]>
Date:
Wed, 10 Nov 1999 19:18:03 +0000
In-Reply-To:
<[log in to unmask]> from Frank Mittelbach at "Nov 9, 99 10:10:29 am"
Reply-To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Parts/Attachments:
text/plain (192 lines)
>  > I've been filling in the gaps in xcontents.dtx, and have a working
>  > package that more or less matches the documentation.  The main thing I
> sounds great. i guess you are going to share that with us at some point, yes?
I'll append it below. It is almost entirely copied from latex.ltx
I'm not sure what you mean by the collection-id key of processcontents
I don't think I've done the right thing with it.

> error catching is an important aspect in its own right; i agree. but
> for prototype implementations i don't mind much if errors aren't
> caught.

True, provided you will give error-catching the priority it deserves I'm
happy. I know it is always too easy to treat error handling as `second-
class coding'.  (but I don't suggest the latex3 team is guilty of this)
>
> But one needs to think about how to struture that "help info" so that
> external programs (like emacs or whatever) can make good use of the
> information. for LaTeX itself the information is not likely to be
> usable (i think)

There could be a \ShowCommand which would access that help, but I guess
that would not be of much use to the majority of users.  The most
useful thing might be for the help texts of commands to be able to
hyper-reference other commands.  But I think such help texts must be
fairly short.  They can't replace good general documentation.

> effectively all i think commands like \DeclareUserCommand or
> \DeclareTemplateType etc. should do is to provide an extra argument in
> which this information goes but not to use it themselves.

\DeclareUserCommand?  is this \DeclareDocumentCommand -- The Next
Generation? Help for commands used could be saved and written to a
file \jobname.help (or whatever) which then could be parsed by emacs,
a person or whatever. Or the help text for user commands could be
displayed when an error occurs while processing that command.

> by the way, was this mail sent before it was finished? my copy ends with
>
>  > there any more thoughts on how that could be done?  It would be
Probably I was going to end `It would be a Good Thing'.

Below is xcontents.sty.

\RequirePackage{xparse}
\RequirePackage{template}
\IgnoreWhiteSpace
\DeclareTemplateType{contentsobject}{6}
\DeclareTemplateType{processcontents}{0}
\def\comma{,}
\DeclareTemplate{contentsobject}{JK}{6}{
  pre-v-action     =f0 [\endgraf] \COpre@action,
  object-decls     =f0 [\relax]   \COobject@decl,
  object-indent    =l  [0pt]      \leftskip,
  number-width     =l  [0pt]      \@tempdima,
  right-margin-sep =l  [25pt]     \rightskip,
  pnum-width       =l  [15pt]     \@tempdimb,
  number-format    =f1 [#1\hfil]  \COnumber@format,
  title-format     =f1 [#1]       \COtitle@format,
  pnum-format      =f1 [\hfil#1]  \COpnum@format,
  leaders-action   =f0 [.]        \COleaders@action,
  leaders-sep      =l  [4pt]      \@tempdimc
 }
 {
  \ifnum #2>\c@tocdepth \else
   {
   \DoParameterAssignments
   \COpre@action
   \COobject@decl
   \parfillskip=-\rightskip
   \parindent=0pt
   \@afterindenttrue
   \interlinepenalty\@M
   \leavevmode
   \IfNoValueT{#3}{\def\COnumber@format##1{\hfil}}
   \hbox to \@tempdima {\COnumber@format{#3}}
   \nobreak
   \COtitle@format{#4}
   \nobreak
   \leaders\hbox{
      \kern\@tempdimc
      \hbox{\COleaders@action}
      \kern\@tempdimc
   }\hfill
   \nobreak
   \hbox to \@tempdimb {\COpnum@format{#6}}
    \endgraf
 }
 \fi
}

\DeclareTemplate{contentsobject}{JKpnumfirst}{6}{
  pre-v-action     =f0 [\endgraf] \COpre@action,
  object-decls     =f0 [\relax]   \COobject@decl,
  object-indent    =l  [0pt]      \leftskip,
  object-width     =L  [\DelayEvaluation{\linewidth}]
                                  \COobject@width,
  pnum-width       =l  [30pt]     \@tempdimb,
  title-format     =f1 [#1]       \COtitle@format,
  pnum-format      =f1 [#1]       \COpnum@format,
  pnum-title-sep   =l  [5pt]      \@tempskipa}
{
  \IfNoValueF{#3}
     {\PackageWarning{xcontents}{Number~of~contents~object~was~ignored.}{}}
  \ifnum #2>\c@tocdepth \else {
    \DoParameterAssignments
    \parindent=0pt
    \COpre@action
    \COobject@decl
    \leavevmode
    \hbox to \COobject@width {
        \hbox to \@tempdimb{\COpnum@format{#6}\hfil}
        \hspace{\@tempskipa}
        \COtitle@format{#4}\hfil}}
}

\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{contentsobject}{section}{JK}{
  pre-v-action     = \DelayEvaluation{\addpenalty \@M
                     \addvspace{1em \@plus \p@}},
  right-margin-sep = 15pt,
  title-format     = \textbf{#1},
  number-format    = \textbf{#1\hfil},
  pnum-format      = \textbf{\hfil#1},
  leaders-action   = ~,
  number-width     = \DelayEvaluation{1.5em}}

\DeclareInstance{contentsobject}{subsection}{JK}{
  object-indent = \DelayEvaluation{1.5em},
  number-width  = \DelayEvaluation{2.3em}}

\DeclareInstance{contentsobject}{subsubsection}{JK}{
  object-indent = \DelayEvaluation{3.8em},
  number-width  = \DelayEvaluation{3.2em}}

\DeclareInstance{contentsobject}{paragraph}{JK}{
  object-indent = \DelayEvaluation{7.0em},
  number-width  = \DelayEvaluation{4.1em}}

\DeclareInstance{contentsobject}{subparagraph}{JK}{
  object-indent = \DelayEvaluation{10em},
  number-width  = \DelayEvaluation{5em}}

\DeclareInstance{contentsobject}{pnumsubsection}{JKpnumfirst}
{object-width=4cm}
\DeclareInstance{contentsobject}{pnumsection}{JKpnumfirst}
{object-width=4cm}

\DeclareInstance{processcontents}{tableofcontents}{JK}{
   file-extension = toc
  }

\DeclareDocumentCommand{\contentsobject}{mmmmmmm}
  {\UseInstance{contentsobject}{#3}{#1}{#2}{#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}}}

ATOM RSS1 RSS2