## LaTeX forum ⇒ Text Formatting ⇒ Adding horizontal rules between list items

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
4fingers
Posts: 12
Joined: Fri Jul 03, 2009 11:57 am

### Adding horizontal rules between list items

Hi,

I have the following list:
\documentclass[12]{article} \newenvironment{questions}{	\begin{list}{*}{}}{	\end{list}} \newenvironment{question}{\item}{} \begin{document}Hello world\begin{questions} \begin{question}Item one\end{question}\begin{question}Item two\end{question}\begin{question}Item three\end{question} \end{questions}\end{document}

What I would like to do is add a horzontal rule above and below each list item. I tried placing the rule between each list item but that results in an error:
\rule{\textwidth}{1mm} \begin{question}Item one\end{question}\rule{\textwidth}{1mm} \begin{question}Item two\end{question}\rule{\textwidth}{1mm} \begin{question}Item three\end{question}\rule{\textwidth}{1mm}

I can't place the rule in the actual body of the list item as the rule is not placed above the label:
\rule{\textwidth}{1mm} \begin{question}\rule{\textwidth}{1mm}Item one\end{question}\begin{question}\rule{\textwidth}{1mm} Item two\end{question}\begin{question}\rule{\textwidth}{1mm} Item three\rule{\textwidth}{1mm}\end{question}

Does anyone have any ideas how this could be achieved?
Thanks

magicmoose
Posts: 90
Joined: Fri Nov 06, 2009 7:29 am
How is this code?
    \documentclass{article}      \newenvironment{question}{\noindent\rule{\textwidth}{1mm}\begin{list}{*}{}\item}{\end{list}} 		\newenvironment{questions}{}{\rule{\textwidth}{1mm}}      \begin{document}     Hello world 		\begin{questions}     \begin{question}Item one\end{question}     \begin{question}Item two\end{question}     \begin{question}Item three\end{question}		\end{questions}      \end{document}

edit: fixed code

4fingers
Posts: 12
Joined: Fri Jul 03, 2009 11:57 am
Thanks for your help; I have successfully managed to apply horizontal rules between list items in my PDFs.