Text FormattingItemizing with description: why does it indent?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
james121515
Posts: 3
Joined: Sat Feb 20, 2010 3:12 am

Itemizing with description: why does it indent?

Post by james121515 »

Hi guys,

I am trying to itemize using the \begin{description} command in LaTeX when writing up solutions. How do you get it to where, when the text (in the compiled Pdf documument) wraps around to start a new line, it lines up with the beginning of the previous line? I start off my code with

\begin{description}

\item[\textbf{1.}] one two three four five six seven eight nine ten \\
eleven thirteen fourteen

\end{description}

In the compiled Pdf file, the second line is indented for some reason. So in the case above, below the first line,"eleven" is indented to right a bit and is not in align with the first line. What I would like in the example above is for "eleven" to begin right below "one", perfectly aligned. I notice that it does this properly when I use the "enumerate" command, but not with "description".Is this possible?

My preamble is:

\documentclass[10pt]{article}
\usepackage[hmargin=3cm,vmargin=2.5cm]{geometry}
\usepackage{amscd, amsmath,amssymb}
\setlength{\parindent}{0.0in}
\setlength{\parskip}{0.1in}

Thanks a lot for any help!

james

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Itemizing with description: why does it indent?

Post by localghost »

At first, get used to posting always full examples because such code snippets are completely useless [1]. Regarding your problem you obviously never heard of the enumerate environment.

[1] View topic: Avoidable mistakes


Best regards
Thorsten
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Itemizing with description: why does it indent?

Post by frabjous »

James says in the post that he knows about the enumerate "command". (I assume he means environment.) It just isn't clear why he's not using it.

Hanging indent is normal for description lists. If you want to change it, probably using some of the features of the enumitem package is best.

E.g.:

Code: Select all

\documentclass[10pt]{article}
\usepackage[hmargin=3cm,vmargin=2.5cm]{geometry}
\usepackage{amscd, amsmath,amssymb}
\setlength{\parindent}{0.0in}
\setlength{\parskip}{0.1in}

\usepackage{enumitem}
\setdescription{leftmargin=0pt}

\begin{document}

\begin{description}
\item[\textbf{1.}] one two three four five six seven eight nine ten \\
eleven thirteen fourteen
\end{description}

\end{document}
But if this is really an enumeration, you'd be better off using enumerate, as Thorsten hints.

Just a quick example:

Code: Select all

\documentclass[10pt]{article}
\usepackage[hmargin=3cm,vmargin=2.5cm]{geometry}
\usepackage{amscd, amsmath,amssymb}
\setlength{\parindent}{0.0in}
\setlength{\parskip}{0.1in}

\usepackage{enumitem}
\setenumerate{leftmargin=0pt,itemindent=1.5em,labelsep=1.5em,labelwidth=0pt,align=left,label={\textbf{\arabic*.}}}

\begin{document}

\begin{enumerate}
\item one two three four five six seven eight nine ten \\
eleven thirteen fourteen
\end{enumerate}

\end{document}
Read the enumitem documentation for more info.
james121515
Posts: 3
Joined: Sat Feb 20, 2010 3:12 am

Re: Itemizing with description: why does it indent?

Post by james121515 »

Thanks for your responses,

The reason I'm not using the enumerate command is because I don't necessarily need it to go in counting order since we are assigned random problems from our book. Sometimes the sequence might go "6, 10, 19". Additionally, I like to have the number in bold which enumerate does not do.

Thanks again,
James
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Itemizing with description: why does it indent?

Post by frabjous »

Understood about your first point, though you'll see with my enumerate example that it can use bold if you tell it to.
Post Reply