Text FormattingEnumerate, don't indent next lines

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
neo007
Posts: 3
Joined: Sat Jan 29, 2011 8:31 pm

Enumerate, don't indent next lines

Post by neo007 »

Hi, I want my enumation to look like

Code: Select all

1. Lorem ipsum dolor sit amet, consectetur adipi
scing elit. Donec dignissim, risus non pretium s
celerisque, leo ante malesuada purus, a iaculis
mi elit id velit. Suspendisse eu dapibus neque. 
Nulla facilisi.
and not as

Code: Select all

1. Lorem ipsum dolor sit amet, consectetur adipi
   scing elit. Donec dignissim, risus non pretiu
   m scelerisque, leo ante malesuada purus, a ia
   culis mi elit id velit. Suspendisse eu dapibu
   s neque. Nulla facilisi.
How is that possible? I tried something with itemindent but it didn't work.
Last edited by neo007 on Tue Feb 08, 2011 10:39 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Enumerate, don't indent next lines

Post by frabjous »

That just leads to new questions...

Do you want *all* the lines indented some amount, or flush with the regular text? I.e., do you want:

Code: Select all

Here is regular paragraph text.

1. Some really long text that wraps around
in an item.
2. Something else.

The next paragraph
Or do you want:

Code: Select all

Here is regular paragraph text.

    1. Some really long text that wraps around 
    in an item.
    2. Something else.

The next paragraph
How do you want the number aligned? E.g., like this:

Code: Select all

9. Something
10. Something else
Or

Code: Select all

 9. Something
10. Something
Or

Code: Select all

9.  Something
10. Something
Do you want this to affect *all* enumerate environments, or do you want a special one for these kinds of lists?
neo007
Posts: 3
Joined: Sat Jan 29, 2011 8:31 pm

Enumerate, don't indent next lines

Post by neo007 »

Generally I want sth like this

Code: Select all

Here is regular paragraph text.

(i)   Some really long text that wraps around
in an item.
(ii)  Something else.
(iii) Some more
(iv)  An even more very long
text like this one

The next paragraph
Since I know that enumerating with (i) could be achived using

Code: Select all

\begin{enumerate}[{\normalfont (i)}]
I just ask how to change the indentation.

I don't want it to affect all enumarate, just selected ones should look like my example and others should look as they used to.
Frits
Posts: 169
Joined: Wed Feb 02, 2011 6:02 pm

Enumerate, don't indent next lines

Post by Frits »

Try the enumitem package. That should give you enough control. Several examples are given in the documentation.
howtoTeX.com - Your LaTeX resource site (Tips, Tricks, Templates and more!)
Follow howtoTeX on twitter
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Enumerate, don't indent next lines

Post by frabjous »

Actually I have no idea how to do that with the enumitem package. Frits, if you do, please go ahead and give the details.

You could just write your own environment from scratch, however; shouldn't be too hard. E.g.:

Code: Select all

\documentclass{article}

\newcounter{myenumi}
\renewcommand{\themyenumi}{(\roman{myenumi})}
\newenvironment{myenumerate}{%
% stuff for beginning of environment goes here
\setlength{\parindent}{0pt}% don't indent paragraphs
\setcounter{myenumi}{0}% restart numbering
\bigskip% skip a line
\renewcommand{\item}{% new definition of item
\par% start a new line
\refstepcounter{myenumi}% advance counter
\makebox[2.5em][l]{\themyenumi}% print counter to width of 3em, aligned to left
}% end of definition of item
}{% at end of environment
\par% start new paragraph
\bigskip% skip a line
\noindent% don't indent new paragraph
\ignorespacesafterend% ignore spaces after environment
}
\begin{document}
Here is some regular text, and I'm going to go on a bit just to see where it wraps and all that.

\begin{myenumerate}
\item Here is the first item which goes on a bit so we can see how it wraps, and it still needs to be longer.
\item Here is another item.
\item Here is yet another item.
\item And this item is going to be much much longer so we can see another example of one that wraps.
\end{myenumerate}
Here is some more regular text, and let's go on a bit here too, just in case it's important how that looks too.

\end{document}

You may need to fiddle with the width of the makebox if these numbers get really long, and do some more stuff if you need subitems, etc., but this might get you started.
Frits
Posts: 169
Joined: Wed Feb 02, 2011 6:02 pm

Enumerate, don't indent next lines

Post by Frits »

The enumitem package is not my favorite of all, the documentation is not very clear. Been struggling with it to show that it can solve this problem:

Code: Select all

\documentclass[]{article}
\usepackage{enumitem}

\newlist{myenumi}{description}{10}
\setlist[myenumi]{labelindent=\parindent, leftmargin=*, label=(\roman*), align=left}
\setlist[myenumi]{leftmargin=0pt}

\begin{document}
Here is regular paragraph text.
\begin{myenumi}
\item[(i)] Some really reallyreallyreallyreallyreally long text that wraps around
in an item.
\item[(ii)] Something else.
\item[(iii)] Some more
\item[(iv)] An even more very reallyreallyreallyreallyreally long item
\end{myenumi}
The next paragraph
\end{document}
Hopefully this is what you meant, if not please say so. I basically redefined the description environment and called it myenumi. The disadvantage of this method is that you'll have to manually number your items, which probably won't be a problem if the list is not too long 8-)
howtoTeX.com - Your LaTeX resource site (Tips, Tricks, Templates and more!)
Follow howtoTeX on twitter
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Enumerate, don't indent next lines

Post by frabjous »

But with that, Frits, you have to manually number the list items, the beginnings of the text are not horizontally aligned, and \label and \ref doesn't work. No offense, but I think my solution is much better.
Frits
Posts: 169
Joined: Wed Feb 02, 2011 6:02 pm

Re: Enumerate, don't indent next lines

Post by Frits »

No doubt your solution is better :) but for beginners it might be a bit complex to write an environment from scratch. Anyway, it's great that you showed a way to customize lists without making use of enumitem!
howtoTeX.com - Your LaTeX resource site (Tips, Tricks, Templates and more!)
Follow howtoTeX on twitter
neo007
Posts: 3
Joined: Sat Jan 29, 2011 8:31 pm

Re: Enumerate, don't indent next lines

Post by neo007 »

Thank you frabjous! It's exactly what I wanted. I didn't know that with latex everything is possible.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Enumerate, don't indent next lines

Post by localghost »

neo007 wrote:[…] It's exactly what I wanted. […]
Then please mark the topic (and not the last post) accordingly as clearly written in Section 3 of the Board Rules (to be read before posting).


Best regards and welcome to the board
Thorsten
Post Reply