Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: automatic list of acronyms.

330 views
Skip to first unread message

David Walthall

unread,
May 18, 2004, 1:26:40 AM5/18/04
to
On Mon, 17 May 2004 16:19:00 +0000 (UTC), Tevfik Yucek
<yu...@nospam.eng.usf.edu> wrote:

>Hi all,
>
>In my documents, i have to use lots of acronyms. For this I use
>"acronym" package. However, using this package I could not be able
>to obtain automatic list of acronyms. Here is what I want to do:
>1. Have a file which holds my acronyms (all of them, like bibtex
>file).
>2. Refer to these acronyms in my file (using \ac{ABC} for example).
>latex should automatically expand the first occurence of ABC and
>type something like "axxx bxxxx cxxx (ABC) ". In the next occurence
>it should only type "ABC ".
>
>I can do the above items using acronym package.
>
>3. I want to produce a list of acronyms which will include _only_
>the acronyms used in the current document.
>
>I want to automate this process because I write lots of documents
>and sometimes these documents becomes very large. I also dont want
>to have separate abbreviation file for each document.
>
>Any suggestions are greatly appreciated.
>
>Tevfik.

Hi Tevfik,

As you mentioned, 1 and 2 are done nicely by the `acronym' package.
It also does #3 if you load the package with the line:

\usepackage[printonlyused]{acronym}

That lists, in the resulting output, only the acronyms used.

If you want to generate some other kind of file with the list of
acronyms used, that's a different issue entirely. I can imagine
either changing how acronym produces the output, or some combination
of sed, grep, sort and other utilities.

David

Jerzy Jalocha

unread,
May 18, 2004, 1:47:24 PM5/18/04
to
Tevfik Yucek <yu...@nospam.eng.usf.edu> wrote:
> Here is what I want to do:
> 1. Have a file which holds my acronyms (all of them, like bibtex
> file).
> 3. I want to produce a list of acronyms which will include _only_
> the acronyms used in the current document.

Using the acronym package with the printonlyused option,
maybe you could create a separate file just containing
one large acronym environment and \input this file from
your latex document?

I hope this helps.

Jerzy

Tevfik Yucek

unread,
May 19, 2004, 11:30:53 AM5/19/04
to

Thanks David.

This option is nice, but I still have a problem. The "acronym"
environment works only if I use it at the end of my tex file.
However, I want my list to be shown in the beginning of the
document. Isnt this the intuitive way of doing this? If I use the
acronym environment in the beginning I got the following error.

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.18 \end{acronym}

I believe that latex writes the acronyms to .aux file and this
environment prints them if they are used..

Thanks for the help.

Tevfik

>
> If you want to generate some other kind of file with the list of
> acronyms used, that's a different issue entirely. I can imagine
> either changing how acronym produces the output, or some combination
> of sed, grep, sort and other utilities.
>
> David


--
Tevfik Yucek <yucek at eng dot usf dot edu>
Are you happy now?

David Walthall

unread,
May 19, 2004, 8:42:08 PM5/19/04
to
On Wed, 19 May 2004 15:30:53 +0000 (UTC), Tevfik Yucek
<yu...@nospam.eng.usf.edu> wrote:

>On 2004-05-18, David Walthall <david.nosp...@stanford.edu> wrote:
>> As you mentioned, 1 and 2 are done nicely by the `acronym' package.
>> It also does #3 if you load the package with the line:
>>
>> \usepackage[printonlyused]{acronym}
>>
>> That lists, in the resulting output, only the acronyms used.
>
>Thanks David.
>
>This option is nice, but I still have a problem. The "acronym"
>environment works only if I use it at the end of my tex file.
>However, I want my list to be shown in the beginning of the
>document. Isnt this the intuitive way of doing this? If I use the
>acronym environment in the beginning I got the following error.
>
> ! LaTeX Error: Something's wrong--perhaps a missing \item.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type H <return> for immediate help.
> ...
>
> l.18 \end{acronym}
>
>I believe that latex writes the acronyms to .aux file and this
>environment prints them if they are used..
>
>Thanks for the help.

Tevfik,

From what I remember about the acronmym package, when it encounters
the a new acronym it writes it to the aux file so that it will be
available for the next run. However, it keeps an internal list so
that it can print them. The error that you get is an error that
indicates that there was no \item between the \begin{itemize} and
\end{itemize}. Because of the way that acronym keeps track of which
ones are used (internally rather than in the aux file), there is no
way for it to know which ones have been used until the end. You
should talk to the author of acronym, as that person might be able to
make a new version that allows the acronyms to be placed at the
beginning.

Incidentally, if you include a single \ac{...} before the acronym
section, it will print just that one as the list of acronyms. All
other acronyms used in the doc will not be listed there.

For what it is worth, I consider it more intuitive to have them at the
end. That way, people that know the acronyms don't need to see them.
A list of acronyms is similar to a glossary, which is almost always
found in the back, for the same reasons. (Well, I think they are the
same reasons, although I could be wrong.) My view may be a little
skewed having worked on a thesis where the acronyms go in an appendix.

David

Danie Els

unread,
May 20, 2004, 7:13:43 AM5/20/04
to
Tevfik Yucek <yu...@nospam.eng.usf.edu> wrote in message news:<slrncamvm3...@yucek.eng.usf.edu>...

> This option is nice, but I still have a problem. The "acronym"
> environment works only if I use it at the end of my tex file.
> However, I want my list to be shown in the beginning of the
> document. Isnt this the intuitive way of doing this? If I use the
> acronym environment in the beginning I got the following error.
>
> ! LaTeX Error: Something's wrong--perhaps a missing \item.
>

This is because of an empty list environment. It needs at least one
\item[]. You can add this to the end source environment to prevent the
error message and the additional space cause by it would not be (to)
vissible.

>
> I believe that latex writes the acronyms to .aux file and this
> environment prints them if they are used..
>

Yes it writes the definitions out to the aux file, but it only define
internal flags to mark the usage of an acronym. If you want to put the
acronym environment at the begining of the document you also need to
write the acronym usage out to the aux file.

Please look at the following defs. Note that they are fragile and do
not survive transport, e.g.: \section {Standard \acs{ANSI} C} will
bark and must be protected. Maybe robust commands is a beter option? I
will pass this proposals on to Tobias Oetiker, and if he thinks that
it is worthwhile, he can include it or use part of it.

Danie Els : dnjels at sun dot ac dot za

%-----------------------------------
\usepackage[printonlyused]{acronym}

\newcommand*{\acronymlogged}[1]{% <--- New:
\@bsphack
\protected@write\@auxout{}%
{\string\acronymused{#1}}%
\@esphack}

\newcommand*{\acronymused}[1]{% <--- New:
\expandafter\ifx\csname acused@#1\endcsname\used
\relax%
\else
\global\expandafter\let\csname acused@#1\endcsname\used%
\fi}

\renewcommand*{\acs}[1]{%
\AC@check{#1}%
\acsfont{%
\expandafter\expandafter\expandafter\AC@getsecond
\csname fn@#1\endcsname{#1}\@nil
}%
\acronymlogged{#1}}%<------- Change:

\renewcommand*{\acl}[1]{%
\AC@check{#1}%
\expandafter\expandafter\expandafter\@car
\csname fn@#1\endcsname\@nil
\acronymlogged{#1}}%<------- Change:

\renewcommand*{\acf}[1]{%
\acffont{\acl{#1}}\nolinebreak[3] %
\acfsfont{(\acs{#1})}% <-------- Fix: font setup
\expandafter\ifx\csname ac@#1\endcsname\used
\relax%
\else
\global\expandafter\let\csname ac@#1\endcsname\used%
\AddToClearList{#1}%
\fi
\acronymlogged{#1}}%<------- Change: (duplicate ???)

\renewcommand{\acp}[1]{%
\expandafter\ifx\csname ac@#1\endcsname\used
\acsp{#1}%
\else
\acfp{#1}%
\global\expandafter\let\csname ac@#1\endcsname\used%
\AddToClearList{#1}%
\fi
\acronymlogged{#1}}%<------- Change:

0 new messages