[Tex/LaTex] Undefined control sequence while trying to use BibTeX

bibtexpdftex

I have been having trouble getting BibTeX to work in Texmaker (on macOS High Sierra, just in case that's relevant). Even the most minimal document runs into issues – this is the document in question:

\documentclass[a4paper,11pt]{article}

\begin{document}
This is a citation embedded within the text - or at least it should be. \cite{VisSand1977}

\bibliographystyle{abbrv}
\bibliography{References}

\end{document}

The single reference I have used is in a file named 'References.bib', which is stored in the same directory as the main .tex file, and reads as follows:

@ARTICLE{VisSand1977,
   author = {{Visvanathan}, N. and {Sandage}, A.},
    title = "{The color-absolute magnitude relation for E and S0 galaxies. I - Calibration and tests for universality using Virgo and eight other nearby clusters}",
  journal = {\apj},
 keywords = {Astronomical Photometry, Elliptical Galaxies, Galactic Clusters, Spiral Galaxies, Virgo Galactic Cluster, Calibrating, Cassegrain Optics, Correlation, Galactic Structure, Hubble Diagram, Spectral Energy Distribution},
     year = 1977,
    month = aug,
   volume = 216,
    pages = {214-226},
      doi = {10.1086/155464},
   adsurl = {http://adsabs.harvard.edu/abs/1977ApJ...216..214V},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

This BibTeX entry was copied and pasted directly from the source of the article online, and the only change I've made is to the cite key (having changed it to VisSand1977).

I have the 'Quick Build' preferences set to 'PdfLaTex + Bib(la)tex + PdfLaTeX (x2) + View Pdf', but whenever I try to compile it I get given the error '! Undefined control sequence'. This error points me towards line 8, which is completely empty. I've tried playing around with the white space by deleting empty lines or adding new ones in, but the error points towards line 8 every single time, regardless of what's in it. If I try running PdfLaTeX on its own rather than using Quick Build, I get exactly the same error. Furthermore, if I then run BibTeX, I don't get any errors at all. Lastly, if I remove everything to do with the bibliography, PdfLaTeX has no issue (although BibTeX obviously does, as it tries to search for information that's no longer there).

If it helps, these are my 'Commands' preferences:

My current 'Commands' preferences in Texmaker.

Any help would be much appreciated! This issue has been driving me crazy all day. Thanks!

Best Answer

The error message as shown on the terminal and log file is

(./tesfile.bbl
! Undefined control sequence.
l.8 \newblock {\em \apj
                       }, 216:214--226, Aug. 1977.
? 

the (./... part shows the file that the error occurred in (the .bbl file generated by bibtex) the l.8 shows that it is on line 8 of that file, and the linebreak after \apj shows that is how far TeX got reading the file, so \apj is the undefined command.

Putting

\newcommand\apj{Journal of something}

in your document preamble will allow the document to run without error.