3

I am using LyX to answer questions for an assignment. Specifically, I am using the numbered list tool to number my answers. Some of the answers are quite long and go over multiple paragraphs, so I am using the following method to have multiple paragraphs inside a single numbered item:

  1. Click the "numbered list" button.
  2. Type first the paragraph.
  3. Hit return to start a new paragraph. This automatically starts a new numbered item.
  4. Type the second paragraph.
  5. Click the "default" button next to the "numbered list" button, or change the type to standard. This removes the undesired number from the start of the paragraph and indents the first line, but the entire paragraph is unaligned with the first paragraph.
  6. Hit tab, or hit alt+shift+right, or click the "increase depth" button. This aligns the second paragraph with the first, but removes the indent from the first line.

The result of the above steps looks likes this:

1. This is the first paragraph.
   This is the second paragraph,
   here it is wrapped around,
   and wrapped around some more.

This is what I would like it to look like:

1. This is the first paragraph.
      This is the second paragraph,
   here it is wrapped around,
   and wrapped around some more.

I can achieve the desired result by hitting ctrl+space a couple times before each new paragraph, but would like a better (less duplication of effort) method. This is similar to this question, except that I want indentation inside the list, not after. At the time of posting, the other question has no accepted solution.

Note that this requirement is self-imposed purely to make for easy reading. Alternative suggestions to the same end will also be appreciated!

EDIT: The tex source, copied and pasted:

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\begin{document}
\begin{enumerate}
\item This is a paragraph.


This is another paragraph.\end{enumerate}

\end{document}

Running through pdf-latex gives the original result, i.e. no first-line indentation.

1
  • By the way, I am using LyX version 2.0.5.1 on Ubunbtu 10.04 (Old,I know, but so is my laptop)
    – Phil Bosmn
    Sep 18, 2013 at 15:37

2 Answers 2

3

Within LaTeX's default list environments, paragraphs have no indent. The definition of \list from the LaTeX kernel identifies this:

\def\list#1#2{%
  \ifnum \@listdepth >5\relax
    \@toodeep
  \else
    \global\advance\@listdepth\@ne
  \fi
  \rightmargin\z@
  \listparindent\z@% <------------------ No \listparindent
  \itemindent\z@
  \csname @list\romannumeral\the\@listdepth\endcsname
  \def\@itemlabel{#1}%
  \let\makelabel\@mklab
  \@nmbrlistfalse
  #2\relax
  \@trivlist
  \parskip\parsep
  \parindent\listparindent% <----------- No \parindent
  \advance\linewidth -\rightmargin
  \advance\linewidth -\leftmargin
  \advance\@totalleftmargin \leftmargin
  \parshape \@ne \@totalleftmargin \linewidth
  \ignorespaces}

So you either have to insert this manually via an ERT that contains \hspace*{20pt} (where 20pt is the default \parindent) or "fix" \list to not set this value to zero (\z@) via an etoolbox patch:

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\list}{\listparindent\z@}{\listparindent\parindent}{}{}
\makeatother

Include the above in your LaTeX preamble.

enter image description here

\documentclass{article}
\usepackage{lipsum,etoolbox}% http://ctan.org/pkg/{lipsum,etoolbox}
\makeatletter
\patchcmd{\list}{\listparindent\z@}{\listparindent\parindent}{}{}
\makeatother
\begin{document}
\begin{enumerate}
  \item \lipsum[1-2]
\end{enumerate}

\end{document}
0

When you set paragraph separation or indentation for normal text in Lyx, in the non editable preamble is writed some like:

\setlength{\parskip}{0ex}

or

\setlength{\parindent}{1em}

In plain LaTeX you can simple insert similar commands in the enumerate environment, but before of the first item, to obtain what you want.

In LyX this is not possible, but you can edit the preamble to redefine the enumerate environment to include indentation, paragraph separations or another modifications as color:

MWE

\documentclass[a4paper]{article}
\usepackage[margin=2cm]{geometry} 
\usepackage{lipsum,xcolor}

% paragraph settings  

% redefined enumerate 
\let\oldenumerate\enumerate
\let\endoldenumerate\endenumerate
\renewenvironment{enumerate}
{\oldenumerate
\color{blue!50!black}
\setlength{\parskip}{1ex}
\setlength{\parindent}{3em}}
{\endoldenumerate}


\begin{document}
\lipsum[1]
\lipsum[2]
\begin{enumerate}
\item \lipsum[1]\lipsum[2]
\item \lipsum[3]
\end{enumerate}
\lipsum[1]
\lipsum[2]
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .