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
Show All Mail Headers

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

Print Reply
Subject:
From:
Marcel Oliver <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Tue, 2 Nov 1999 20:35:18 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (112 lines)
First a follow-up on my earlier posting on relative sectioning:

Frank Mittelbach wrote:
> having read this far i thought that you meant something like this:
>
>    \begin{head}{Main heading}
>
>       text text text
>
>       \begin{head}{Sub heading}
>         text text
>       \end{head}
>       \begin{head}{Another sub heading}
>         text text
>       \end{head}
>    \end{head}

I guess this is the "correct" approach from an academic point of view.
But unfortunately it's not upward compatible with current LaTeX, and I
don't see any important reason to break existing user-level syntax.
Moreover, in my experience non-technical users have lots of problems
getting \begin and \end's to match up (it doesn't help advocating
smart editors---what can go wrong, will go wrong), thus I think
environments should be avoided whereever it is possible to do so.

"William F. Hammond" wrote:
> Or perhaps one could simply descend a level with
>
>              \downsection{heading}

This also has problems, namely if you want to change the level of a
single (sub)section, you have to also adjust the relative section
marking of the following sectioning command.  This might be a real
mess in practice.  However, one may have the following variation:

  \begin{downsection}
    \section{AAA}
    \subsection{BBB}
    ...
  \end{downsection}

which would cause the enclosed material to be set one level down from
what is explicitly indicated.

Since I'd like to avoid environments (although I suppose one could
make the case that an environment is really not too bad for this
purpose), one could also have the following syntax:

 \downsection[2]
 \section{AAA}

which would make AAA a subsubsection, and all of AAA's daughters
\paragraphs thereof.

This leads to an issue that has been raised in some other posts: A
general high-level lookahead mechanism within xparse which could be
for this as well as for things like \cite{A}\cite{B} etc.

So maybe it would be useful to add a new argument specifier to xparse,
namely the next token (and possibly also store its arguments in
well-defined places).  So let's call this argument specifier l for
look-ahead, and assume that the arguments of the prescanned token are
in the slots #(n+1) up to #(n+m) if n is the number of formal
arguments of the current command, and m is the number of formal
arguments to the prescanned command.

The the following would be possible (excuse my bad TeX, I know it
doesn't work like this, but I am not doing this every day, and I don't
want to look up stuff just to explain the concept):

  \DeclareDocumentCommand \downsection { O{1} l }
    { \if #2=\section
          \then \head {1+#1} {#3}
      \elif #2=\subsection
          \then \head {2+#1} {#3}
      ...
    }

where I assume for simplicity that \section takes only one mandatory
argument, and \head{n}{caption} actually typesets the section heading
at level n with text "caption".

Or the \cite\cite problem could be solved like (ignoring the optional
argument of \cite for the moment):

  \DeclareDocumentCommand \cite { m l }
    { \if #2=\cite
          \then \cite {#1,#3}
          \else \typeset_citation {#1}
      \fi
    }

So this would gobble up an arbitrary number of \cite's and spit out a
\typeset_citation where the single arguments of the \cite's are comma
separated.

I don't know enough TeX to really judge if this has a good ratio of
usefulness to difficulty, but it seems it could solve a lot of
problems that would otherwise require some serious TeX.

By the way, I still think that using the \ref mechanism for relative
sectioning is neat (even if it probably needs a lot of internal
changes to the .aux file handling).  Maybe one could write

  \section{AAA} \label{aaa}
  \anchor{aaa}
  \section{BBB}

which would "anchor" BBB as a subsection of AAA.

Marcel

ATOM RSS1 RSS2