[texhax] change some parameters of chapter
Reinhard Kotucha
reinhard.kotucha at web.de
Mon Aug 14 23:41:26 CEST 2006
>>>>> "John" == John R Culleton <john at wexfordpress.com> writes:
> Here is a plain pdftex macro I used for a novel. It should also
> work in LaTeX:
> \def\chapter#1{%
> \vfil\eject
> \titlepagetrue
> \ifodd\pageno\else
> \vglue 1.5in
> \centerline{\webx 8}
> \vfil\eject
> \titlepagetrue\fi
> \vglue 1.8in
> \line{\leaderw\lower 4.5pt\hbox{\head #1}\ \leaderw}
> \vglue 1in}
Why do you think this should work in LaTeX? LaTeX is not just an
extension to plain TeX, it is something completely different.
You can find out easily that it doesn't work:
$ latex '\relax\documentclass{book}\begin{document}'
This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
entering extended mode
LaTeX2e <2003/12/01>
Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman, n
ohyphenation, loaded.
(/usr/local/dtp/share/texmf-dist/tex/latex/base/book.cls
Document Class: book 2004/02/16 v1.4f Standard LaTeX document class
(/usr/local/dtp/share/texmf-dist/tex/latex/base/bk10.clo))
No file book.aux.
*\show\titlepagetrue
> \titlepagetrue=undefined.
<*> \show\titlepagetrue
?
*\show\pageno
> \pageno=undefined.
<*> \show\pageno
?
*\stop
No pages of output.
Transcript written on book.log.
I strongly recommend LaTeX users *not* to insert plain TeX code
because that requires that they have to understand completely how the
LaTeX kernel works.
Look at the definition of \@ifundefined and you'll see that you cannot
reliably use \ifx\foo\undefined in LaTeX, for instance.
LaTeX's \chapter command is very complex. It cannot be replaced by
the simple code above except if you only want to typeset a poem.
> If I had needed to create TOC entries and/or flexible page header
> entries that would have required additional code. This novel
> needed neither.
I don't know how much additional code you want to provide. The
problem is not trivial. It is not sufficient to increase the chapter
counter, you also have to reset the section, subsection... counters.
You cannot introduce new counters unless you redefine everything.
You also have to use the LaTeX interface to get cross references
right, or do you want to re-invent all this too?
If there is no package which provides what you need, create your own
.sty file, copy the definition of \chapter from the .cls file into
your file and modify it carefully. But do this only if you are
absolutely sure that no package exists you can use. And do not change
anything you don't know what it's good for.
> The \titlepage boolean was created with a \newif statement. It is
> employed in my header routine to suppress or not suppress the
> header line.
Titlepages are also supported by LaTeX. There is no need for a new
switch. The titlepage has nothing to do with \chapter. When LaTeX
reads the first \chapter, the titlepage has been typeset already.
> In Context there is sufficient flexibility to shape the header any
> way you wish. The sequence starts \setuphead[chapter]...
> and then there are dozens of parameters as explained in the
> Context manuals. I have an example but it is lengthy and not
> apropos if you use LaTex.
Yes, Context is more flexible than LaTeX, but LaTeX is flexible enough
unless very unusual things are required. I think that people who did
not use LaTeX before should look at Context as well.
But most people have some experience with LaTeX already and trying to
convince them to use Context instead is as difficult as to convince a
PASCAL user to use C, or to convince an Emacs user to use vi, or to
convince a Windows user to use Linux, or to convince you to write your
mails in German or (even worse) French, though you can learn it.
The best thing LaTeX users can do is to buy "The LaTeX Companion", 2nd
edition. It's not cheap, but it's worth the money.
The second best thing is to read
http://www.tex.ac.uk/cgi-bin/texfaq2html
Again: Plain TeX code in LaTeX files is extremely dangerous. Only
package writers who are familiar with plain TeX *AND* LaTeX's
internals should use it.
I also think that in most cases it is not desirable to convince people
to use plain TeX at all. In the English speaking world it doesn't
matter _that_ much. But everywhere else the \inputenc stuff is
required. LaTeX now even supports UTF-8. Absolutely necessary for
multilingual docs. Only English speaking people are happy with ASCII,
nobody else.
John, *please* do not bother LaTeX users with plain TeX code. I know
that you want to help, but actually you confuse them. It would be
better if you test your code in LaTeX before posting it. Then you'll
see that LaTeX and plain TeX are completely different things.
Regards,
Reinhard
--
----------------------------------------------------------------------------
Reinhard Kotucha Phone: +49-511-4592165
Marschnerstr. 25
D-30167 Hannover mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------
More information about the texhax
mailing list