Received: by nummer-3.proteosys id <01C19442.D404FD7C@nummer-3.proteosys>; Thu, 3 Jan 2002 11:38:48 +0100 x-vm-v5-data: ([nil nil nil nil nil nil nil t nil][nil nil nil nil nil nil nil nil nil nil nil nil "^From:" nil nil nil]) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C19442.D404FD7C" x-vm-vheader: ("From:" "Sender:" "Resent-From" "To:" "Apparently-To:" "Cc:" "Subject:" "Date:" "Resent-Date:") nil X-MimeOLE: Produced By Microsoft Exchange V6.5 x-vm-bookmark: 1 Content-class: urn:content-classes:message Subject: RE: LATEX AND CATCODES SECTIONS AND FOOTNOTES Date: Mon, 1 Oct 1990 13:33:17 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "MITTELBACH FRANK" Sender: "LaTeX-L Mailing list" To: "Rainer Schoepf" Reply-To: "LaTeX-L Mailing list" Status: R X-Status: X-Keywords: X-UID: 232 This is a multi-part message in MIME format. ------_=_NextPart_001_01C19442.D404FD7C Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello everybody, this is an old message from Victor which I would like to pick up again. Since it's long time ago I better repeat the message. > > LaTeX is somewhat careless about catcodes treatment. My favourite > way of phrasing this is > ``You can't write a book about LaTeX in LaTeX'' > Explanation: the section command takes its argument as macro > parameter, whence it is not possible to have verbatim text > in a section heading. So you can't say > \section{And what \verb=3D\else=3D had you to learn?} = %Ni\copyright o > > Of course only a minority of people writes _about_ TeX, but > here at the university the Greek style of mr. Levi (mod sp) is used, > and the other day the TeX person from the computing centre asked my = why > it wasn't possible to have greek text in footnotes. That turned out > to be the same problem. Note that the Plain \footnote _can_ handle > catcode changes. > > And after 15 minutes of `ijsbeering' through the house, I knew that > I could do verbatim in section headings too: suppose > \def\section#1\par{... \SectionStyle #1 ...} > is given, then > \newbox\@verbox > \def\@verbatize#1#2{\setbox\@verbox=3D\hbox\bgroup > \def\par{\egroup#1\unhbox\@verbox\par}#2\ignorespaces} > \let\ssection=3D\section > \def\section{\@verbatize\ssection\SectionStyle} > does the job. > Extension to LaTeX syntax is trivial (use \aftergroup). > It's just that I prefer the \par-delimiting. > > So. Can anyone think of a reason why LaTeX shouldn't be a bit > more permissive of catcode stunts? Yes, there are some reasons in case of headings although not in case of footnotes. The problem with headings is that the information in its argument is used both for typesetting purposes but also for referencing purposes, e.g., it is written to the toc file and placed in a mark etc. Unfortunately the plain TeX footnote solution or a box solution like the one above don't help in this respect because it is not possible to reconvert the contents into token. Even the slow ``solution'' which is sometimes proposed, i.e., writing the argument to a file and reading it back switching catcode's as necessary does not help because of situations like \verb=3D{=3D which will spoil the read operation. Anyway it is a pretty slow method on many machines. Well, what can be done about that? One could scan the heading token for token looking for \verb but again that's slow and might fail sometimes. Beside that it poses some interesting questions how to handle hidden \verb commands (behind braces or other nasty things). As Rainer sait in our talk in Cork, we will allow \verb in every situation although we will not allow verbatim environments in arguments. The most simple way to do so is to redefine verb to use \meaning in some way. This will pose problems with blanks inside \verb (at least with multible ones) but should otherwise work pretty well. I would be very interested in hearing other ideas about how to handle this problem. I wonder how Victor solved this in his own macro package but perhaps this was before he added toc entries? Anyway, better solutions or ideas are very welcome, perhaps I missed some very basic possibility. Greetings Frank ------_=_NextPart_001_01C19442.D404FD7C Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: LATEX AND CATCODES SECTIONS AND FOOTNOTES

Hello everybody,

this is an old message from Victor which I would like = to pick up
again. Since it's long time ago I better repeat the = message.

>
> LaTeX is somewhat careless about catcodes = treatment. My favourite
> way of phrasing this is
>     ``You can't write a book = about LaTeX in LaTeX''
> Explanation: the section command takes its = argument as macro
> parameter, whence it is not possible to have = verbatim text
> in a section heading. So you can't say
>     \section{And what = \verb=3D\else=3D had you to learn?} %Ni\copyright o
>
> Of course only a minority of people writes = _about_ TeX, but
> here at the university the Greek style of mr. = Levi (mod sp) is used,
> and the other day the TeX person from the = computing centre asked my why
> it wasn't possible to have greek text in = footnotes. That turned out
> to be the same problem. Note that the Plain = \footnote _can_ handle
> catcode changes.
>
> And after 15 minutes of `ijsbeering' through the = house, I knew that
> I could do verbatim in section headings too: = suppose
>     \def\section#1\par{... = \SectionStyle #1 ...}
> is given, then
>    \newbox\@verbox
>    = \def\@verbatize#1#2{\setbox\@verbox=3D\hbox\bgroup
>        = \def\par{\egroup#1\unhbox\@verbox\par}#2\ignorespaces}
>    = \let\ssection=3D\section
>    = \def\section{\@verbatize\ssection\SectionStyle}
> does the job.
> Extension to LaTeX syntax is trivial (use = \aftergroup).
> It's just that I prefer the = \par-delimiting.
>
> So. Can anyone think of a reason why LaTeX = shouldn't be a bit
> more permissive of catcode stunts?

Yes, there are some reasons in case of headings = although not in case
of footnotes. The problem with headings is that the = information in its
argument is used both for typesetting purposes but = also for
referencing purposes, e.g., it is written to the toc = file and
placed in a mark etc. Unfortunately the plain TeX = footnote solution
or a box solution like the one above don't help in = this respect
because it is not possible to reconvert the contents = into token.

Even the slow ``solution'' which is sometimes = proposed, i.e., writing
the argument to a file and reading it back switching = catcode's as
necessary does not help because of situations like = \verb=3D{=3D which
will spoil the read operation. Anyway it is a pretty = slow method
on many machines.

Well, what can be done about that?
One could scan the heading token for token looking = for \verb but
again that's slow and might fail sometimes. Beside = that it poses
some interesting questions how to handle hidden \verb = commands
(behind braces or other nasty things).

As Rainer sait in our talk in Cork, we will allow = \verb in every
situation although we will not allow verbatim = environments in
arguments. The most simple way to do so is to = redefine verb to
use \meaning in some way. This will pose problems = with blanks inside
\verb (at least with multible ones) but should = otherwise work pretty
well. I would be very interested in hearing other = ideas about how
to handle this problem. I wonder how Victor solved = this in his
own macro package but perhaps this was before he = added toc entries?

Anyway, better solutions or ideas are very welcome, = perhaps I missed
some very basic possibility.

Greetings Frank

------_=_NextPart_001_01C19442.D404FD7C--