TransWikia.com

Make simple multiline Glossary

TeX - LaTeX Asked by user2741831 on April 1, 2021

I would like to make a simple glossary that looks sort of like this:

enter image description here

That allows me to make tabs that stay tabs even if the break a line. so that it looks like an invisible table, yet still does regular line breaks.

What would be the easiest way to do this?

2 Answers

The description environment is made for that. The lengths used in the environment, such as the label's width, can be changed easily using the enumitem package (see the documentation for details).

documentclass{article}
usepackage{enumitem}
setlist[description]{
    labelwidth=22mm, 
    labelsep=0mm, 
    leftmargin=22mm
}
begin{document}
section*{Glossary}
begin{description}
    item[Dog] An animal that makes dog noises. Some more text to see if the line will break as it should. 
    item[Cat] An animal that makes cat noises
    item[Mouse] An animal that makes neither dog nor cat noises
    item[Key] Not even an animal
end{description}
end{document}

Correct answer by Vincent on April 1, 2021

enter image description here

documentclass[a4paper, 12pt]{report}

usepackage{tabto,enumitem}
usepackage{lipsum}

newcommand*{mytab}[1]{tabto{4.5cm}parbox[t]{%
        dimexprtextwidth-4.5cm-labelwidth-labelsep}{#1}}
begin{document}
    Glossary
    begin{itemize}
        item[] Dog mytab{An texttt{animal} that makes dog noises and irritates me no end }
        item[] Cat mytab{An texttt{animal} that makes cat noises }

    end{itemize}
    
    
end{document}

Answered by js bibra on April 1, 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