aleix's blog

Easy acronyms generation

22 February 2007 5:01 pm (latex | python)

At work, we needed a way to easily generate a list of acronyms of our documents, so I wrote an script (tex-acronyms.py) that parses the acronyms in a specified LaTeX file and tries to find a description (specified as a nomencl definition) in the files (*.tex) located in a directory. The script will create two files: one with acronyms and their descriptions and the other with conflicts, that is, acronyms with no or duplicate description.

The following example is a sample of an acronyms list file. Note that the LaTeX document must use the nomencl package, since the acronyms are defined using the nomencl syntax.

\\nomenclature{ADDR}{Address}
\\nomenclature{ANSI}{American National Standards Institute}
\\nomenclature{API}{Application Programming Interface}
...

It is also possible to provide a list of words to be excluded in the exclude_acronyms.txt file, that must be located in the data directory by default (a different file can be specified using -x). For example:

CHAPTERS
CLOSED
DUPLICATE
FIRST
FIXED
BOTH
BUS
...

It is easy to find words to be excluded because they will be treated as errors (and written to the errors file) as no definition is available for them.

Finally, it is possible to parse the input files recursively passing the -r argument. This will parse all the files included with \input.

A possible program call could be:

tex-acronyms.py -r -d ~/acronyms -i article.tex -o acronyms.tex \
                -e acronyms.errors

where the acronyms found in the article.tex file (and its dependencies) will be matched against the acronyms found in ~/acronyms/*.tex. The matched acronyms will be written to acronyms.tex and the errors in acronyms.errors. Now, you just need to include acronyms.tex in your document.

Update 2010/10/22: Check script updates in the new article More on easy acronyms generation.

Update 2007/02/23: GlossTeX does the same (and much more) but à la TeX way.

9 responses

  1. Jim Hefferon says:

    Have you considered uploading it to CTAN?

  2. vincenzo says:

    This is ok for old documents,
    for the new ones, I suggest to use the acronym latex
    package while writing.

  3. Ed says:

    This also can be good for any of for using.homepage

  4. Coursework Homework Help says:

    Amazing article thanks or sharing..

  5. Project on Engineering says:

    This is great information for students. This article is very helpful i really like this blog thanks. I also have some information relevant for online dissertation help.

  6. Buy Harvard Business Case Studies Solutions says:

    Get the dissertation writing service students look for these days with the prime focus being creating a well researched and lively content on any topic.

  7. pożyczki przez internet says:

    You have really shared a informative and interesting blog post with people..

  8. john443s says:

    Do you have any answer for this?

  9. Custom Paper Writing Company | Toppaperservice says:

    it as of now influences people groups capacity to convey disconnected. im not going to sound misleading however, I utilize all that stuff as well, and what I say to my companions and what they say to me truly has neither rhyme nor reason once in a while, yet we comprehend what we mean.

Leave a Reply