Helen's Useful Latex Command


This command is for abbreviations. Each time you call the command it checks whether you have called that abbreviation before or not. If you have not it writes out the full form of the word with the abbreviation in brackets. After that each time you call the abbreviation it only writes the abbreviation. This means you don't have to sift through your whole thesis checking whether you have already defined an abbreviation or not!

I suggest you save it as a file - e.g. abbrev.tex and call it whenever you want to redefine your abbreviations - e.g. you might want to redefine them at the beginning of every chapter. To call a file you use (assuming it is in the same directory):
\input{./filename.tex}

Each time you call the file all the abbreviation counters are set to zero.

It uses the packages ifthen and xspace. xspace is used to make sure a space is put at the end of the abbreviation when it should be.

n.b. If you need to use an abbreviation inside a caption then you need to proceed the command with \protect, e.g. \protect\ABBREVA .

\usepackage{ifthen}
\usepackage{xspace}

\def\abbrev#1#2#3#4{\newcommand{#1}{\stepcounter{#2}%
\ifthenelse{\equal{#3}{1}}{{#4 (#2)}\xspace}
{{#2}\xspace}}}

\newcounter{ABBREVA}
\abbrev{\ABBREVA}{ABBREVA}{\theABBREVA}{full form of the abbreviation a}

\newcounter{ABBREVB}
\abbrev{\ABBREVB}{ABBREVB}{\theABBREVB}{full form of the abbreviation b}


Back to the Astrophysics Main Page.
Back to the Astrophysics Group Members' Page.
Published by: