3

using itemize as in

\begin{itemize}

\item[1] First item

\item[2] Second item   

\end{itemize}

Second item gets split between two pages and I don't want that. I tried to use \begin{samepage} as in

\begin{itemize}

\item[1] First item

\begin{samepage}

\item[2] Second item   

\end{samepage}

\end{itemize}

but it still gets split. Do you know how to display an item all in the same page?

  • Try to move the samepage outside of itemize – Runar Sep 7 '16 at 6:50
  • It is unclear to me whether you want all the items on the same page or they can be on different pages but no item should be split across pages. – Peter Wilson Sep 7 '16 at 18:42
  • the items can be on different pages but a single item cannot be split across pages – user113589 Sep 8 '16 at 1:33
2

See the discussion about Unbreakable block. A \vbox might do what you want:

\documentclass[a4paper]{article}
\usepackage{lipsum}
\begin{document}
\begin{itemize}
 \item \lipsum
 \item \vbox{\lipsum}
\end{itemize}
\end{document}

In this case TeX will start a new page, if the second item does not fit the page, which might result in a lot of white space.

Alternatively, in the final version of the document, you can enlarge single pages by a few lines to make the item still fit on the page. See Enlarge a single page for a discussion of this approach. The following example enlarges the page by 8 lines, which is way too much, but a few lines might work.

\documentclass[a4paper]{article}
\usepackage{lipsum}
\begin{document}
\begin{itemize}
 \item \lipsum[1-3]
 \item \enlargethispage{8\baselineskip}%
       \lipsum[4-6]
 \item \lipsum
\end{itemize}
\end{document}
| improve this answer | |
  • But this vbox doesn't include the bullet, or whatever you h ave which replaces the bullet – einpoklum Nov 2 '19 at 11:04
  • @einpoklum-reinstateMonica Why should it? Which issue do you want to solve that the above code does not address? The code as given above will keep the item on one page, and the bullet appears where the item is. – gernot Nov 2 '19 at 11:32
  • Because sometimes the "bullet" can itself be some text which may include a line break. – einpoklum Nov 2 '19 at 13:26
  • @einpoklum-reinstateMonica Having a text (with line breaks) instead of a bullet seems like a creative use of the itemize environment for what it is not intended for. Please ask a separate question and give a minimal working example that illustrates what you want to achieve. – gernot Nov 2 '19 at 13:40
1

You should use the \begin{samepage}...\end{samepage} in a proper way. Such as:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
%opening
\title{}
\author{}

\begin{document}
\newbox\one
\newbox\two
\long\def\loremlines#1{%
    \setbox\one=\vbox {%
       Test.\footnote{a footnote}%
      \lipsum\footnote{Another footnote.}%
     }
   \setbox\two=\vsplit\one to #1\baselineskip
   \unvbox\two}
\begin{samepage}
\begin{itemize}
 \item \loremlines{15}
 \item \loremlines{15}
 \item \loremlines{25}
 \end{itemize}
\end{samepage}


\end{document}

You will be fine then:

enter image description here

But without the samepage it would not fit in a page:

enter image description here

| improve this answer | |
0

Since this is a numbered list, you should use the enumerate environment so that numbering is automatic instead of manually numbering each \item. To keep a list \item on the same page you could put it inside a minipage.

Below, I used the enumitem package's resume feature to continue the list and place the second item within its own resumed list within a minipage.

enter image description here

Notes:

  • This assumes that the content within the minipage fits in one page at the most.

Code:

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}

\begin{document}
\begin{enumerate}[label=\arabic*, series=MySeries]
    \item \lipsum[1-2]
\end{enumerate}
\begin{minipage}{\linewidth}% <-- Kee content from here to end{minipage} on same page.
    \begin{enumerate}[resume*=MySeries]
        \item \lipsum[3-5]   
    \end{enumerate}
\end{minipage}
\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.