How to prevent Item started on one page from continuing on another in Latex?

Asked

Viewed 3,708 times

4

I work with a template from COPPE/UFRJ Coppetex in my dissertation work.

I made a numbered list with the command \item but as the list was at the end of the page has one of the points that started the end of the page and ended at the beginning of the following page.

The problem that was so little in this last line on the new page that gets ugly.

Dai wondered if anyone knows any commands that put that whole item on the following page, or better still if someone who knows some Packages that solve that problem.

P.S. > has who told me to use \pagebreak which solves, but I think it’s not the case to use include a command each time this problem appears.

  \begin{enumerate}
   \item As âncoras são progressivamente movidas avante à medida que o lançamento é feito. Um barco de movimentação de âncora move sucessivamente cada âncora da proa enquanto outro barco movimenta as âncoras de popa, Figura 3.5;
%\pagebreak
\item Um barco de alimentação ou uma balsa auxiliar fornece os tubos (em geral, 12m);
\item O tubo é corretamente posicionado e avança sucessivamente para as estações de soldagem com um ou mais passos de solda sendo executados em cada uma delas;

\end{enumerate}

Visualização do Erro

2 answers

3


You can try using one minipage to force the contents of an item to be always on the same page. Not much better than your current solution, in the sense that you need to use this command along with each \item where you want to avoid division, but it’s better than the pagebreak because you don’t force the page break and leave it to Latex.

The solution I once used was to create a new command to use together with the command item, facilitating the creation of minipage:

\newcommand{\samepageblock}[1]{\begin{minipage}[t]{\linewidth}#1\end{minipage}}

Dai, when creating an item, simply include the text in the new command:

\item \samepageblock{Aqui vai o texto que não pode ser separado em páginas diferentes}

In this example available online at Overleaf, without the use of this command the result is this:

inserir a descrição da imagem aqui

And with the use of the command only in the last item (for illustrative effect) the result is this:

inserir a descrição da imagem aqui

It shall be possible to change the command item directly (using renewcommand) to always include a minipage in the text and so do not need to use this new command manually for each new item created. But I don’t know if this is a good idea, because all the documentation I’ve read about it says to avoid at all costs altering the behavior of the command item directly.

Complete code of the example:

\documentclass{article}

\begin{document}

% ---------------------------------
\newcommand{\samepageblock}[1]{\begin{minipage}[t]{\linewidth}#1\end{minipage}}
% ---------------------------------

\begin{itemize}

\item Morbi vitae sapien odio. Ut ipsum lectus, viverra nec vehicula nec, consectetur in turpis.

\item Curabitur sagittis ipsum nec purus imperdiet, a vestibulum nunc ultrices.

\item Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sagittis ut velit nec auctor. Fusce convallis arcu id sem rhoncus tristique. Sed blandit, dui ac eleifend ultricies, neque arcu luctus ligula, suscipit euismod ligula metus nec diam. Vestibulum non tristique est. Duis venenatis rhoncus felis, non ultrices nulla malesuada et. Duis quis dolor laoreet nisi accumsan tempor. Donec ac nibh vitae mi tempus laoreet.

\item Proin a semper nisi. Vivamus ut erat sapien. Praesent quis nisl ut nisl ultricies dictum sed eu est. Etiam varius tincidunt ante id aliquam. Nullam felis lorem, pulvinar suscipit turpis eu, ultrices porta justo. Quisque non nunc vitae elit blandit viverra. Suspendisse malesuada finibus odio ut aliquet. Pellentesque finibus purus erat, non suscipit velit malesuada id. Nunc finibus magna metus, non vulputate diam rhoncus dictum. Nullam pellentesque lorem erat, dictum sagittis dui cursus congue. Integer eget lacus at arcu fringilla porta in at augue.

\item Aliquam pulvinar metus ante, id porttitor velit hendrerit eu. Sed vitae mattis purus. Integer efficitur turpis elit, id volutpat libero sollicitudin ac. Nunc a justo quis nulla porta tempus. Aliquam sit amet purus eros. Curabitur mattis urna eget justo hendrerit porttitor. Phasellus iaculis metus vel lacus lacinia, vel tempor mi ullamcorper. Donec interdum sapien eu auctor faucibus. Donec luctus mattis faucibus. Sed velit neque, sollicitudin eget urna vel, feugiat fringilla mi. Duis vehicula elit quis sapien egestas, a varius eros facilisis.

\item Proin finibus, risus a sollicitudin faucibus, libero nulla tempor felis, eu posuere est augue at ante. Vivamus pulvinar laoreet purus vel consequat. Phasellus eget pharetra lorem. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec augue orci, suscipit eget tortor quis, feugiat tristique risus. Maecenas augue odio, varius sed risus molestie, interdum lacinia elit. Aenean magna ex, consectetur a volutpat quis, feugiat at enim. Proin eget accumsan augue. Nulla vitae ornare nibh. Suspendisse aliquam, velit posuere eleifend auctor, ex metus sollicitudin ligula, vitae ultrices orci nulla ut mauris. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut fringilla fermentum mauris et ultricies. Phasellus semper dictum turpis, laoreet consequat massa pulvinar ut. Suspendisse est augue, tempus non enim at, rhoncus pellentesque eros. Sed et aliquam leo.

\item \samepageblock{Duis sed elit ut elit pellentesque aliquam non at risus. Fusce libero tellus, tincidunt quis tellus id, faucibus aliquet mauris. Ut in ornare turpis. Nullam a lobortis odio. Nunc non elit vitae ligula imperdiet euismod. Fusce blandit et diam sed blandit. Maecenas lobortis egestas magna vitae hendrerit. Donec efficitur libero ut leo dictum, non accumsan elit luctus. Integer ut tincidunt leo. Nullam ut nulla enim. Maecenas sodales, arcu non ornare posuere, tellus elit mollis arcu, non tincidunt mi turpis vel urna. Pellentesque porttitor nunc et lectus efficitur pretium. Nam fermentum id purus luctus tempor.}

\end{itemize}

\end{document}
  • 1

    Thanks Luiz, it’s a better solution than forcing a \pagebreak, I’m going to wait a little longer to accept the answer, so that it remains open because perhaps another latex guru knows another method also useful. Thank you

0

Latex can usually hit this on his own... In this case try:

\item
\begin{samepage}
Um barco de alimentação ou uma balsa auxiliar fornece os tubos (em geral, 12m);
\end{samepage}
\item ...

a hug JJ

Browser other questions tagged

You are not signed in. Login or sign up in order to post.