Re: How to determine where I am on a page.

2010-01-25 Thread rgheck

On 01/25/2010 07:59 AM, Jürgen Spitzmüller wrote:

rgheck wrote:
   

As a related question: What does \relax do, and when does one need it?
 

http://en.wikibooks.org/wiki/TeX/relax

   

Thanks. I thought it must be something like that.

rh



Re: How to determine where I am on a page.

2010-01-25 Thread Jürgen Spitzmüller
rgheck wrote:
> As a related question: What does \relax do, and when does one need it?

http://en.wikibooks.org/wiki/TeX/relax

Note, though, that the \condbreak macro is not my doing. I've picked it up 
eventually on comp.text.tex.

Jürgen


Re: How to determine where I am on a page.

2010-01-25 Thread rgheck

On 01/25/2010 04:52 AM, Jürgen Spitzmüller wrote:


% Conditional pagebreak
\def\condbreak#1{%
\vskip 0pt plus #1\pagebreak[3]\vskip 0pt plus -#1\relax}

   

As a related question: What does \relax do, and when does one need it?

rh



Re: How to determine where I am on a page.

2010-01-25 Thread Jürgen Spitzmüller
Philip Stubbs wrote:
> I have an element that I don't want to appear at the bottom of a page.
> Therefore, I need to test to find out how far down the page I am, and
> if more than 75% of the page is used, insert a \newpage.

One possibility:


% Conditional pagebreak
\def\condbreak#1{%
\vskip 0pt plus #1\pagebreak[3]\vskip 0pt plus -#1\relax}

\newcommand*\condbr[1]{\condbreak{#1\baselineskip}}
-

Then you can use either
\condbr{3}
which will insert a page break if less then 3 lines of text follow
or
\condbreak{}
e.g.
\condbreak{.25\textheight}

HTH,
Jürgen