title: Creating a list of symbols in latex
body: <p>I'm trying to get an auto generated list of symbols in my latex project. Here is the macro that I have so far...</p>
  
  <pre><code>\newcommand{\addsymbol}[3]{%
    \symboldisplay{#1}{#2}\\%
    \setelem{#3}{#1}
  }
  \newcommand{\symboldisplay}[2]{%
    $#1$ \parbox{5in}{\dotfill #2}%
  }
  
  \def\setelem#1{\expandafter\def\csname myarray(#1)\endcsname}
  \def\dispsymbol#1{\csname myarray(#1)\endcsname}
  </code></pre>
  
  <p>I then include my list of symbols like so</p>
  
  <pre><code>\begin{listofsymbols}
  \input{symbols}
  \end{listofsymbols}
  </code></pre>
  
  <p>where the symbols.tex file is</p>
  
  <pre><code>\addsymbol{n}{Number of sample points}{num_points}
  \addsymbol{f_s}{Sampling frequency}{samp_frequency}
  </code></pre>
  
  <p>I can then get my symbol by label like so: \dispsymbol{num_points} -- this displays n in this case.</p>
  
  <p>This works all find and dandy... when I am calling \dispsymbol in the same chapter (the List of Symbols chapter) as the \addsymbol def. When I try to get the label for the symbol in another chapter nothing seems to work.</p>
  
  <p>Could anyone help me, or suggest a package that will do what I am looking for?</p>