Text FormattingIndentation of a descriptive List

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Serpenthelm
Posts: 7
Joined: Mon Jun 04, 2012 3:50 pm

Indentation of a descriptive List

Post by Serpenthelm »

Hi, I'm trying to change the indentation of all the description lists in my document. Right now I'm using this code.

Code: Select all

\subsubsection{qazwsx}
  \paragraph{zxcv}
    \begin{description}
      \item[qwer] \hfill \\ asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd
      \item[qwer] \hfill \\ asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd
    \end{description}
And getting this
description-bad.png
description-bad.png (8.32 KiB) Viewed 7029 times
But I want this
description-good.png
description-good.png (8.34 KiB) Viewed 7029 times
Also, I'd like not to need the \hfill \\, I've looked at some tutorials, and tried to \renewenvironment{description} but I cannot quite figure out the parameters to set.

Anybody so kind to provide a quick fix?
Last edited by localghost on Mon Jun 04, 2012 6:31 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.

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

Indentation of a descriptive List

Post by localghost »

Such a customized list is a job for the enumitem package.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{enumitem}

\begin{document}
  \section{Foo}
    \subsection{Bar}
      \subsection{Foobar}
        \paragraph{Fubar}
          \begin{description}[font=\bfseries,fullwidth,style=nextline]   % local list customization
            \item[First Item] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
            \item[Second Item] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
          \end{description}
\end{document}
If you want to have all descriptive lists with this formatting, you can do this with a global setting in the preamble.

Code: Select all

\setdescription{font=\bfseries,fullwidth,style=nextline}
Then you have to drop the optional argument as local customization for the {description} environment.


Best regards and welcome to the board
Thorsten
Serpenthelm
Posts: 7
Joined: Mon Jun 04, 2012 3:50 pm

Indentation of a descriptive List

Post by Serpenthelm »

Thanks, it worked, but they are still not completely aligned.

I have a similar problem on subparagraphs

Code: Select all

\subparagraph{Subpar title} \hfill \\
          Subpar text
Here's a pic
Attachments
Alignment.png
Alignment.png (14.7 KiB) Viewed 7024 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Indentation of a descriptive List

Post by localghost »

Serpenthelm wrote:Thanks, it worked, but they are still not completely aligned. […]
No problem here (see attachment). Perhaps an outdated version of enumitem? Add the \listfiles command as very first line to the code example and take a look at the list of used files in the log file (*.log).
Serpenthelm wrote:[…] I have a similar problem on subparagraphs

Code: Select all

\subparagraph{Subpar title} \hfill \\
          Subpar text
[…]
That's not the way to go. If you want to reformat headings, use titlesec.
Attachments
The obtained output.
The obtained output.
tmp.png (20.25 KiB) Viewed 7022 times
Serpenthelm
Posts: 7
Joined: Mon Jun 04, 2012 3:50 pm

Indentation of a descriptive List

Post by Serpenthelm »

I'm using TeX Live and I just updated it. Here's the relevant part of the log file.

Code: Select all

*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size11.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
fontenc.sty
t1enc.def 2005/09/27 v1.99g Standard LaTeX file
enumitem.sty 2011/09/28 v3.5.2 Customized lists
***********
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Indentation of a descriptive List

Post by localghost »

The output I presented in my former reply was obtained by an older version of enumitem (2.2). I was able to reproduce your output with the current package version (3.5.2). So I suggest to contact the package maintainer and ask him for help. Fell free to report back after he answered.
Serpenthelm
Posts: 7
Joined: Mon Jun 04, 2012 3:50 pm

Re: Indentation of a descriptive List

Post by Serpenthelm »

Well, I just sent a mail through his site, I hope he replies.

Anyway, could you give me a hand on the subpar thing? I cannot figure out how to properly use that package.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Indentation of a descriptive List

Post by localghost »

Serpenthelm wrote:[…] Anyway, could you give me a hand on the subpar thing? I cannot figure out how to properly use that package.
The titlesec manual is full of examples. Just take a close look. Upcoming problems are presented best in form of a minimal example.
Serpenthelm
Posts: 7
Joined: Mon Jun 04, 2012 3:50 pm

Indentation of a descriptive List

Post by Serpenthelm »

localghost wrote:Such a customized list is a job for the enumitem package.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{enumitem}

\begin{document}
  \section{Foo}
    \subsection{Bar}
      \subsection{Foobar}
        \paragraph{Fubar}
          \begin{description}[font=\bfseries,fullwidth,style=nextline]   % local list customization
            \item[First Item] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
            \item[Second Item] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
          \end{description}
\end{document}
Adding leftmargin=* or leftmargin=0pt to the options solved my problem.
2 years later...
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Indentation of a descriptive List

Post by Johannes_B »

Wow, you are having a lot of patience. Thanks for sharing the solution with us.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply