Formatting FAQ lists in LaTeX

I want to format a list of "Question + Answer" pairs in a TeX-document.

In HTML I use the <dl> command: http://www.w3.org/TR/html401/struct/lists.html, e.g.:

<dl>
<dt>Question?</dt>
<dd>
</dd>
</dl>


In TeX I thought using the description environment would be good for those purposes.

\begin{description}
\end{description}


But when the question becomes very long, it does not break into a new line. When the question is short, the answer begins directly behind the question and not in a new line.

What environment should I use for this problem?

-

The deficiency you've noticed in the LaTeX description environment -- that if an item's "label" (the part in brackets) is longer than one line, it won't produce a proper line break -- is well known. The easiest workaround I'm aware of is to use the enumitem package and to start the description list with the option style=nextline, as in the following MWE:

\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{description}[style=nextline]
\item[Why is there a deficiency in the basic description environment
that I have to struggle with?] Answer: Just use the enumitem package
and start the description environment with the "style=nextline" option.
\end{description}
\end{document}


Note that if you do not want the "Answer" (i.e., the text after the item's "label") to start on a new line, all you need to change is to set the option style=sameline at the beginning the description environment.

Addendum: If you wish to have the "style=nextline" instruction apply to all description environments, it would be tedious to have to remember to specify this option every single time. Instead, you should issue the instruction

\setlist[description]{style=nextline}


after loading the enumitem package to set this option globally. The resulting behavior can be overridden if need be, on a case-by-case basis, by supplying the option [style=same-line] when a given description environment is initiated.

-

I would suggest just using the \paragraph or \subparagraph sectioning commands. Not only they produce the similar "FAQ" look, but they also allow to create a ToC with the questions.

If, in contract, you don't want the run-in titles, you can use \subsubsection in a similar way.

\documentclass{article}

\usepackage{lipsum}

\begin{document}

\paragraph{What is the answer to the Ultimate Question of Life, the Universe, and Everything?}
42

\paragraph{How does the Lorem Ipsum text read?}
\lipsum[1]

\end{document}


Note that you can also change the appearance of sectioning commands with the titlesec package.

-

I would suggest defining a new environment, and using that. Building on other answers:

% Use for advanced enum-list functionality
\usepackage{enumitem}

% Define question and answer environment
\newenvironment{faq}{\begin{description}[style=nextline]}{\end{description}}


And then use it the same as description:

\begin{faq}
\item[What is the day today?]
Monday
\item[How much is it?]
Alot!
\end{faq}


Gives us something like this:

-