On Fri, May 29, 2015 at 5:20 PM, Alexander Shukaev <haroogan@gmail.com> wrote:
Hello,

I think I've experienced a severe bug here.  Consider the following:

​​
\setuphead
[chapter][%
  referenceprefix={chapter},
]

...
\cite[xxx]
...

\startpublication[
  k={xxx},
  t={...},
  a={...},
  y={...},
]
...
\stoppublication


\startchapter
[title={BIBLIOGRAPHY}]

\whitespace
\placepublications

\stopchapter

will render [[error 2]] in place of `\cite[xxx]' because of `referenceprefix' in `\setuphead'.  Why?  I don't believe `referenceprefix' in `\setuphead' should have something to do with `\cite' at all.

Thankfully, it's pretty rare that one uses `chapter' for bibliography, but still I think it's better to fix this.  For instance, right now the following works fine for me:

\setuphead
[chapter][%
  referenceprefix={chapter},
]

​​
\setuphead
[title][%
  referenceprefix={},
]

...
\cite[xxx]
...

\startpublication[
  k={xxx},
  t={...},
  a={...},
  y={...},
]
...
\stoppublication


\starttitle
[title={BIBLIOGRAPHY}]

\whitespace
\placepublications

\stoptitle

NOTE: It's extremely important to explicitly do `referenceprefix={}' for `title' because somehow `title' inherits `referenceprefix={chapter}' from `chapter'; and therefore, not doing `referenceprefix={}' will again result in [[error 2]] in place of `\cite[xxx]'.

Looking forward to your feedback.

Kind regards,
Alexander

​It seems to be even worse.  It's enough to simple have `chapter' somewhere to trigger the bug (no necessary to put `chapter' around `\placepublications':

​\setuphead
[chapter][%
  referenceprefix={chapter},
]

\setuphead
[title][%
  referenceprefix={},
]

...
\cite[xxx]
...

\startchapter
[title={Chapter}]
\stopchapter

\startpublication[
  k={xxx},
  t={...},
  a={...},
  y={...},
]
...
\stoppublication

\placepublications

will result in [[error 2]] again, and there seems to be no workaround.