LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text 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:
Javier Bezos <[log in to unmask]>
Date:
Sun, 31 Oct 1999 18:54:02 +0100
Reply-To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Parts/Attachments:
text/plain (123 lines)
>
> o should there be user level control on whether or not a heading has
>   a number? (or are those things logically simply different tags and
>   we are only used to saying \chapter* instead of \frontmatterchapter
>   or whatever because nothing else was available)
>
>   in other words is this really a flexibility that is needed/wanted
>   or only there to hide the fact that some general functionality is
>   missing?
[...]
>so
>
> \chapter*{BAR}
>
>makes a heading with no number but BAR in the toc and in runhead
>
> \chapter**{BAR}
>
>makes a heading with no number and no toc entry but BAR  in runhead
>
>if you really would like to have a number but no toc entry this would
>be possible as well but only with some difficulty:
>
> \chapter[]*{BAR}

The more I analyze this problem, the more I become convinced that
the star mechanism should be avoided in favour of a markup-like
syntax. Let's suppose there are some sections containing exercises.
Instead of using a starred version, we could use an environment:

\begin{exercises}
\section{Easy}
...
\section{Not so easy}
...
\end{exercises}

If headings (or their short form) are in the TOC or in the headlines
is a decision taken by exercises, which in addition may set the
text to \small, add the word "Exercises" to the head, etc. (At
the end of this message, I copy part of the manual of one of my
packages, which it's to the point.) The mean to get this could
be to provide a set of flags which determine the behaviour of
section headings; these flags shouldn't be changed directly in
the main document but through an intermediary (in this example,
the exercises environment). For instance:
  numbered
  in-toc
  in-headings

The natural way of doing that in template is \UseCollection, but
another possibility is to use a key which will expand at
\UseInstance with the actual flag values in "usual" tex macros.
Perhaps in a future a new structure could be created so that
\sections are not inside an environment (other than document)
and flags are properly handled.

Javier

========

The following definition supresses numbers but neither toc lines
nor headers.
\begin{verbatim}
\newenvironment{exercises}
  {\setcounter{secnumdepth}{0}}
  {\setcounter{secnumdepth}{2}}
\end{verbatim}

The following one adds a toc line but headers will remain
untouched:
\begin{verbatim}
\newenvironment{exercises}
 {\setcounter{secnumdepth}{0}%
  \renewcommand\sectionmark[1]{}}
 {\setcounter{secnumdepth}{2}}
\end{verbatim}

The following one updates the headers but there will be
no toc line:
\begin{verbatim}
\newenvironment{exercises}
 {\setcounter{secnumdepth}{0}%
  \addtocontents{toc}{\protect\setcounter{tocdepth}{0}\ignorespaces}}
 {\setcounter{secnumdepth}{2}%
  \addtocontents{toc}{\protect\setcounter{tocdepth}{2}\ignorespaces}}
\end{verbatim}
(I find the latter a bit odd in this particular example; the
first and second options are more sensible. The |\ignorespaces|
is not very important, and you needn't it unless there is
unwanted space in the toc.)

That works with standard classes, but if you are using
\textsf{fancyhdr} or \textsf{titlesec} to define headers you need an
extra command. I will name it |\printthesection| and you
could define it in the preamble as follows:
\begin{verbatim}
\newcommand{\printthesection}{\thesection\ }
\end{verbatim}
If you define the header with \textsf{titlesec}, for instance:
\begin{verbatim}
\newpagestyle{myps}{
  \sethead{\printthesection\sectiontitle}{}{\usepage}}
\end{verbatim}
then you have to write:
\begin{verbatim}
\newenvironment{exercises}
  {\setcounter{secnumdepth}{0}%
   \renewcommand{\printthesection}{}}
  {\setcounter{secnumdepth}{2}}
\end{verbatim}
and so on.

As you can see, there are no |\addcontentsline|, no
|\markboth|, no |\section*|, just logical structure. Of
course you may change it as you wish; for example if you decide
that these sections should be typeset in small typeface, include
|\small|, and if you realize that you don't like that, remove it.

While the standard LaTeX commands are easier and more
direct for simple cases, I think the proposed method above is
far preferable in large documents.

ATOM RSS1 RSS2