Grupos de Google ya no admite nuevas publicaciones ni suscripciones de Usenet. El contenido anterior sigue siendo visible.

understanding needspace

Visto 86 veces
Saltar al primer mensaje no leído

Tim Arnold

no leída,
8 sept 2010, 11:30:568/9/10
a
Hi,
I suppose I'm misunderstanding the use of needspace. The minimal
document below produces several lines of space before the second
section header, but no produces no effect before the first.

What I thought would happen is that neither section header would have
any spaces added, just that each one would be certain to have a
certain number of lines left on the page before typesetting the
header; otherwise a page would be ejected and the section would begin
on the new page.

Am I misunderstanding the package?
thanks,
--Tim Arnold

\documentclass{memoir}
\usepackage{lipsum}
\raggedbottom
\begin{document}
\chapter{my chapter}

\needspace{8\onelineskip}
\section{my section}

\lipsum[1]

\needspace{4\onelineskip}
\section{another section}

\lipsum[1]

\end{document}

Lars Madsen

no leída,
8 sept 2010, 18:15:408/9/10
a

I guess you will need to have Peter Wilson explain this one

I guess there is an interesting interaction when there is text
\needspace and then a \section (try removing the last section)

But the memoir manual mentions an alternative in the odd occasion that
\needspace behaves oddly, \Needspace and that works fine in your case

/daleif

Dan Luecking

no leída,
8 sept 2010, 18:28:358/9/10
a

\needspace doesn't interact well with things like
section headers. Part of the effect of \section
is to examine the previous vertical space and discard
it if it is less than a certain amount. But \needspace
ends with some negative vertical space (to cancel some
previous positive space it added). Then \section sees
that negative space, discards it, and the positive space
remains.

This might be considered bug. Perhaps \needspace should
end with a \vskip 0pt for \section to find and discard,
protecting the necessary negative skip.

A workaround is to use \Needspace, which uses a different
method to ensure the space is available.


Dan
To reply by email, change LookInSig to luecking

Donald Arseneau

no leída,
8 sept 2010, 20:10:288/9/10
a
Tim Arnold <a_j...@bellsouth.net> writes:

> I suppose I'm misunderstanding the use of needspace. The minimal
> document below produces several lines of space before the second
> section header, but no produces no effect before the first.

There is a conflict between \needspace and the \addpenalty
hidden inside the \section command. \needspace should end
with \vskip\z@skip (\vskip 0 pt), just as the definition of
\vspace does, to ensure co-operation.

The first \needspace works because page breaks are forbidden
after chapter headings, so \addpenalty is not used by \section.

Is Peter or another memoir maintainer reading?


--
Donald Arseneau as...@triumf.ca

Will Robertson

no leída,
8 sept 2010, 22:55:438/9/10
a

Yep (usually).

I've added this to the issue tracker for needspace and I'll address it
when possible (a little swamped at the moment).

http://github.com/wspr/herries-press/issues/issue/10

Thanks,
Will

Donald Arseneau

no leída,
9 sept 2010, 3:46:159/9/10
a
Will Robertson <wsp...@gmail.com> writes:

> > There is a conflict between \needspace and the \addpenalty
> > hidden inside the \section command.

Actually, the \addpenalty performs correctly, but the
ensuing \addvspace is what makes the mess. (The \addpenalty
would only make a mess when the page breaks at the penalty.)

> > \needspace should end
> > with \vskip\z@skip (\vskip 0 pt), just as the definition of
> > \vspace does, to ensure co-operation.

but the fix for \addvspace is the same \vskip\z@skip.

> I've added this to the issue tracker for needspace and I'll address it when
> possible (a little swamped at the moment).

Great! Thanks Will.

--
Donald Arseneau as...@triumf.ca

Lars Madsen

no leída,
9 sept 2010, 5:02:099/9/10
a

I'll add the \vskip\z@skip fix to memoir as well

--

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
http://www.minimalbeispiel.de/mini-en.html

Lars Madsen

no leída,
9 sept 2010, 10:18:089/9/10
a
Donald Arseneau wrote:
> Will Robertson <wsp...@gmail.com> writes:
>
>>> There is a conflict between \needspace and the \addpenalty
>>> hidden inside the \section command.
>
> Actually, the \addpenalty performs correctly, but the
> ensuing \addvspace is what makes the mess. (The \addpenalty
> would only make a mess when the page breaks at the penalty.)
>
>>> \needspace should end
>>> with \vskip\z@skip (\vskip 0 pt), just as the definition of
>>> \vspace does, to ensure co-operation.
>
> but the fix for \addvspace is the same \vskip\z@skip.
>

where should that be fixed?

>> I've added this to the issue tracker for needspace and I'll address it when
>> possible (a little swamped at the moment).
>
> Great! Thanks Will.
>


--

/daleif (remove RTFSIGNATURE from email address)

Tim Arnold

no leída,
9 sept 2010, 11:40:269/9/10
a

Thanks everyone for the great explanation and upcoming fix. In the
meantime I'm using Needspace which as mentioned, works fine.
thanks,
--Tim

Donald Arseneau

no leída,
9 sept 2010, 12:39:389/9/10
a
Lars Madsen <dal...@RTFMSIGNATUREimf.au.dk> writes:

> Donald Arseneau wrote:
> > but the fix for \addvspace is the same \vskip\z@skip.
>
> where should that be fixed?

Sorry that was too cryptic :-) I meant that even though the
blob of whitespace came out of \addvspace (and not from
\addpenalty), adding \vskip\z@skip to the end of \needspace
is still the proper fix.

--
Donald Arseneau as...@triumf.ca

Lars Madsen

no leída,
9 sept 2010, 14:02:589/9/10
a

no problem, I've already added it to the next memoir version, and Will
will add it to the needspace package

/daleif

0 mensajes nuevos