Text FormattingList of Acronyms with alphabetical Ordering

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
hbaromega
Posts: 48
Joined: Mon Mar 07, 2011 8:21 pm

List of Acronyms with alphabetical Ordering

Post by hbaromega »

I want to make a list of acronyms for my thesis. I see an acronym package installed in my system.

I want to make a list of acronyms that will automatically take care of alphabetical ordering as we see in a dictionary.

Say, if I define:

TF: Text Formatting

and then
LC : Latex Community

we should see LC to appear first and then TF.

How can I do this? Also if some elegance can be made in display, it would be appreciated.

Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

List of Acronyms with alphabetical Ordering

Post by nlct »

As far as I know, the acronym package doesn't sort the acronyms alphabetically. You can use the glossaries package for a sorted list of acronyms. In addition to the documentation, there's an article in the Know How section on how to use it.

Regards
Nicola Talbot
hbaromega
Posts: 48
Joined: Mon Mar 07, 2011 8:21 pm

List of Acronyms with alphabetical Ordering

Post by hbaromega »

Thank you, Ma'am.

But it seems that I have to label each time and I need to refer them to make it appear in my final document.

Can I make just a list of acronyms without labelling and referring?

Suppose I want to have the following structure.

Code: Select all

\documentclass{article}

\usepackage{glossaries}

\begin{document}
\begin{itemize}
\item {\bf LED:}  {Light emitting diode}
\item {\bf FET:}  {Field effect transistor}
\end{itemize}

\end{document}

How can I use glossary to sort the items alphabetically? And I also don't want to type \bf every time if possible.


Thanks once again.
Last edited by cgnieder on Fri Oct 05, 2012 12:33 am, edited 2 times in total.
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

List of Acronyms with alphabetical Ordering

Post by nlct »

But it seems that I have to label each time and I need to refer them to make it appear in my final document.

Can I make just a list of acronyms without labelling and referring?
You can just use \glsaddall to add all entries.
How can I use glossary to sort the items alphabetically? And I also don't want to type \bf every time if possible.
Don't use \bf it's obsolete. Use \bfseries (or \textbf) instead.

However, if you don't plan to reference any of the acronyms, you might find this message of use. Adapting that example:

Code: Select all

\documentclass{article}

\usepackage{datatool}

\begin{filecontents*}{test.csv}
Acronym,Description
LED,Light emitting diode
FET,Field effect transistor
\end{filecontents*}

\DTLloaddb{acronyms}{test.csv}

\DTLsort{Acronym}{acronyms}

\begin{document}

\section*{List of Acronyms}

\begin{itemize}
\DTLforeach*{acronyms}{\thisAcronym=Acronym,\thisDesc=Description}%
  {\item \textbf{\thisAcronym} \thisDesc}%
\end{itemize}
\end{document}
Regards
Nicola Talbot
Last edited by cgnieder on Fri Oct 05, 2012 12:34 am, edited 1 time in total.
hbaromega
Posts: 48
Joined: Mon Mar 07, 2011 8:21 pm

List of Acronyms with alphabetical Ordering

Post by hbaromega »

Thanks. What does this test.csv file do?

Can I use this inside \begin{document} and \end{document}?

I mean, can I put the list inside the main .tex document, not in the preamble (like the way we do for bibliography) ?

Thanks.
Last edited by cgnieder on Fri Oct 05, 2012 12:35 am, edited 1 time in total.
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

List of Acronyms with alphabetical Ordering

Post by nlct »

Thanks. What does this test.csv file do?
The csv file contains the acronyms. The lines:

Code: Select all

\begin{filecontents*}{test.csv}
Acronym,Description
LED,Light emitting diode
FET,Field effect transistor
\end{filecontents*}
create a file called test.csv that contains the contents of the filecontents* environment. This file is then loaded into a database called "acronyms" using:

Code: Select all

\DTLloaddb{acronyms}{test.csv}
This command may occur in the document environment if you like, but you can only reference the database after it's been loaded. Once the database is loaded, it can be sorted according to the key "Acronym" (the first column of test.csv) using:

Code: Select all

\DTLsort{Acronym}{acronyms}
You can dispense with an external csv file if you like:

Code: Select all

\documentclass{article}

\usepackage{datatool}

% Define a convenient command to add a line
% to the database
\newcommand*{\addacronym}[2]{%
  \DTLnewrow{acronyms}%
  \DTLnewdbentry{acronyms}{Acronym}{#1}%
  \DTLnewdbentry{acronyms}{Description}{#2}%
}

\begin{document}

% Create the database
\DTLnewdb{acronyms}
\addacronym{LED}{Light emitting diode}
\addacronym{FET}{Field effect transistor}

\section*{List of Acronyms}

% Sort the database
\DTLsort{Acronym}{acronyms}

% Display the contents of the database
\begin{itemize}
\DTLforeach*{acronyms}{\thisAcronym=Acronym,\thisDesc=Description}%
  {\item \textbf{\thisAcronym} \thisDesc}%
\end{itemize}
\end{document}
Regards
Nicola Talbot
Post Reply