You can use
\vbox{\begin{verbatim}
[ verbatim material ]
\end{verbatim}}
The vbox is a TeX primitive command that work also in LateX. Maybe there
is a more LaTeX way to do this? But this works
Olive
Of course, there is the environment "minipage".
Also \samepage could be tried:
\begingroup
\samepage
\begin{verbatim}
...
\end{verbatim}
\endgroup
Yours sincerely
Heiko <ober...@uni-freiburg.de>
If I remember correctly, verbatim takes account of \interlinepenalty so
\samepage should work.
{\samepage
\begin{verbatim}
.
.
.
\end{verbatim}
}
Or maybe, more properly (not tested, though)
% Preamble
\usepackage{verbatim}
\newcounter{interlinepenalty}
\newenvironment*{nbverbatim}{%
\setcounter{interlinepenalty}{\interlinepenalty}%
\interlinepenalty = 10000
\verbatim
}{%
\endverbatim
\interlinepenalty = \value{interlinepenalty}%
}
% In the body
--
Joss
\newenvironment{unbreakable}{\samepage}{\pagebreak[0]}
\begin{unbreakable}
\section{A section in which no pagebreaks occur}
Everything written in this section will be forced on a page. LaTeX is
allowed to put pagebreaks before or after the section to make it fit
\end{unbreakable}
% Opportunity to break here
\begin{unbreakable}
\section{Another section}
Also this section is immune for pagebreaks
\end{unbreakable}
Best regards,
Birdy
On 29 nov, 19:07, noi...@clipper.ens.fr (Josselin Noirel) wrote:
> Olive wrote in message <456dc923$0$388$bf494...@news.tele2.nl>:
> Not related to the verbatim package, but to a problem I had when using
> \samepage multiple times to ensure no pagebreaks occur inside sections
> is that LaTeX somehow related the different \samepage commands even
> when they were embraced by braces!
This certainly happens. You have to know how to use \sampepage right,
and it is a bit odd. The control of breaking within a paragraph depends
on whether \samepage is in effect _when_the_paragraph_ends_!
Also, \samepage does not prevent breaks between regular paragraphs.
> I wanted LaTeX to insert pagebreaks
> in between sections if necessary,
You will have better results putting \filbreak before the sectioning
commands (or in their definitions), and avoiding \samepage. It works
better.
> \newenvironment{unbreakable}{\samepage}{\pagebreak[0]}
Should be
\newenvironment{unbreakable}{\par\samepage}{\par\pagebreak[0]}
--
Donald Arseneau as...@triumf.ca