5

I have, in my article, some examples that look like this:

\begin{center}
  Lorem ipsum dolor sit amet, consetetur
  \\ \emph{sadipscing elitr, sed diam nonumy eirmod tempor invidunt}
  \\ \emph{ut labore et dolore magna aliquyam erat, sed diam voluptua.}
\end{center}

It looks like I want/need it to, and it works. But now I want to numerate those examples (if possible automatically), with a little number to the left, like when using an \begin{equation}. Plus, I want a label.

I'm fairly new and superficial in LaTeX, so I'm open for your knowledgable input on this.

  • You should just use the enumerate environment: \begin{enumerate} \item Lorem ipsum ... \end{enumerate}. – Werner Oct 4 '12 at 18:54
  • @Werner Not really, because they're not consecutive. Between these examples, there's some explanatory text. – Lanbo Oct 4 '12 at 19:05
  • 1
    If you want to stop the enumerate environment then write something else then start another enumerate environment while continuing from the last number, the enumitem package will do that for you. \begin{enumerate}\item First item.\item Second item. \end{enumerate}Text.\begin{enumerate}[resume]\item Third item \end{enumerate} It would be great if you posted a MWE. – abdulhaq-e Oct 4 '12 at 19:12
  • @AbdulhaqElhouderi I have no idea what an MWE is, sorry. – Lanbo Oct 4 '12 at 19:35
  • 1
    MWE = minimum working example, a TeX document that shows what you are trying to do. minimalbeispiel.de/mini-en.html – abdulhaq-e Oct 4 '12 at 19:58
5

One way to do this is to define a custom environment so that the changes you need to make are minimal. Below I have defined a MyQuote environment which you use instead of the center environment and it requires a parameter which defines how you want to label this:

enter image description here

Notes:

  • As per your comments you had indicated that the labels were non-consecutive, so the method here provides an environment which allows you to individually specify the labels. If you want them to be consecutive you can adapt this to use the resume feature available with the enumerate environment from the enumitem package as per Harish Kumar's answer.

Code:

\documentclass{article}
\usepackage{enumitem}

\newenvironment{MyQuote}[1]{%
    \begin{description}
    \item [#1]
    \begin{minipage}[t]{\linewidth}
    \begin{center}
}{%
    \end{center}
    \end{minipage}%
    \end{description}
}

\begin{document}
\begin{MyQuote}{3}
  Lorem ipsum dolor sit amet, consetetur
  \\ \emph{sadipscing elitr, sed diam nonumy eirmod tempor invidunt}
  \\ \emph{ut labore et dolore magna aliquyam erat, sed diam voluptua.}
\end{MyQuote}

\begin{MyQuote}{7}
  Lorem ipsum dolor sit amet, consetetur
  \\ \emph{sadipscing elitr, sed diam nonumy eirmod tempor invidunt}
  \\ \emph{ut labore et dolore magna aliquyam erat, sed diam voluptua.}
\end{MyQuote}
\end{document}
  • Is there a way to make the \item appear on the right side? – Lanbo Oct 7 '12 at 16:47
4

I think, I have not understood your requirements. But still, giving it a try.

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}

\begin{document}
\begin{enumerate}[leftmargin=2cm,rightmargin=2cm,labelsep=1.7cm]
 \item { Lorem ipsum dolor sit amet, consetetur
  \\ \emph{sadipscing elitr, sed diam nonumy eirmod tempor invidunt}
  \\ \emph{ut labore et dolore magna aliquyam erat, sed diam voluptua.}}\label{item:blur}

\end{enumerate}
\lipsum[1]
\begin{enumerate}[resume*]
 \item { Lorem ipsum dolor sit amet, consetetur
  \\ \emph{sadipscing elitr, sed diam nonumy eirmod tempor invidunt}
  \\ \emph{ut labore et dolore magna aliquyam erat, sed diam voluptua.}}
\end{enumerate}

From item~\ref{item:blur}, it can be seen that....

\end{document}

enter image description here

The code given in this answer is (may be) called a MWE.

  • +1: But you have removed the fact that the OP wanted the text centered. – Peter Grill Oct 5 '12 at 0:39
  • @PeterGrill: It was a confusion. But any how, now there is solution (by you) with centering. :) – user11232 Oct 5 '12 at 0:45
  • Yeah, but I was hoping you could figure out how to do it without using a minipage. :-) – Peter Grill Oct 5 '12 at 0:47
1

The following provides an "enumeration" that is breakable across the page boundary. The number is set as a \marginpar and pushed back into the text block. This may cause some overlapping problems, but I'm not sure whether this is an issue for you (your code snippet didn't show any such usage):

enter image description here

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum

\makeatletter
\reversemarginpar% Switch side of \marginpar
\newenvironment{numquote}[1]{% \begin{numquote}{<num>}
  \par\sbox\z@{\bfseries#1}%
  \leavevmode%
  \marginpar{\rlap{\hspace*{\dimexpr\marginparwidth+\marginparsep}\usebox\z@}}%
  \centering%
}{% \end{numquote}
  \par}
\makeatother

\begin{document}
\lipsum[1]
\begin{numquote}{3}
  Lorem ipsum dolor sit amet, consetetur
  \\ \emph{sadipscing elitr, sed diam nonumy eirmod tempor invidunt}
  \\ \emph{ut labore et dolore magna aliquyam erat, sed diam voluptua.}
\end{numquote}
\lipsum[2-3]
\begin{numquote}{7}
  Lorem ipsum dolor sit amet, consetetur
  \\ \emph{sadipscing elitr, sed diam nonumy eirmod tempor invidunt}
  \\ \emph{ut labore et dolore magna aliquyam erat, sed diam voluptua.}
\end{numquote}
\lipsum[3]
\begin{numquote}{97}
  Lorem ipsum dolor sit amet, consetetur
  \\ \emph{sadipscing elitr, sed diam nonumy eirmod tempor invidunt}
  \\ \emph{ut labore et dolore magna aliquyam erat, sed diam voluptua.}
\end{numquote}
\lipsum[4]
\begin{numquote}{102}
  Lorem ipsum dolor sit amet, consetetur
  \\ \emph{sadipscing elitr, sed diam nonumy eirmod tempor invidunt}
  \\ \emph{ut labore et dolore magna aliquyam erat, sed diam voluptua.}
\end{numquote}
\lipsum[5]
\end{document}

lipsum provided some dummy text, Lorem ipsum style.

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.