Text FormattingNo pagebreak in item

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ghostguy
Posts: 2
Joined: Tue Aug 17, 2010 9:06 pm

No pagebreak in item

Post by ghostguy »

Hello!

I've tried to find a solution to this but even though it seams a simple problem, there was no info to be found.

I do not want a pagebreak to happen within an item of a list environment so that always the whole text of an item appears on the same page.

I tried to solve it with putting a \parbox around the item text. However then I don't know what the proper width of the parbox should be to match the other items.

Minimum Example:

Code: Select all

Code, edit and compile here:
\documentclass[a4paper,12pt]{report}
\begin{document}
\vspace*{41em}
\noindent Following list is a sample list.:
\begin{itemize}
\item This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text.
\item \parbox[t]{\textwidth}{This item will normally be spread over two pages but I don't want that. If I use \textbackslash parbox with \textbackslash textwidth the box is to large. How can I define the proper size? Or is there a better solution? This is a sample text. This is a sample text. This is a sample text. }
\item This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text.
\end{itemize}
\end{document}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
It would be great if you could help me out!

Thanks.
Joe

Recommended reading 2024:

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

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

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

No pagebreak in item

Post by gmedina »

Hi,

you have to subtract \leftmargin (the length that controls the indentation of items) from \textwidth:

Code: Select all

Code, edit and compile here:
\documentclass[a4paper,12pt]{report}
\usepackage{calc}
\begin{document}
\vspace*{41em}
\noindent Following list is a sample list.:
\begin{itemize}
\item This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text.
\item \parbox{\textwidth-\leftmargin}{This item will normally be spread over two pages but I don't want that. If I use \textbackslash parbox with \textbackslash textwidth the box is to large. How can I define the proper size? Or is there a better solution? This is a sample text. This is a sample text. This is a sample text.}
\item This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text.
\end{itemize}
\end{document}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ghostguy
Posts: 2
Joined: Tue Aug 17, 2010 9:06 pm

Re: No pagebreak in item

Post by ghostguy »

Perfect! Thank you.

Joe
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

No pagebreak in item

Post by localghost »

Now that the problem is solved, please mark it exactly as described in Section 3 of the Board Rules (last two paragraphs).


Best regards and welcome to the board
Thorsten
samcarter
Posts: 3
Joined: Sat Feb 21, 2015 6:01 pm

No pagebreak in item

Post by samcarter »

You want `\linewidth` instead of `\textwidth`

Code: Select all

Code, edit and compile here:
\documentclass[a4paper,12pt]{report}
\begin{document}
\vspace*{41em}
\noindent Following list is a sample list.:
\begin{itemize}
\item This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text.
\item \parbox[t]{\linewidth}{This item will normally be spread over two pages but I don't want that. If I use \textbackslash parbox with \textbackslash textwidth the box is to large. How can I define the proper size? Or is there a better solution? This is a sample text. This is a sample text. This is a sample text. }
\item This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text.
\end{itemize}
\end{document}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Post Reply