3

Consider this small document:

\documentclass{article}

\usepackage{blindtext}

\begin{document}

\blindtext

\blindtext

\begin{enumerate}
\item%
\blindtext

\blindtext
\end{enumerate}

\end{document}

This has two paragraphs outside a list environment, and two paragraphs inside a list environment. I've noticed in this situation that paragraphs outside lists have their first line indented, whereas paragraphs inside lists do not have any indent:

Compiled document with markings

Why does this occur? Can I restore the indentation inside a list?

EDIT: I notice that in lists, by default paragraphs are separated by blank lines. Preferably a solution should also get rid of that. (For context, I'm writing up a solution to an assignment, and nearly every paragraph is inside an enumerate or similar.)

  • 2
    "why" questions are hard to answer, the list paragraph shape is settable as are the outer paragraphs the standard latex classes chose choose that layout as presumably the original author preferred it that way. you can set \listparindent` and other list parameters to achieve other shapes – David Carlisle Mar 28 at 1:23
2

\item properties can be formatted with enumitem. Then you can use listparindent for enumerate environment:

\documentclass{article}

\usepackage{blindtext}
\usepackage{enumitem}
\setlist[enumerate]{parsep=0pt}

\begin{document}

\blindtext

\blindtext

    \begin{enumerate}[listparindent=1.5em]

        \item
        \blindtext

        \blindtext

    \end{enumerate}

\end{document}

enter image description here

EDIT: Thanks to @David, you can also set \parsep to 0 if you want to get rid of that space.

  • Nice! Unfortunately, this doesn't entirely answer my question: I also asked why this behaviour happens. I also notice that this method still preserves that extra horizontal space between paragraphs in the list; do you have any idea how to get rid of that? – bradrn Mar 28 at 0:56
  • @bradrn AFAIK enumerate is kind of old and enumitem gives you more advantage and options comparing to list environments such as itemize and enumerate. However my understanding is enumerate eliminates the paragraph indentation by default. Regarding that horizontal space, I'll have a look. – Majid Abdolshah Mar 28 at 1:16
  • @bradrn You can always use something like this \vspace{-0.1cm} after the paragraph. But it's not the best solution of course. – Majid Abdolshah Mar 28 at 1:24
  • @bradrn the paragraph space is \parsep (or parsep in the enumitem interface) so you can set that to 0pt – David Carlisle Mar 28 at 1:26
  • 1
    @MajidAbdolshah In my 'real' code, I'm already using enumitem. – bradrn Mar 28 at 1:27
1

The reason for this behaviour is that inside enumerate the length \parindent is set to zero. So you can not use a simple \indent as usual in normal text to get the space of \parindent set.

You can simulate the ususal behaviour in normal text with the following code (See <===== for important code):

\documentclass{article}

\usepackage{blindtext}
\usepackage{enumitem} % <===============================================
\newlength{\enumerateparindent} % <=====================================

\begin{document}

\setlength{\enumerateparindent}{\parindent} % <=========================
\blindtext

\blindtext

\begin{enumerate}
\setlength{\parindent}{\enumerateparindent} % <=========================
%\show\parindent 
%\value{\parindent}
\item%
\blindtext

\blindtext
\end{enumerate}

Version 2:
\begin{enumerate}[listparindent=\enumerateparindent] % <================
\item%
\blindtext

\blindtext
\end{enumerate}

\end{document}

and the wished result:

enter image description here

Please see that \setlength{\parindent}{\enumerateparindent} does only work in that enumerate list you placed the command inside ...

If you are already using package enumitem -- as mentioned in an comment -- you can use it to use the same indent defined in \parindent with version 2 in my mwe.

The you get the resulting version 2:

enter image description here

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.