TransWikia.com

Aligning linebreaks in long `item{}` inside description environment

TeX - LaTeX Asked by Dilawar on June 25, 2021

Here is MWE.

documentclass[a4paper,10pt]{article}
begin{document}

begin{description}
    item{Foo Bar  Baz }
        : Foo, Bar and Baz are friends.
    item a, b, c
end{description}

end{document}

It produces this:

enter image description here

Linebreaks are working fine but Foo, Bar and Baz are not aligning to the left. Is there a way to fix this? I rather redefine the description environment rather than change the text inside item{} everywhere in my current doc which has many descriptions.

One Answer

Two observations. First, in LaTeX's description environment, the argument of item should be encased in square brackets, not curly braces. Second, to place several items in the argument of item [pun intended] in a vertical stack, you could use a tabular environment. The following example code provides short-hand macro called mystack that simplifies the creation of a stack of items.

enter image description here

documentclass{article}
newcommandmystack[1]{begin{tabular}[t]{@{}l@{}} #1 end{tabular}}
begin{document}
begin{description}
    item[mystack{Foo  Bar  Baz}]: Foo, Bar, and Baz are friends.
    item[a, b, c] dots
end{description}
end{document}

Answered by Mico on June 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP