Sunday, August 12, 2012

LaTeX: ! Undefined control sequence

This short entry is to address a common annoyance which I've found difficult to tackle and to which I haven't found a straight answer online.

When using BibTeX reference copy/pasted from the ADS it will often have special "control sequences" for journal names.

The error comes when trying to compile and the error is similar to this:

! Undefined control sequence.
l.10 \newblock {\em \aap
where in your case \aap might be changed by the offending citation's journal.

This can be fixed by creating the definition or simply by removing the control sequence (\aap), but the whole point of LaTeX is the use of templates to standardise publications without having the author worry much about it. In this particular case I also wanted something as general and standard as possible... there might be a better answer to what I found, but for the time being this seems to fulfil those requirements good enough.

I could not find this article until after the fact, but this summarizes the solution: Journal Abbreviations used in the ADS BibTeX entries. And what it says there is you should install the AASTeX package, but in case you don't want to do that the simplest solution is to save the aas_macros.sty file to your project folder and include them in your main .tex file with the line:
\usepackage{aas_macros}
To do the proper thing and install the AASTeX package, you can follow the wikibooks guide on Installing Extra Packages or consulting the README file in the package distribution, I don't go into the details of package installation as it depends greatly on the software you use to write and compile LaTeX.

8 comments:

  1. Dude, you're a life-saver. Thank you very much.

    ReplyDelete
  2. Hours wasted before I found this article, thankyou!

    ReplyDelete
  3. Thank you !! Thesis submission in two days and this saved me.

    ReplyDelete
  4. Thanks you very much !!!

    ReplyDelete
  5. Thanks dude! You really helped!

    ReplyDelete
  6. Year 2017 and still couldn't go without this fix! Thank you!

    ReplyDelete
  7. Thankyou! I was stuck for ages!!

    ReplyDelete
  8. Holey Moley this is a life saver. The undefined aap was driving me crazy and its almost 2020

    ReplyDelete