Consider the following example (background in this question).






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


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?

  • 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. May 18 '12 at 8:07
  • Please make this an answer, so I can accept it and less people see what I have done...
    – Andy
    May 18 '12 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. May 18 '12 at 9:15

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.

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.