0

I have downloaded various bibtex references from NASA ADS (the astrophysics article finding tool). They all refer to journal names with a backslash as if its a code. For example for an article from the Monthly Notices of the Royal Astronomical Society it says this:

journal = {\mnras},

Unfortunately, LaTeX appears to be unable to handle this form of journal name. But since all the downloaded citations are the same, I'm assuming there must be a way for LaTeX to read this. If so, how can i do this?

PS. I am currently using the .bst file found in the following link to read in the references which I assume is where the issue lies: ftp://ftp.edpsciences.org/pub/aa/bibtex/aa.bst

3

Welcome to TeX.SE!

BibTeX basically works by reading the .bib and handled using the .bst-file. Bib(La)TeX then creates a LaTeX file (with a .bbl extention) based on the .bst files instructions, commonly consisting of a thebibliography environment with a lot of \bibitems. The .bst-file for example tells BibTeX that the journal entry should be included in the thebibliography environment.

If then there is this undefined control sequence \mnras in the journal entry, then LaTeX is going to complain when the .bbl file is included.

As the NASA ADS FAQ says:

Please note that our BibTeX entries make use of the AASTeX macro definitions for the most popular astronomical journal. If you're not using the AASTeX package then you will need to include these macros in your LaTeX source.

In short all you have to do is download the contents this file, save it as aas_macros.sty and then write \usepackage{aas_macros} in your preamble.


In the "general" case of fixing this for empirical errors I suspect the easiest course of action would be, as @mico suggests in the comments, to just define the undefined control sequence to what you want it to show e.g. \providecommand\mnras{Monthly Notices of the Royal Astronomical Society}. (\providecommand is like a \newcommand but just doesn't do anything if the command already exists).

if you want the actual backslash to show, as the question title suggests, then you'd escape said backslashes using e.g. \textbackslash; for example replace \mnras with \textbackslash mnras. In this case it would show literally "\mnras" in your references text.

If you want to redefine how backslash behaves in bibtex, you're in for quite an adventure, and you'd might want to dedicate a day or two to do so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.