0

I really do not know how to ask this question. I am trying to compile a tex document (\documentclass[a4paper]{report}), in which for the bibliography I have to include many references whose bibtex format is like:

@ARTICLE{Zand+94,
author = {{in 't Zand}, J.~J.~M. and {Heise}, J. and {Jager}, R.},
title = "{The optimum open fraction of coded apertures. With an application to the wide field X-ray cameras of SAX}",
journal = {\aap},
keywords = {INSTRUMENTATION: DETECTORS, TECHNIQUES: IMAGE PROCESSING, TELESCOPES, X-RAYS: GENERAL},
 year = 1994,
month = aug,
volume = 288,
pages = {665-674},
adsurl = {http://adsabs.harvard.edu/abs/1994A\%26A...288..665I},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

To define the journal, I have found this official website where definitions of the journals abbreviations are given as \def\aap{\ref@jnl{A\&A}}.

However, when I compile with pdflatex bibtex (a variable number of times), I receive the warning:

LaTeX Warning: Reference `@' on page 35 undefined on input line 92.

for each reference where the voice journal is included in the bibtex text. The line 92 is where the command printbibliography is given in the main tex file.

As a consequence of the warning, the reference in the bibliography is mispelled:

in ’t Zand, J. J. M., J. Heise, and R. Jager (Aug. 1994). “The optimum
open fraction of coded apertures. With an application to the wide field
X-ray cameras of SAX”. In: ??jnlA&A 288, pp. 665–674.

How can I fix it?

David Carlisle
  • 757,742
Py-ser
  • 245

2 Answers2

4

You make it hard to give a definitive answer as you have only posted disjointed fragments but I would guess that you have

\def\aap{\ref@jnl{A\&A}}

not

\makeatletter
\def\aap{\ref@jnl{A\&A}}
\makeatother

If @ is a letter then \ref@jnl is a single command, hopefully defined somewhere in your package or class file.

If @ is not a letter then \ref@jnl is equivalent to \ref {@}jnl and so will generate an errror about an unknown \label @.

David Carlisle
  • 757,742
  • Thanks for the answer! Sorry, I do not understand your guess anyway. What is \makeatletter? Also, a definition of \ref@jnl is given in the link I posted, but not totally sure it works properly, how would you define it? – Py-ser Jun 24 '15 at 15:50
  • @Py-ser see http://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do – David Carlisle Jun 24 '15 at 15:51
  • I see. Should I surround \def\ref@jnl#1{{\jnl@style#1}} with those? – Py-ser Jun 24 '15 at 16:10
  • @Py-ser all such things should really be in a package (where @ is automatically a letter, but for one off use if you are defining them in your document you need \makeatletter \makeatother around the block where you are defining or using @ commands – David Carlisle Jun 24 '15 at 16:13
  • Thanks. There is no package, I have copied in my main tex file those definitions that I took from the link. Either I surround that line with \makeatletter and \makeatother, or not, I still receive the error: ! Undefined control sequence. \aap ->\ref@jnl {A\&A} or ! Undefined control sequence. \ref@jnl #1->{\jnl@style #1} – Py-ser Jun 24 '15 at 16:17
  • @Py-ser sorry if you need more help you should fix the question to have a complete self contained document from \documentclass (preferably using article) to \end{document} that demonstrates the error. I can not guess what commands you have or what is wrong from fragments in comments. – David Carlisle Jun 24 '15 at 16:20
4

it seems that you are extracting only some lines from the package you linked in your question. the definitions there are encoded with "internal" notation, using @ as a "letter" for the duration of reading in that \sty file.

unless you are loading the complete package with \usepackage, you need to treat the extracted lines as if they were being read in with the \usepackage conventions. as mentioned in several comments, and a linked potential duplicate, the way to do this is to wrap the extracted lines between \makeatletter ... \makeatother.

this code takes care of the underlying style definitions and the one command for a journal abbreviation that you cite in your question. it should go into your preamble.

\makeatletter
\let\jnl@style=\rm
\def\ref@jnl#1{{\jnl@style#1}}

\def\aap{\ref@jnl{A\&A}}                % Astronomy and Astrophysics
\makeatother

if you need to add more journal definitions, be sure to insert them before the line \makeatother.