2

I want to achieve the following output in LaTex:

enter image description here

The enumeration should be automatic (so, the next indented text should be labeled by (2)) and the text should be left-aligned. So, I'm looking for something similar to what the equation environment produces, but for text, left-aligned and with the label on the left-hand side before the text.

2 Answers 2

2

The enumitem package offers the label option (to achieve (1), (2), ...) and the resume option (to continue counting from a previous instance).

Here is one possible way to use the package:

\documentclass{article}
\usepackage{enumitem}

% Introduce a new type of list based on "enumerate"
\newlist{sentences}{enumerate}{1}
\setlist[sentences]{label=(\arabic*), leftmargin=1.5cm, before=\raggedright}

\begin{document}

Text.

\begin{sentences}
    \item This is a sentence
\end{sentences}

Text.

\begin{sentences}[resume]
    \item This is a another sentence
\end{sentences}

Text.
\end{document}
2
  • Two problems: (a) Sometimes I need to use such an indented text inside a list, i.e. inside an enumerate environment. (b) I guess the resume parameter is always referring to the previous enumerate environment. What if I have actual lists between them?
    – 0xbadf00d
    Sep 2, 2019 at 15:13
  • I adapted the answer accordingly. See the documentation of enumitem for more details and options. Sep 2, 2019 at 15:21
0

You can use list:

\documentclass{article}

\usepackage{lipsum}

\makeatletter
\newcounter{nquotation}
\newenvironment{nquotation}
 {%
  \list{\thenquotation}{%
    \@nmbrlisttrue\def\@listctr{nquotation}%
    \setlength{\leftmargin}{6em}%
    \setlength{\rightmargin}{\leftmargin}%
    \setlength{\parsep}{\z@skip}%
    \setlength{\labelsep}{0pt}%
    \def\makelabel##1{\hss\llap{(##1)\quad``}}%
  }%
  \item\relax
  }
  {\unskip''\endlist}
\makeatother

\begin{document}

This refers to sentence~\ref{first} and this to sentence~\ref{second}.

\lipsum[1][1-4]
\begin{nquotation}\label{first}
This is a sentence
\end{nquotation}
\lipsum[2][1-4]
\begin{nquotation}\label{second}
This is a longer sentence that will be longer than one line; let's
add some text to ensure there will be a line break.
\end{nquotation}
\lipsum[3][1-2]

\end{document}

enter image description here

You must log in to answer this question.

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