0

I'm trying to use a .bib file with a report. Here's a MWEB, with my references inserted into it (the four articles after the book):

\documentclass{article}

\usepackage{cite}

\begin{filecontents}{\jobname.bib}
@book{key,
  author = {Author, A.},
  year = {2001},
  title = {Title},
  publisher = {Publisher},
}

@ARTICLE{bland,
    author = {{Bland-Hawthorn}, J. and {Gerhard}, O.},
    title = "{The Galaxy in Context: Structural, Kinematic, and Integrated Properties}",
    journal = {\araa},
    archivePrefix = "arXiv",
    eprint = {1602.07702},
    year = 2016,
    month = sep,
    volume = 54,
    pages = {529-596},
    doi = {10.1146/annurev-astro-081915-023441},
    adsurl = {http://adsabs.harvard.edu/abs/2016ARA\%26A..54..529B},
    adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@article{glowacki,
    author = {{Glowacki}, M. and {Allison}, J.~R. and {Sadler}, E.~M. and 
        {Moss}, V.~A. and {Jarrett}, T.~H.},
    title = "{WISE data as a photometric redshift indicator for radio AGN}",
    journal = {ArXiv e-prints},
    archivePrefix = "arXiv",
    eprint = {1709.08634},
    primaryClass = "astro-ph.IM",
    keywords = {Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Astrophysics of Galaxies},
    year = 2017,
    month = sep,
    adsurl = {http://adsabs.harvard.edu/abs/2017arXiv170908634G},
    adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@ARTICLE{2011PASA...28..215N,
    author = {{Norris}, R.~P. and {Hopkins}, A.~M. and {Afonso}, J. and {Brown}, S. and 
        {Condon}, J.~J. and {Dunne}, L. and {Feain}, I. and {Hollow}, R. and 
        {Jarvis}, M. and {Johnston-Hollitt}, M. and {Lenc}, E. and {Middelberg}, E. and 
        {Padovani}, P. and {Prandoni}, I. and {Rudnick}, L. and {Seymour}, N. and 
        {Umana}, G. and {Andernach}, H. and {Alexander}, D.~M. and {Appleton}, P.~N. and 
        {Bacon}, D. and {Banfield}, J. and {Becker}, W. and {Brown}, M.~J.~I. and 
        {Ciliegi}, P. and {Jackson}, C. and {Eales}, S. and {Edge}, A.~C. and 
        {Gaensler}, B.~M. and {Giovannini}, G. and {Hales}, C.~A. and 
        {Hancock}, P. and {Huynh}, M.~T. and {Ibar}, E. and {Ivison}, R.~J. and 
        {Kennicutt}, R. and {Kimball}, A.~E. and {Koekemoer}, A.~M. and 
        {Koribalski}, B.~S. and {L{\'o}pez-S{\'a}nchez}, {\'A}.~R. and 
        {Mao}, M.~Y. and {Murphy}, T. and {Messias}, H. and {Pimbblet}, K.~A. and 
        {Raccanelli}, A. and {Randall}, K.~E. and {Reiprich}, T.~H. and 
        {Roseboom}, I.~G. and {R{\"o}ttgering}, H. and {Saikia}, D.~J. and 
        {Sharp}, R.~G. and {Slee}, O.~B. and {Smail}, I. and {Thompson}, M.~A. and 
        {Urquhart}, J.~S. and {Wall}, J.~V. and {Zhao}, G.-B.},
    title = "{EMU: Evolutionary Map of the Universe}",
    journal = {\pasa},
    archivePrefix = "arXiv",
    eprint = {1106.3219},
    keywords = {telescopes, surveys, stars: activity,  galaxies: evolution, galaxies: formation,  cosmology: observations, radio continuum: general},
    year = 2011,
    month = aug,
    volume = 28,
    pages = {215-248},
    doi = {10.1071/AS11021},
    adsurl = {http://adsabs.harvard.edu/abs/2011PASA...28..215N},
    adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@ARTICLE{2018MNRAS.476.3580C,
    author = {{Curran}, S.~J. and {Duchesne}, S.~W.},
    title = "{The mid-infrared properties and gas content of active galaxies over large lookback times}",
    journal = {\mnras},
    archivePrefix = "arXiv",
    eprint = {1802.05760},
    keywords = {galaxies: active, galaxies: ISM, quasars: absorption lines, infrared: galaxies, radio lines: galaxies, ultraviolet: galaxies},
    year = 2018,
    month = may,
    volume = 476,
    pages = {3580-3590},
    doi = {10.1093/mnras/sty443},
    adsurl = {http://adsabs.harvard.edu/abs/2018MNRAS.476.3580C},
    adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}


\end{filecontents}

\begin{document}

\cite{key}
\cite{bland}
\cite{glowacki}
\cite{2011PASA...28..215N}
\cite{2018MNRAS.476.3580C}




\bibliographystyle{plain}
\bibliography{\jobname}

\end{document}

Neither my report, which takes the references from the .bib file, nor this example here, recognizes the references. I've got the lines

\bibliography{bibliography_file}
\bibliographystyle{plain}

in my report file. This is the first time I've tried to use a .bib file, so it's probable that I'm doing something wrong. Why aren't the references being recognized?

I'm using TeXstudio on Windows 10.

  • I trust you ran LaTeX, BibTeX, LaTeX, LaTeX after you added the new entries and that there were no errors on the LaTeX run (we can ignore the warnings about undefined citations for the moment)? What does the .blg file say (that is BibTeX's log file, on Windows machine it might be classified as 'performance monitor' file, but it really is just a plain text file that you can open with your favourite editor; you may have to display the file extensions to find it)? – moewe Jul 5 '18 at 6:23
  • 2
    Unfortunately, the code you have shown us is not a MWE/MWEB (please follow the links), so I can't really check if the code works. But in a short test with a standard style I had little problems (only the journal macros were undefined, the rest just worked). – moewe Jul 5 '18 at 6:26
  • 1
    From your MWE I only get ! Undefined control sequence. \newblock {\em \araa etc. etc. If I force compilation regardless of these errors and run the full LaTeX, BibTeX, LaTeX, LaTeX cycle I get citations and a bibliography. – moewe Jul 5 '18 at 7:26
  • 1
    What happens if you replace \araa with ARA\&A, \pasa with PASA, \mnras with MNRAS; delete all the temporary files (.aux, .bbl, even \jobname.bib) and compile again? See also doc.adsabs.harvard.edu/abs_doc/aas_macros.sty, tex.stackexchange.com/q/270948/35864 – moewe Jul 5 '18 at 7:30
  • @moewe That fixed it! If you edit this comment to be an answer, I can accept it. Thank you. – Jim421616 Jul 5 '18 at 7:37
2

Your code compiles fine for me except for errors about the undefined macros \araa, \pasa and \mnras. For me those errors appear as

! Undefined control sequence.
l.12 \newblock {\em \araa
                         }, 54:529--596, September 2016.
? 

These errors come about because the .bib entries use the AAS journal abbreviation macros, yet AAS TeX is not used. See also http://ads.harvard.edu/pubs/bibtex/

So you have tow options:

  1. Define all the macros you might be using.
  2. Replace the macros by the journal names.

Option one can either be done by hand

\newcommand*{\araa}{ARAA}

etc. etc.

Or by loading http://doc.adsabs.harvard.edu/abs_doc/aas_macros.sty or one of the other packages listed in http://ads.harvard.edu/pubs/bibtex/. See also http://adsabs.harvard.edu/abs_doc/faq.html#bibtex

See also Software-generated bibliographic entries: common errors and other mistakes to check before use

You may also want to consider giving your entries more recognisable (and more memorable) entrykeys.

0

There appears to be a mistake in the .bib file. adsurl line of the first citation article has "%" which makes "}" unrecognisable.

adsurl = {http://adsabs.harvard.edu/abs/2016ARA%26A..54..529B},

  • 2
    Most styles ignore adsurl in which case it does not really matter that the % is unescaped. But even if it were recognised and used by a style a % is not always as bad for BibTeX styles as it can be for biblatex. A % doesn't cause errors if it is issued in an ungrouped context (granted, URLs probably aren't). – moewe Jul 5 '18 at 6:28

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.