Text FormattingNew line in a Nomenclature label

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
xerion
Posts: 7
Joined: Wed Oct 20, 2010 8:29 am

New line in a Nomenclature label

Post by xerion »

Hello,
I am using the nomencl package to create a Glossary for my document. Most of my glossary is fine, however for one entry which is two word the layout is not optimal. I should not that the layout is also in 2 columns.

For example:
\nomenclature{GPU}{Graphics processing unit}
\nomenclature{CPU}{Central processing unit}
\nomenclature{Bigger Label}{A description that is kind of long as it take 4 lines in a 2 column layout}

This will create something like this

Code: Select all

GPU     Graphics processing unit.

CPU     Central processing unit.

Bigger Label A description that is kind
        of long as it take 4 lines in a  
        2 column layout.
A solution of course is to change the gap between the label and the description however then it become really ugly. So i was thinking that it would be nice if i can somehow add a newline there and make it look like this:

Code: Select all

GPU     Graphics processing unit.

CPU     Central processing unit.

Bigger  A description  that is  kind  of
Label   long as it  take 4 lines in a  2
        column layout.
Is this something possible ? It seems from the created .nls file that it just used a \item [{label}] so i guess there should be a way to have a newline in a label right ? I am open to any other ideas if you have any ?
Last edited by xerion on Mon Feb 21, 2011 11:57 am, 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.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

west.logan
Posts: 87
Joined: Tue Sep 14, 2010 6:58 pm

Re: New line in a Nomenclature label

Post by west.logan »

I'm not familiar with the Nomenclature package, but perhaps you may want to try something else? Using a description environment, a table without rules, or perhaps the Gloss package might work.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

New line in a Nomenclature label

Post by localghost »

xerion wrote:[…] Most of my glossary is fine, however for one entry which is two word the layout is not optimal. […]
You could try to put »Bigger Label« into a \parbox of a certain width and force a line break. Due to an absent minimal example that's all I can advise.


Thorsten
west.logan
Posts: 87
Joined: Tue Sep 14, 2010 6:58 pm

New line in a Nomenclature label

Post by west.logan »

I just stumbled upon the "GloTeX" package, and if the examples in there are any indication, it will do what you want (check out page 9 of the manual).

http://texcatalogue.sarovar.org/entries/glotex.html
xerion
Posts: 7
Joined: Wed Oct 20, 2010 8:29 am

New line in a Nomenclature label

Post by xerion »

localghost wrote:
xerion wrote:[…] Most of my glossary is fine, however for one entry which is two word the layout is not optimal. […]
You could try to put »Bigger Label« into a \parbox of a certain width and force a line break. Due to an absent minimal example that's all I can advise.


Thorsten
Hello,
I am providing a minimal working example with the suggestion that you proposed. Its all right but then i get a blank line next to it. The sorting of the list is not proper either but i can sort that out easy with a prefix.

If anyone has any idea let me know.

Code: Select all

\documentclass{article}

\usepackage{multicol} % for pages with multiple text columns, e.g. References

\usepackage[intoc]{nomencl} % load nomencl extension; include in TOC
\renewcommand{\nomentryend}{.} % add a . after the entry
\renewcommand{\nomname}{Glossary} % rename nomenclature
\renewcommand{\nomlabel}[1]{\textbf{#1}} % make abbreviations bold
\makenomenclature % used to be \makeglossary

\begin{document}

\nomenclature{AA}{Some Label}
\nomenclature{BB}{Some other Label}
\nomenclature{CPU}{Central Processing Unit}
\nomenclature{GUI}{Graphical User Interface}
\nomenclature{OpenGL}{Open Graphics Library}
\nomenclature{OpenCL}{Open Computing Language}
\nomenclature{LaTeX}{A document preparation system}

\nomenclature{Bigger Label}{This is where the problem occurs and I would really appreciate your help}
\nomenclature{\parbox[t]{1.2cm}{Bigger Label}}{This is where the problem occurs and I would really appreciate your help}


\begin{multicols}{2} % \begin{multicols}{#columns}[header text][space]
\begin{footnotesize} % scriptsize(7) < footnotesize(8) < small (9) < normal (10)

\printnomenclature[1.5cm] % [] = distance between entry and description

\end{footnotesize}
\end{multicols}

\end{document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

New line in a Nomenclature label

Post by localghost »

In general you have to hide the height of the that box to avoid this blank line you described. The only measure that works for me without messing up the sort order is to put every entry into a box by redefining the labels.

Code: Select all

\renewcommand{\nomlabel}[1]{\smash{\parbox[t]{5em}{\bfseries\raggedright #1}}\hfil}
Adjust the width of the box to your needs.
xerion
Posts: 7
Joined: Wed Oct 20, 2010 8:29 am

Re: New line in a Nomenclature label

Post by xerion »

The order is not really an issue as you can use prefix to sort it out ! This will do though.

Thanks for your help I really appreciate it!
Post Reply