title: LaTeX - Using hyperref & \ref - Special characters in reference name?
body: <p>I'm making a LaTeX PDF document and using the hyperref package and <code>\ref</code> to make references to section &amp; subsections later in the document. Some of my (sub)section references have an underscore (<code>_</code>) in them, so I have escaped them (i.e. put in <code>\_</code>), however when I run pdflatex on it I get the following error:</p>
  
  <pre><code>! Missing \endcsname inserted.
  &lt;to be read again&gt; 
                     \relax 
  l.169 \ref{ some stuff \(60 sec\)\_aaa } }
                                             &amp;  01:00  &amp; . &amp; . \\
  </code></pre>
  
  <p>If I take away the <code>\</code> I get the same error. I have to take away the underscore <code>_</code> to make the problem go away. From this I deduce that you can't have underscores in a <code>\ref</code> in LaTeX. Is there some way to allow me to have underscores? Is there any list of what you can and cannot have in a ref?</p>
  
  <p><strong>UPDATE</strong>: Turned out it was a bug in my code.</p>