1

Consider the following example (background in this question).

\setupbibtex[database={library},sort=author]
\setuppublications[alternative=apa]

%\define[1]\reference{\cite[data][#1]}

\starttext
\cite[data][Bohr:1923tl]
%\reference{Bohr:1923tl}

\section{References}
\placepublications[criterium=all]

\stoptext

after running it through Mk-IV is shows the expected behavior:

without_define

Simply defining a macros by uncommenting define – without even using it – breaks it. (def does not help either).

enter image description here

How to define citation macros?

3
  • That’s because \reference is an internal Context macro which is used to, well, place references (for internal links). Every entry in the bibliography happens to have such a reference, but as you changed the macro definition, breakage ensues as expected ... call it \bibref and things should work. Commented May 18, 2012 at 8:07
  • Please make this an answer, so I can accept it and less people see what I have done...
    – Andy
    Commented May 18, 2012 at 8:17
  • Here you go. Also it would be more precise to remove the tag [bibtex] from this question as MkIV does not rely on Bibtex even though it takes .bib files as input. Commented May 18, 2012 at 9:15

1 Answer 1

5

To elaborate a bit on my comment: \reference is the Context user interface macro to the pdf hyperlink facility (for the curious: it is defined among similar commands in strc-ref.mkvi). It is used internally as well, for instance in the macro \thebibtexpublicationlistelement, which typesets a single entry of the bibliography list (cf. bibl-bib.mkiv).

For this reason, redefining \reference is a Bad Idea™: It will definitely break automatically generated references, the corrupted bibliography being collateral damage. If you use \define, Context will kindly give you a hint in the log file:

system          > command \reference is already defined

Choose a harmless macro identifier instead: Capitalization for instance will ensure that a macro never conflicts with any of the internals. Thus, \Reference is the preferable choice.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .