4

Trying to compile simple example of using bibliography in ConText (from contextgarden wiki). My file is:

\mainlanguage[russian]
\usemodule[simplefonts][size=12pt]
\setmainfont[XITS]
\setsansfont[Arial]

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

\cite[Tolh]

\completepublications[criterium=all]

\stoptext

Corresponding bib file is:

@Article{Tolh,
  Title                    = {{Поляризация электронов. Теория и эксперимент}},
  Author                   = {Тольхук, Х. А.},
  Journal                  = {УФН},
  Language                 = {russian},
  Year                     = {1957},
  Number                   = {12},
  Pages                    = {761--800},
  Volume                   = {63}
}

Well, it is in Russian, saved as utf8, and the main file is also in uft8. So, compilation with context stops with error:

tex error       > error on line 1 in file 2.bbl: ! String contains an invalid utf-8 sequence

l.1 \setuppublicationlist[samplesize={Т
                                      �57},totalnumber=1]

 1 >>  \setuppublicationlist[samplesize={Т�57},totalnumber=1]
 2     
 3     \startpublication[k=Tolh,t=article,
 4     a={{Тольхук}},y=1957,
 5     n=1,s=Т�57]
 6     \lang{russian}
 7     \artauthor[]{Х.~А.}[�.~�.]{}{Тольхук}
 8     \pubyear{1957}
 9     \arttitle{{Поляризация электронов. Теория и
10       эксперимент}}
11     \journal{УФН}

As I understand, these "black ?" mean some encoding problems. How to resolve them?

Finally, I would have publications be printed in numbered list in the order of citation in main text, and citations are numbers in brackets (i.e. [1], [20] etc.). Just like LaTeX does bibliography. Is it possible with Context?

4

The old bibliographical system used bibtex, which still relied on ASCII (more or less), that's why your example fails. Context has a new bibliographic system that completely bypasses bibtex; it can do what you want. It's still a bit experimental (and the documentation is not as full as one might wish). Here's your example rewritten:

\mainlanguage[ru]

\setupbodyfont [xits, 30pt]

\usebtxdataset     [mybib]
\usebtxdefinitions [aps]
\setupbtxrendering [default]
                   [numbering=yes]

\starttext

\cite[Tolh]

\placelistofpublications[criterium=all]

\stoptext

I guess that's what you mean. I don't know how LaTeX does bibliography – if this is imperative for you, it might be better to stick with LaTeX.

Result:

enter image description here

To dump a complete list of publications, use:

\usebtxdataset[customname][database.bib]
\definebtxrendering[customname][apa][
  dataset=customname,
  numbering=yes,
]

\starttext
  \startbackmatter
    \startchapter[title=Bibliography]
      \placelistofpublications[customname][method=dataset]
    \stopchapter
  \stopbackmatter
\stoptext
  • thank you so much for answer. Your output is almost what I mean. The main advantage (as for me) of ConText is that it has grid typesetting, this is impossible (as far as I know) in classic LaTeX. The main drawback is lack of documentation. Where can I read about this new mode of work with bibliography: what all these <>btx<> commands mean, what options/keys they have? How can I change style of output of \placelistofpublications? E.g., if I want to print author(s) field in italic, change separators between fields from comma to, say, emdash, etc. – Alx Feb 18 '16 at 10:21
  • And one more wish: what about localisation? I mean if I have article or book of 100 pages in Russian, I would like to see in bibliography output с. 100 (russian letter "s"), not p. 100. – Alx Feb 18 '16 at 10:39
  • The main documentation is a file named mkiv-publications. It is work in progress, so there is no downoadable version right now. If you want to work with this system, the best thing is to ask on the mailing list for the latest version. However: even this document gives no complete documentation yet, so again, if this is a must for you, don't use this system, you will have to roll up your sleeves and look into the source. Customization: there is a number of elements that you can change via setup commands, but if you have very specific needs, you may be better off writing your own syles. – Thomas Feb 18 '16 at 11:38
  • Localisation: look into the file tex/texmf-context/tex/context/base/mkiv/publ-imp-default.mkvi to see how this is done. You can provide your own language-specific labeltexts for most elements. – Thomas Feb 18 '16 at 11:41
  • OK, I put in main file some russian definitions: \setupbtxlabeltext[ru][aps:page={с.}, aps:Volume={т.} etc. But now in resulting file I have only these russian labels and no english p., Vol.even for books/articles with Languge={english} in mybib.bib file. Does it depend on command \mainlanguage[russian] in main file, or I have wrong languge definitions in mybib? – Alx Feb 18 '16 at 16:25

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.