Trying out some LaTeX commands, I wanted to build an Abbreviations list that would write acronyms to a file when defined and if already defined do nothing. It works fine so far, adding \abvr{OpenCL}{Open Computing Language} adds an entry to my list. Though if I type it up two times in my report there will be two entries.
Does there exists any method of checking if a key is already in the .aux file @loa or make the itemize only showing duplicate items once?
\documentclass[10pt,conference]{IEEEtran}
\usepackage[utf8x]{inputenc}
\DeclareFontFamily{OT1}{pzc}{}
\DeclareFontShape{OT1}{pzc}{m}{it}{<-> s * [1.10] pzcmi7t}{}
\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}
\usepackage{cite} %However, IEEEtran pre-defines some format control macros to facilitate easy use with Donald Arseneau’s cite.sty package [13]. So, all an author has to do is to call cite.sty:
\setlength{\parskip}{1.5mm}
\def\tm{\leavevmode\hbox{$\rm {}^{TM}$}}
\def\registered{{\ooalign{\hfil\raise .00ex\hbox{\scriptsize R}\hfil\crcr\mathhexbox20D}}} % $^\registered$
\def\trademark{$\rm {}^{\hbox{\tiny TM}}$} % then accessible in math mode
\newcommand{\vect}[1]{\boldsymbol{#1}} %If bold vectors.
%\newcommand{\vect}[1]{\vec{#1}} %If arrow over vectors.
\title{Parallel Programming for Image Processing Algorithms}
\author{Poul~K.~Sørensen
\thanks{Thanks note.}
}
%\setlength{\columnsep}{distance}
\newif\ifabvrused
\abvrusedfalse
\makeatletter
\def\abvr#1#2{%
{#2 (\textbf{#1})}%
%\def\ArgI{{#1}}%
%\@ifundefined{r@\ArgI}{{#2 (\textbf{#1})\label{\ArgI}}}{#1}%
\ifabvrused%
\else%
\newwrite\@loa%
\immediate\openout\@loa=\jobname.loa%
\abvrusedtrue%
\fi%
\immediate\write\@loa{\unexpanded{\item[#1]#2}}%
}
\newcommand\@startloa{%
\immediate\closeout\@loa
\section*{Abbreviations}
\begin{listofabbrv}{SPMD}
\InputIfFileExists{\jobname.loa}{}{\item[\null]}
\end{listofabbrv}
}
\newcommand{\listofabbreviations}{\@startloa}
\newenvironment{listofabbrv}[1]{\begin{itemize}}{\end{itemize}}
\makeatother
\newcommand{\ie}{i.e.~\/}
\newcommand{\eg}{e.g.~\/}
\newcommand{\degree}{$^{\circ }$}
\usepackage{acronym}
\begin{document}
\maketitle
\begin{abstract}
\boldmath Learning \abvr{OpenCL}{Open C Laaaa} for Image Analysis.\abvr{OpenCL}{Open C Laaaa}
\end{abstract}
\listofabbreviations
\end{document}
