Text FormattingTwo questions with the enumitem package

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
kitsune
Posts: 6
Joined: Thu Feb 11, 2010 7:19 pm

Two questions with the enumitem package

Post by kitsune »

I'm current using enumitem to make a list.

1.) Each item consists of multiple paragraphs. I want each item to stay on one page. Is this possible? (I think it might have something to do with penalties but I can't get it to work.)

2.) How can I add a horizontal line to separate the items?

Thanks!
Last edited by kitsune on Thu Apr 08, 2010 5:40 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Two questions with the enumitem package

Post by meho_r »

If you want to make pagebreak between items so every item is on a separate page (if not, remove \newpage when defining \litem), and add a horizontal line before/after every one of them, you may test this code and customize it further for your needs (e.g., if you want horizontal line after items, put \hrule after \newpage):

Code: Select all

\documentclass{book}
\usepackage{enumitem}
\usepackage{lipsum}% for generating dummy text

\newcommand\litem[1]{\newpage\hrule\item{#1}}% customizing item entries

\begin{document}

\lipsum[1-2]% dummy text, 2 paragraphs

\begin{itemize}

\litem Test 

\lipsum[1-3]% dummy text, 3 paragraphs

\litem Test 

\lipsum[1-3]% dummy text, 3 paragraphs

\litem Test 

\lipsum[1-3]% dummy text, 3 paragraphs

\end{itemize}

\end{document}
kitsune
Posts: 6
Joined: Thu Feb 11, 2010 7:19 pm

Re: Two questions with the enumitem package

Post by kitsune »

Thank you! The horizontal line part works!

For the page break problem, I do not want one item to be split onto two pages. (Each item is small enough to fit on one page.) Having multiple items on one page is fine. Is there a way to do that?
magicmoose
Posts: 90
Joined: Fri Nov 06, 2009 7:29 am

Two questions with the enumitem package

Post by magicmoose »

how is this for you (just a modification of meho_r's code):

Code: Select all

\documentclass{book}
\usepackage{enumitem}
\usepackage{lipsum}% for generating dummy text

\newlength{\minipagewidth}
		
\newenvironment{litem}{\vspace{3pt}\hrule\item \begin{minipage}[t]{\minipagewidth}}{\end{minipage}}% customizing item entries

\begin{document}

\setlength{\minipagewidth}{4.42in}
    
\lipsum[1-2]% dummy text, 2 paragraphs

\begin{itemize}

  \begin{litem} Test 
  \lipsum[1-2]% dummy text, 3 paragraphs
  \end{litem}
		
  \begin{litem} Test 
  \lipsum[1]% dummy text, 3 paragraphs
  \end{litem}
		
  \begin{litem} Test 
  \lipsum[1]% dummy text, 3 paragraphs
  \end{litem}
    
\end{itemize}

\lipsum[1-2]

\end{document}
kitsune
Posts: 6
Joined: Thu Feb 11, 2010 7:19 pm

Re: Two questions with the enumitem package

Post by kitsune »

Thanks! I got it to work with your solution! :D
Post Reply