Discussion:
How to restore \leftmark?
(too old to reply)
m***@gmail.com
2008-05-13 17:57:14 UTC
Permalink
Hello,

I understand that the \leftmark command contains the text for the
headings of a page (in this case, the chapter name), and is updated
every time the \chapter command is issued. However, the \chapter* does
not update \leftmark accordingly and I have to do this by hand, as
below:

\leftmark {some-text}

This works well, except for the fact that all uses of the \chapter
command after the line above will not update the headings to the name
of the current chapters, which remains, in all chapters, "some-text".

My question is: how can I restore \leftmark to its original definition
before the \leftmark was issued? Or, if easier, how do I make the
\chapter* command update the headings of the page correctly (i.e, the
contents of \leftmark command)?

Thanks in advance,
Marcus Ramos.
Lars Madsen
2008-05-13 19:00:49 UTC
Permalink
Post by m***@gmail.com
Hello,
I understand that the \leftmark command contains the text for the
headings of a page (in this case, the chapter name), and is updated
every time the \chapter command is issued. However, the \chapter* does
not update \leftmark accordingly and I have to do this by hand, as
\leftmark {some-text}
This works well, except for the fact that all uses of the \chapter
command after the line above will not update the headings to the name
of the current chapters, which remains, in all chapters, "some-text".
My question is: how can I restore \leftmark to its original definition
before the \leftmark was issued? Or, if easier, how do I make the
\chapter* command update the headings of the page correctly (i.e, the
contents of \leftmark command)?
Thanks in advance,
Marcus Ramos.
there is only one way of setting the \leftmark

\markboth{bla bla}{}

/daleif
Robin Fairbairns
2008-05-14 08:23:41 UTC
Permalink
Post by Lars Madsen
Post by m***@gmail.com
I understand that the \leftmark command contains the text for the
headings of a page (in this case, the chapter name), and is updated
every time the \chapter command is issued. However, the \chapter* does
not update \leftmark accordingly and I have to do this by hand, as
\leftmark {some-text}
there is only one way of setting the \leftmark
\markboth{bla bla}{}
this isn't quite true. there's only one safe way of generating the
output marcus wants; it's clear he's stumbled on a way of changing the
left mark, and it's plainly not a safe way. the mark system in latex
is a complicated abstraction of what tex itself provides; if etex had
predated latex, life would be a lot simpler in that are...
--
Robin Fairbairns, Cambridge
David Kastrup
2008-05-14 18:14:07 UTC
Permalink
the mark system in latex is a complicated abstraction of what tex
itself provides; if etex had predated latex, life would be a lot
simpler in that are...
How so? eTeX provides no way to reset marks.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
UKTUG FAQ: <URL:http://www.tex.ac.uk/cgi-bin/texfaq2html>
Robin Fairbairns
2008-05-14 20:39:17 UTC
Permalink
Post by David Kastrup
the mark system in latex is a complicated abstraction of what tex
itself provides; if etex had predated latex, life would be a lot
simpler in that are...
How so? eTeX provides no way to reset marks.
by extending the list of available marks, so one doesn't struggle to
express oneself with the tiny set of original tex.
--
Robin Fairbairns, Cambridge
David Kastrup
2008-05-14 21:50:00 UTC
Permalink
Post by Robin Fairbairns
Post by David Kastrup
the mark system in latex is a complicated abstraction of what tex
itself provides; if etex had predated latex, life would be a lot
simpler in that are...
How so? eTeX provides no way to reset marks.
by extending the list of available marks, so one doesn't struggle to
express oneself with the tiny set of original tex.
One could have implemented a \newmarks-like mechanism with the tiny set
of original TeX well enough.

But resetting the marks is not possible without rerunning the output
routine. Rerunning the output routine requires magic penalties. Magic
penalties are replaced by TeX with \nobreak. \nobreak rots up perfectly
feasible breakpoints.

I may be oversensitized to this issue since I just received _ANOTHER_
_BLOODY_ _BUG_ _REPORT_ for bigfoot where an imbalance of those stupid
artificial nobreaks with the nobreaks I have to remove manually occurs.
This is so close to impossible to get right that it is not funny. It
has cost me literally months of bug searches and redesigns.

NOT FUNNY!!!
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
UKTUG FAQ: <URL:http://www.tex.ac.uk/cgi-bin/texfaq2html>
Robin Fairbairns
2008-05-15 08:01:39 UTC
Permalink
Post by David Kastrup
Post by Robin Fairbairns
Post by David Kastrup
the mark system in latex is a complicated abstraction of what tex
itself provides; if etex had predated latex, life would be a lot
simpler in that are...
How so? eTeX provides no way to reset marks.
by extending the list of available marks, so one doesn't struggle to
express oneself with the tiny set of original tex.
One could have implemented a \newmarks-like mechanism with the tiny set
of original TeX well enough.
But resetting the marks is not possible without rerunning the output
routine. Rerunning the output routine requires magic penalties. Magic
penalties are replaced by TeX with \nobreak. \nobreak rots up perfectly
feasible breakpoints.
it (almost) goes without saying that your knowledge of the innards of
tex is such as to put mine to shame. i know this, and yet i continue
to attempt to argue with you... i guess it makes for a learning
experience for the aged and infirm...
Post by David Kastrup
I may be oversensitized to this issue since I just received _ANOTHER_
_BLOODY_ _BUG_ _REPORT_ for bigfoot where an imbalance of those stupid
artificial nobreaks with the nobreaks I have to remove manually occurs.
This is so close to impossible to get right that it is not funny. It
has cost me literally months of bug searches and redesigns.
you have my sympathy. it's such a magic package, i expect there are
people trying to use it for rocket design, too.
--
Robin Fairbairns, Cambridge
David Kastrup
2008-05-15 11:11:57 UTC
Permalink
Post by Robin Fairbairns
Post by David Kastrup
One could have implemented a \newmarks-like mechanism with the tiny set
of original TeX well enough.
But resetting the marks is not possible without rerunning the output
routine. Rerunning the output routine requires magic penalties. Magic
penalties are replaced by TeX with \nobreak. \nobreak rots up perfectly
feasible breakpoints.
it (almost) goes without saying that your knowledge of the innards of
tex is such as to put mine to shame. i know this, and yet i continue
to attempt to argue with you... i guess it makes for a learning
experience for the aged and infirm...
Well, I argue with TeX. And it always wins.
Post by Robin Fairbairns
Post by David Kastrup
I may be oversensitized to this issue since I just received _ANOTHER_
_BLOODY_ _BUG_ _REPORT_ for bigfoot where an imbalance of those stupid
artificial nobreaks with the nobreaks I have to remove manually
occurs. This is so close to impossible to get right that it is not
funny. It has cost me literally months of bug searches and redesigns.
you have my sympathy. it's such a magic package, i expect there are
people trying to use it for rocket design, too.
The problem is that it is not a magic package. The _impressive_ bulk of
the "feature list" was comparatively straightforward wizardry (like the
logic for formatting horizontal footnotes) where a reasonable relation
between the size of the (mostly imaginary) specification and the
implementation effort existed.

But the really, really hard stuff is getting something right that can be
described in about three sentences:

Get enough material to fill at least a page. Find the least-cost
breakpoint combination according to a set of penalty/badness criteria.
If this causes an underfull page while all of the main text material got
used, get more material and repeat.

Quite innocuous, isn't it? I can't get it right. The problem is that
at the start of a page, TeX discards glue, penalties, kerns, retaining
marks, insertions and whatsits until it comes to the first rule or box.
It inserts topskip material here (whether you want it or not) and may
even pick this topskip as a breakpoint in certain cases.

Now you can use \pagediscards to get the discarded items. But the order
with the non-discarded items before the first rule or box will be lost.
And when TeX makes a page break at a penalty, it replaces the penalty
with \nobreak (which it leaves on the main vertical list, not accessible
to the output routine at the run where it would be interesting).

I am currently considering forgetting about magic penalties for
triggering page breaks altogether and instead pushing an insertion or
box with temporarily infinite size or some similar nonsense. Something
which will stop TeX from gobbling good information into pagediscards,
and something which will not insert infinite penalties at places where
there was a breakpoint previously.

All of this is such a mess.
--
David Kastrup
m***@gmail.com
2008-05-15 19:43:29 UTC
Permalink
Thank you all for the replies.

I finally managed to solve my problem, and the suggestion was sent by
JúlioSchoffen, from UFRGS (Brazil). It is as simple as:

\chapter* {name \marboth {nome} {name} }

By using \markboth inside \chapter*, I don´t have to worry about (i)
changing the value of \leftmark (renewcommand {\leftmark} {name})
before using \chapter*, and then (ii) restoring \leftmark to its
previous value, after using \chapter*. And, of course, the headings
are all set correctly. Hope this will be useful to others as well. Bu
the way, I am using the class scrbook and scrheadings from KOMA-
script.

Marcus.
Ulrike Fischer
2008-05-16 07:09:29 UTC
Permalink
Bu the way, I am using the class scrbook and scrheadings from KOMA-
script.
Then why don't you use \addchapter?
--
Ulrike Fischer
Ulrike Fischer
2008-05-14 08:33:13 UTC
Permalink
Post by m***@gmail.com
Hello,
I understand that the \leftmark command contains the text for the
headings of a page (in this case, the chapter name), and is updated
every time the \chapter command is issued. However, the \chapter* does
not update \leftmark accordingly and I have to do this by hand, as
\leftmark {some-text}
\leftmark is the command that prints the mark. So -- unless you have
changed the definition of \leftmark -- the above will first print the
content of \leftmark (which is perhaps empty) and then the text "some
text".
Post by m***@gmail.com
This works well, except for the fact that all uses of the \chapter
command after the line above will not update the headings to the name
of the current chapters, which remains, in all chapters, "some-text".
Sure, if your header contains the above commands, "some-text" will be
printed in every header.
Post by m***@gmail.com
My question is: how can I restore \leftmark to its original definition
before the \leftmark was issued? Or, if easier, how do I make the
\chapter* command update the headings of the page correctly (i.e, the
contents of \leftmark command)?
Use \markboth or \chaptermark to change the content of a mark. Or use a
better class like scrbook from the KOMA-classes which has a command
\addchapter.
--
Ulrike Fischer
Loading...