Page LayoutGet text on next page if too close to bottom margin

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
shatter
Posts: 2
Joined: Wed Aug 22, 2012 6:03 pm

Get text on next page if too close to bottom margin

Post by shatter »

Hi *,

it is difficult to ask a question precisely if one does not know how to phrase it correctly. So please excuse my blunt approach, it is a result of incompetence, not of indifference or disrespect.

I currently am writing a book and use a user defined command to create a simple "scene" structure, the command \szeneinfo (see below). It might be programmed diletantic, but works.

Only catch: the "scene info" sometimes appears at the end of one page while the "text" it belongs to starts on the next.

Now: is there a (simple) way to force it to start on the next page if it get's too close to the bottom margin?

Sorry for the blunt explanation.

Code: Select all

\documentclass[a4paper]{book}
\usepackage{verbatim}
\usepackage{graphics}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{enumerate}
\usepackage{array}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[scaled]{helvet}

\topmargin       0.00cm
\textheight     22.00cm
\textwidth      14.00cm
\oddsidemargin   1.00cm
\evensidemargin  1.00cm
\marginparwidth  80pt

\newcommand{\szeneinfo}[4]{
\stepcounter{scenecounter}
\texorpdfstring{

\bigskip
\bigskip
\bigskip
\begin{center}
{\bf \Large \thescenecounter }

\medskip
#2, #3
\end{center}

\medskip
}
}
I know that not all parameters of the command are used; I want to be able to change it into something more likeable for the reader later.
Joachim

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Get text on next page if too close to bottom margin

Post by Stefan Kottwitz »

Hi Joachim,

welcome to the board!

There's a simple way if you use the needspace package, just follow the link to the documentation.

Stefan
LaTeX.org admin
shatter
Posts: 2
Joined: Wed Aug 22, 2012 6:03 pm

Re: Get text on next page if too close to bottom margin

Post by shatter »

Hi Stefan,

thanks a million, it works like a charm.

Joachim
Post Reply