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.:


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

\item[Question?] Answer

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:

    \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.
    \item[Question 2?] Answer 2.

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


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.




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

\paragraph{How does the Lorem Ipsum text read?}


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

% Define question and answer environment

And then use it the same as description:

  \item[What is the day today?]
  \item[How much is it?]

Gives us something like this:

enter image description here

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.