5

The code I have is:

    1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat \

But as you can see in this output:

ss](http://i.imgur.com/g3p62o2.png)![ss The part that says "mod" is not aligned with the first word, "Lorem." I would like all subsequent parts of the paragraph like the letter 'm' in "mod" to be directly under the letter 'L' in "Lorem" including any future numbered paragraphs (there will be some other stuff in between the paragraphs). How can I achieve this?

4
  • 2
    Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. Perhaps the enumerate environment is what you'd like? – cmhughes Sep 21 '13 at 15:29
  • This answer is quite complete and could help you to get what you want tex.stackexchange.com/a/55198/31058 – Ludovic C. Sep 21 '13 at 15:34
  • 4
    What is the difference between what you want to do and the enumerate environment? – Fran Sep 21 '13 at 19:20
  • I posted an answer, but withdrew it when I saw it matched Fran's comment. The enumerate environment is what you most likely want. – Steven B. Segletes Oct 22 '13 at 15:46
3

Others have mentioned enumerations, but perhaps have overlooked the request for material between items. An out-of-the-box solution for this is provided by the enumitem package, where there is the possibility of labelling an enumerate with a series name. Following instances can then use enumerate together with resume

 \begin{enumerate}[series=numpars]
 \item ...
 \end{enumerate}

 ....

 \begin{enumerate][resume=numpars]
 \item ...
 \end{enumerate}

Sample output

\documentclass{article}

\usepackage{enumitem}

\usepackage{lipsum} %For dummy text

\begin{document}

\lipsum[1]

\begin{enumerate}[series=numpars]
\item \lipsum[2]
\end{enumerate}

\lipsum[3]

\begin{enumerate}[resume=numpars]
\item \lipsum[4]
\end{enumerate}

\end{document}

If you would like a dedicated environment numpar for this without the need for resume or item then you can use the following code, which produces the same output as above. The idea is to add a toggle to keep track of whether this is the first instance or not and pass either series or resume to the list constructor. Additionally, it has been set-up with a dedicated list type numparmain, that could be customised further (via standard options in enumitem) to adjust indentation or label style.

\documentclass{article}

\usepackage{enumitem,etoolbox}
\newlist{numparmain}{enumerate}{1}
\setlist[numparmain]{label=\arabic*.}

\newtoggle{firstnumpar}
\toggletrue{firstnumpar}
\newenvironment{numpar}{\iftoggle{firstnumpar}%
      {\begin{numparmain}[series=numpars]}%
      {\begin{numparmain}[resume=numpars]}%
    \global\togglefalse{firstnumpar}%
    \item\ignorespaces}%
  {\end{numparmain}}


\usepackage{lipsum} %For dummy text

\begin{document}

\lipsum[1]

\begin{numpar}
 \lipsum[2]
\end{numpar}

\lipsum[3]

\begin{numpar}
  \lipsum[4]
\end{numpar}

\end{document}
0

A simpler solution (which does not put the number in the margins). You can adjust the size or \parindent, \parkskip etc.

\documentclass{article}

\setlength{\parindent}{.5in}
\setlength{\parskip}{.1in}

\newlength{\RightColumn}
\setlength{\RightColumn}{\textwidth}
\addtolength{\RightColumn}{-\parindent}

\newcounter{ParNum}

\newcommand{\NumPar}[1]% #1 = = paragraph
 {\stepcounter{ParNum}
 \noindent\makebox[\parindent][l]{\arabic{ParNum}}
 \parbox[t]{\RightColumn}{#1}\par}

\begin{document}

\NumPar{This is my first paragraph, but I need to add more
words until I have enough to test the hanging indentation.}

\NumPar{This is my second paragraph, but I need to add more
words until I have enough to test the hanging indentation.}

\end{document}
7
  • why not use a list construct? – David Carlisle Sep 21 '13 at 19:15
  • For most problems there are multiple possible solutions. Pick the one that appeals to you. You could even do this in a tabular. – John Kormylo Sep 22 '13 at 14:14
  • Yes of course but almost every latex display is a list center, quote, verbatim apart from its extensive support for actual lists such as enumerate, itemize it seems strange to suggest this list is numbered "by hand" in this way. – David Carlisle Sep 22 '13 at 14:19
  • I'm an old plain TeX user. (I still use \eqno.) I can do it using a counter, but do you want them in \arabic, \aleph, \Aleph, \roman or something more exotic? – John Kormylo Sep 22 '13 at 15:02
  • To put it another way, sometimes autonumbering is more or a hindrance than a help. – John Kormylo Sep 23 '13 at 15:31

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.