Archive for the ‘LaTeX’ Category

More on easy acronyms generation

October 22, 2010

About four years ago I posted an article about easy acronyms generation in LaTeX. Yesterday, I did some updates to the script (tex-acronyms.py) that I wanted to share with you (if anyone is reading…). Basically, the updates are:

  • A user defined acronyms file can be specified via the -u argument. User defined acronyms take precedence over global acronyms definition.
  • Global excluded acronyms file has been removed. Now, the user must define acronyms to be excluded in the user defined acronyms file as an empty acronym. For example:

    \nomenclature{GHH}{}
    

    Then, the definition of GHH will not be included in the list of acronyms.

  • To facilitate the read of acronyms conflicts, it is now specified if the conflict is because of a “Duplicated“, “Undefined” or “Excluded” acronym.

So, the script is called as before but a new optional argument -u can be specified for the user defined acronyms file:

tex-acronyms.py [-r] -d /path/to/acronyms \
                -i article.tex \
                [-u user_acronyms.tex] \
                -o acronyms.tex \
                -e acronyms.errors

Easy acronyms generation

February 22, 2007

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.


Follow

Get every new post delivered to your Inbox.