==The database==
<br/>
A bibTEX file looks like this:
<pre detail='typing'> @Article{sometag, author = "An Author and Another One", title = "A hopefully meaningful title", journal = maps, volume = "25", number = "2", pages = "5--9", month = mar, year = "2013", ISSN = "1234-5678", }
</pre>
<br/>
<br/>
In the old MkII setup we have two kinds of entries: the ones that come from the bibTEX run and user supplied ones. We no longer rely on bibTEX output but we do still support the user supplied definitions. These were in fact prepared in a way that suits the processing of bibTEX generated entries. The next variant reflects the ConTEXt recoding of the old bibTEX output.
<pre detail='typing'> \startpublication[k=Hagen:Second,t=article,a={Hans Hagen},y=2013,s=HH01] \artauthor[]{Hans}[H.]{}{Hagen} \arttitle{Who knows more?} \journal{MyJournal} \pubyear{2013} \month{8} \volume{1} \issue{3} \issn{1234-5678} \pages{123--126} \stoppublication
</pre>
<br/>
<br/>
In the new setup we support these variants as well:
<pre detail='typing'> \startpublication[k=Hagen:Third,t=article] \author{Hans Hagen} \title{Who knows who?} ... \stoppublication
</pre>
<br/>
and
<pre detail='typing'> \startpublication[tag=Hagen:Third,category=article] \author{Hans Hagen} \title{Who knows who?} ... \stoppublication </pre>
<br/>
and
<pre detail='typing'> \startpublication \tag{Hagen:Third} \category{article} \author{Hans Hagen} \title{Who knows who?} ... \stoppublication
</pre>
<br/>
Because internally the entries are Lua tables, we also support loading of Lua based definitions:
<pre detail='typing'> return { ["Hagen:First"] = { author = "Hans Hagen", category = "article", issn = "1234-5678", issue = "3", journal = "MyJournal", month = "8", pages = "123--126", tag = "Hagen:First", title = "Who knows nothing?", volume = "1", year = "2013", }, }
</pre>
<br/>
Files set up like this can be loaded too. The following xml input is rather close to this, and is also accepted as input.
<pre detail='typing'> <?xml version="2.0" standalone="yes" ?>
<bibtex>
<entry tag="Hagen:First" category="article">
<field name="author">Hans Hagen</field>
<field name="category">article</field>
<field name="issn">1234-5678</field>
<field name="issue">3</field>
<field name="journal">MyJournal</field>
<field name="month">8</field>
<field name="pages">123--126</field>
<field name="tag">Hagen:First</field>
<field name="title">Who knows nothing?</field>
<field name="volume">1</field>
<field name="year">2013</field>
</entry>
</bibtex>
</pre>
<br/>
One unfortunate aspect commonly found in bibTEX files is that they often contain TEX commands. Even worse is that there is no standard on what these commands can be and what they mean, at least not formally, as bibTEX is a program intended to be used with many variants of TEX style: plain, LATEX, and others. This means that we need to define our use of these typesetting commands. However, in most cases, they are just abbreviations or font switches and these are often known. Therefore, ConTEXt will try to resolve them before reporting an issue. In the log file there is a list of commands that has been seen in the loaded databases. For instance, loading <tt>tugboat.bib</tt> gives a long list of commands of which we show a small set here:
<pre detail='typing'> publications > start used btx commands publications > standard CONTEXT 1 known publications > standard ConTeXt 4 known publications > standard TeXLive 3 KNOWN publications > standard eTeX 1 known publications > standard hbox 6 known publications > standard sltt 1 unknown publications > stop used btxcommands
</pre>
<br/>
You can define unknown commands, or overload existing definitions in the following way:
<pre detail='typing'> \definebtxcommand\TUB {TUGboat} \definebtxcommand\sltt{\tt} \definebtxcommand\<#1>{\type{#1}}
</pre>
<br/>
Unknown commands do not stall processing, but their names are then typeset in a mono- spaced font so they probably stand out for proofreading. You can access the commands with <tt>\btxcommand{...}</tt>, as in:
<pre detail='buffer'> commands like \btxcommand{MySpecialCommand} are handled in an indirect way
</pre>
<br/>
Normally in a document you will use only one bibliographic database, whether or not distributed over multiple files. Nevertheless we support multiple databases as well which is why we talk of datasets instead. A dataset is loaded with the <tt>\usebtxdataset</tt> command. Although currently it is not necessary to define a (default) dataset you can best do this because in the future we might provide more options. Here are some examples:
<pre detail='typing'> \definebtxdataset[standard] \usebtxdataset[standard][tugboat.bib] \usebtxdataset[standard][mtx-bibtex-output.xml] \usebtxdataset[standard][test-001-btx-standard.lua]
</pre>
<br/>
These three suffixes are understood by the loader. Here the dataset has the name <tt>standard</tt> and the three database files are merged, where later entries having the same tag overload previous ones. Definitions in the document source (coded in TEX speak) are also added, and they are saved for successive runs. This means that if you load and define entries, they will be known at a next run beforehand, so that references to them are independent of when loading and definitions take place.
<br/>
In this document we use some example databases, so let’s load one of them now:
<pre detail='buffer'> \definebtxdataset[example]
</pre>
\usebtxdataset[example][mkiv-publications.bib]
<br/>
You can ask for an overview of entries in a dataset with:
<pre detail='buffer'> \showbtxdatasetfields[example]
</pre>
this gives:
{|
|+
|
tag
|
|
category
|
|
fields
|
|+
|
demo-001
|
|
book
|
|
author index title year
|
|+
|
demo-002
|
|
book
|
|
crossref index year
|
|+
|
demo-003
|
|
book
|
|
author comment index title year
|
|+
|
demo-004
|
|
book
|
|
author comment index title year
|
|+
|
demo-005
|
|
book
|
|
author doi index pages serial title url year
|
|}
<br/>
You can set the current active dataset with
<pre detail='typing'> \setbtxdataset[standard]
</pre>
<br/>
<br/>
If you want to see what publications are in the database, the easiest way is to ask for a complete list:
<pre detail='buffer'> \definebtxrendering [example] [dataset=example, method=local, alternative=apa] \placelistofpublications % \placebtxrendering [example] [criterium=all]
</pre>
<br/>
This gives:1 Hans Hagen , H. and Ton Otten , T. (1996). Typesetting education documents2 Luigi Scarso , L. (2021). Designing high speed trains3 author (year). title pages p.
<br/>
The rendering itself is somewhat complex to set up because we have not only many different standards but also many fields that can be set up. This means that there are several commands involved. Often there is a prescribed style to render bibliographic descriptions, for example <tt>apa</tt>. A rendering is setup and defined with:
<br/>
And a list of such descriptions is generated with:
<br/>
A dataset can have all kind of entries:
<br/>
<br/>
Each has its own rendering variant. To keep things simple we have their settings separated. However, these settings are shared for all rendering alternatives. In practice this is seldom a problem in a publication as only one rendering alternative will be active. If this be not sufficient, you can always group local settings in a setup and hook that into the specific rendering.
<br/>
Examples of list variants are:
<br/>
{|
|+
|
<tt>no specific settings</tt>
|
|
|
|}
{|
|+
|
<tt>no specific settings</tt>
|
|
|
|}
{|
|+
|
<tt>no specific settings</tt>
|
|
|
|}
<br/>
There are a couple of accessors and helpers to get the job done. When you want to fetch a field from the current entry you use <tt>\btxfield</tt>. In most cases you want to make sure this field has a value, for instance because you don’t want fences or punctuation that belongs to a field.
<pre detail='typing'> \btxdoif {title} { \bold{\btxfield{title}}, }
</pre>
<br/>
There are three test macros:
<pre detail='typing'> \btxdoifelse{fieldname}{action when found}{action when not found} \btxdoif {fieldname}{action when found} \btxdoifnot {fieldname} {action when not found}
</pre>
<br/>
An extra conditional is available for testing interactivity:
<pre detail='typing'> \btxdoifelseinteraction{action when true}{action when false}
</pre>
<br/>
{|
|+
|
<tt>\btxfield</tt>
|
|
fetch a explicit field (e.g. <tt>year</tt>)
|
|+
|
<tt>\btxdetail</tt>
|
|
fetch a derived field (e.g. <tt>short</tt>)
|
|+
|
<tt>\btxflush</tt>
|
|
fetch a derived or explicit field
|
|}
<br/>
You can improve readability by using setups, for instance:
<pre detail='typing'> \btxdoifelse {author} { \btxsetup{btx:apa:author:yes} } { \btxsetup{btx:apa:author:nop} }
</pre>
<br/>
{|
|+
|
<tt>\btxspace</tt>
|
|
before after
|
|+
|
<tt>\btxperiod</tt>
|
|
before. after
|
|+
|
<tt>\btxcomma</tt>
|
|
before, after
|
|+
|
<tt>\btxlparent</tt>
|
|
before (after
|
|+
|
<tt>\btxrparent</tt>
|
|
before) after
|
|+
|
<tt>\btxlbracket</tt>
|
|
before [after
|
|+
|
<tt>\btxrbracket</tt>
|
|
before] after
|
|}
<br/>
So, the previous example setup can be rewritten as:
<pre detail='typing'> \btxdoif {title} { \bold{\btxfield{title}} \btxcomma } </pre>
<br/>
There is a special command for rendering a (combination) of authors:
<pre detail='typing'> \btxflushauthor{author} \btxflushauthor{editor} \btxflushauthor[inverted]{editor}
</pre>
<br/>
Instead of the last one you can also use:
<pre detail='typing'> \btxflushauthorinverted{editor}
</pre>
<br/>
{|
|+
|
conversion
|
|
rendering
|
|+
|
<tt>inverted</tt>
|
|
the Frog jr, Kermit
|
|+
|
<tt>invertedshort</tt>
|
|
the Frog jr, K
|
|+
|
<tt>normal</tt>
|
|
Kermit, the Frog, jr
|
|+
|
<tt>normalshort</tt>
|
|
K, the Frog, jr
|
|}
Citations are references to bibliographic entries that normally show up in lists someplace in the document: at the end of a chapter, in an appendix, at the end of an article, etc. We discussed the rendering of these lists in the previous chapter. A citation is normally pretty short as its main purpose is to refer uniquely to a more detailed description. But, there are several ways to refer, which is why the citation subsystem is configurable and extensible. Just look at the following commands:
<pre detail='buffer'> \cite[author][example::demo-003] \cite[authoryear][example::demo-003] \cite[authoryears][example::demo-003] \cite[author][example::demo-003,demo-004] \cite[authoryear][example::demo-003,demo-004] \cite[authoryears][example::demo-003,demo-004] \cite[author][example::demo-004,demo-003] \cite[authoryear][example::demo-004,demo-003] \cite[authoryears][example::demo-004,demo-003]
</pre>
(Hans Hagen and Ton Otten) (Hans Hagen and Ton Otten (1996)) (Hans Hagen and Ton Otten, 1996) (Hans Hagen and Ton Otten, Luigi Scarso) (Hans Hagen and Ton Otten (1996), Luigi Scarso (2021)) (Hans Hagen and Ton Otten, 1996, Luigi Scarso, 2021) (Luigi Scarso, Hans Hagen and Ton Otten) (Luigi Scarso (2021), Hans Hagen and Ton Otten (1996)) (Luigi Scarso, 2021, Hans Hagen and Ton Otten, 1996)
<br/>
The first argument is optional.
<br/>
You can tune the way a citation shows up:
<pre detail='buffer'> \setupbtxcitevariant[author] [sorttype=author,color=darkyellow] \setupbtxcitevariant[authoryear] [sorttype=author,color=darkyellow] \setupbtxcitevariant[authoryears][sorttype=author,color=darkyellow]
</pre>
\cite[author][example::demo-004,demo-003]\cite[authoryear][example::demo-004,demo-003]\cite[authoryears][example::demo-004,demo-003]
\cite[authoryear][example::demo-004,demo-003]
\cite[authoryears][example::demo-004,demo-003]
<br/>
Here we sort the authors and color the citation:
(Hans Hagen and Ton Otten, Luigi Scarso) (Hans Hagen and Ton Otten (1996), Luigi Scarso (2021)) (Hans Hagen and Ton Otten, 1996, Luigi Scarso, 2021) <br/>For reasons of backward compatibility the <tt>\cite</tt> command is a bit picky about spaces between the two arguments, of which the first is optional. This is a consequence of allowing its use with the key specified between curly brackets as is the traditional practice. (We do encourage users to adopt the more coherent ConTEXt syntax by using square brackets for keywords and reserving curly brackets to regroup text to be typeset.)
<br/>
For reasons of backward compatibility the The <tt>\citecitation</tt> command is a bit picky about spaces between the two synonymous but is more flexible with respect to spacing of its arguments, of which the first is optional. : <pre detail='typing'> \citation[author] [example::demo-004,demo-003] \citation[authoryear] [example::demo-004,demo-003] \citation[authoryears][example::demo-004,demo-003]
</pre>
<br/>
{|
|+
|
key
|
|
rendering
|
|+
|
<tt>author</tt>
|
|
(author)
|
|+
|
<tt>authornum</tt>
|
|
[author [btx error 1]]
|
|+
|
<tt>authoryear</tt>
|
|
(author (year))
|
|+
|
<tt>authoryears</tt>
|
|
(author, year)
|
|+
|
<tt>doi</tt>
|
|
[todo: doi]
|
|+
|
<tt>key</tt>
|
|
[demo-005]
|
|+
|
<tt>none</tt>
|
|
|
|+
|
<tt>num</tt>
|
|
[[btx error 1]]
|
|+
|
<tt>page</tt>
|
|
pages
|
|+
|
<tt>serial</tt>
|
|
[5]
|
|+
|
<tt>short</tt>
|
|
[aut00]
|
|+
|
<tt>type</tt>
|
|
[book]
|
|+
|
<tt>url</tt>
|
|
[todo: url]
|
|+
|
<tt>year</tt>
|
|
(year)
|
|}
<br/>
Because we are dealing with database input and because we generally need to manipulate entries, much of the work is delegated to Lua. This makes it easier to maintain and extend the code. Of course TEX still does the rendering. The typographic details are controlled by parameters but not all are used in all variants. As with most ConTEXt commands, it starts out with a general setup command:
<br/>
On top of that we can define instances that inherit either from a given parent or from the topmost setup.
<br/>
But, specific variants can have them overloaded:
<br/>
{|
|+
|
<tt>right</tt>
|
|
<tt>)</tt>
|
|+
|
<tt>middle</tt>
|
|
<tt>, </tt>
|
|+
|
<tt>left</tt>
|
|
<tt>(</tt>
|
|}
{|
|+
|
<tt>right</tt>
|
|
<tt>]</tt>
|
|+
|
<tt>middle</tt>
|
|
<tt>, </tt>
|
|+
|
<tt>left</tt>
|
|
<tt>[</tt>
|
|}
{|
|+
|
<tt>compress</tt>
|
|
<tt>yes</tt>
|
|+
|
<tt>inbetween</tt>
|
|
<tt>, </tt>
|
|+
|
<tt>right</tt>
|
|
<tt>)</tt>
|
|+
|
<tt>middle</tt>
|
|
<tt>, </tt>
|
|+
|
<tt>left</tt>
|
|
<tt>(</tt>
|
|}
{|
|+
|
<tt>compress</tt>
|
|
<tt>yes</tt>
|
|+
|
<tt>inbetween</tt>
|
|
<tt>, </tt>
|
|+
|
<tt>right</tt>
|
|
<tt>)</tt>
|
|+
|
<tt>middle</tt>
|
|
<tt>, </tt>
|
|+
|
<tt>left</tt>
|
|
<tt>(</tt>
|
|}
{|
|+
|
<tt>right</tt>
|
|
<tt>]</tt>
|
|+
|
<tt>left</tt>
|
|
<tt>[</tt>
|
|}
{|
|+
|
<tt>right</tt>
|
|
<tt>]</tt>
|
|+
|
<tt>left</tt>
|
|
<tt>[</tt>
|
|}
{|
|+
|
<tt>no specific settings</tt>
|
|
|
|}
<br/>
<tt>setupbtxcitevariant : num</tt>
{|
|+
|
<tt>compress</tt>
|
|
<tt>yes</tt>
|
|+
|
<tt>inbetween</tt>
|
|
<tt>--</tt>
|
|+
|
<tt>right</tt>
|
|
<tt>]</tt>
|
|+
|
<tt>left</tt>
|
|
<tt>[</tt>
|
|}
{|
|+
|
<tt>inbetween</tt>
|
|
<tt>–</tt>
|
|}
{|
|+
|
<tt>right</tt>
|
|
<tt>]</tt>
|
|+
|
<tt>left</tt>
|
|
<tt>[</tt>
|
|}
{|
|+
|
<tt>right</tt>
|
|
<tt>]</tt>
|
|+
|
<tt>left</tt>
|
|
<tt>[</tt>
|
|}
{|
|+
|
<tt>right</tt>
|
|
<tt>]</tt>
|
|+
|
<tt>left</tt>
|
|
<tt>[</tt>
|
|}
{|
|+
|
<tt>right</tt>
|
|
<tt>]</tt>
|
|+
|
<tt>left</tt>
|
|
<tt>[</tt>
|
|}
{|
|+
|
<tt>right</tt>
|
|
<tt>)</tt>
|
|+
|
<tt>left</tt>
|
|
<tt>(</tt>
|
|}
<br/>
A citation variant is defined in several steps and if you really want to know the dirty details, you should look into the <tt>publ-imp-*.mkiv</tt> files. Here we stick to the concept.
<pre detail='typing'> \startsetups btx:cite:author \btxcitevariant{author} \stopsetups
</pre>
<br/>
You can overload such setups if needed, but that only makes sense when you cannot configure the rendering with parameters. The <tt>\btxcitevariant</tt> command is one of the build in accessors and it calls out to Lua where more complex manipulation takes place if needed. If no manipulation is known, the field with the same name (if found) will be flushed. A command like <tt>\btxcitevariant</tt> assumes that a dataset and specific tag has been set. This is normally done in the wrapper macros, like <tt>\cite</tt>. For special purposes you can use these commands<pre detail='typing'> \setbtxdataset[example] \setbtxentry[hh2013]
</pre>
<br/>
<br/>
Unless you use <tt>criterium=all</tt> only publications that are cited will end up in the lists. You can force a citation into a list using <tt>\usecitation</tt>, for example:
<pre detail='typing'> \usecitation[example::demo-004,demo-003]
</pre>
<br/>
This command has two synonyms: <tt>\nocite</tt> and <tt>\nocitation</tt> so you can choose whatever fits you best.
<br/>
The entries are collected in datasets and each set has a unique name. In this document we have the set named <tt>example</tt>. A dataset table has several fields, and probably the one of most interest is the <tt>luadata</tt> field. Each entry in this table describes a publication:
<pre detail='typing'> t={ ["author"]="Hans Hagen", ["category"]="book", ["index"]=1, ["tag"]="demo-001", ["title"]="\\btxcmd{BIBTEX}, the \\btxcmd{CONTEXT}\\ way", ["year"]="2013", } </pre>This is <tt>publications.datasets.example.luadata["demo-001"]</tt>. There can be a companion entry in the parallel <tt>details</tt> table. <pre detail='typing'> t={ ["author"]={ { ["firstnames"]={ "Hans" }, ["initials"]={ "H" }, ["original"]="Hans Hagen", ["surnames"]={ "Hagen" }, ["vons"]={}, }, }, ["short"]="Hag13", }
</pre>
These details are accessed as <tt>publications.datasets.example.details["demo-001"]</tt> and by using a separate table we can overload fields in the original entry without losing the original.
<br/>
You can loop over the entries using regular Lua code combined with MkIV helpers:
<pre detail='buffer'> local dataset = publications.datasets.example
</pre>
context.starttabulate { "|l|l|l|" } for tag, entry in table.sortedhash(dataset.luadata) do local detail = dataset.details[tag] or { }context.NC() context.type(tag)context.NC() context(detail.short)context.NC() context(entry.title)context.NC() context.NR()endcontext.stoptabulate()
context.NC() context.type(tag)
context.NC() context(detail.short)
context.NC() context(entry.title)
context.NC() context.NR()
end
context.stoptabulate()
<br/>
This results in:
{|
|+
|
<tt>demo-001</tt>
|
|
Hag13
|
|
bibTEX, the ConTEXt way
|
|+
|
<tt>demo-002</tt>
|
|
Hag14
|
|
bibTEX, the ConTEXt way
|
|+
|
<tt>demo-003</tt>
|
|
HO96
|
|
Typesetting education documents
|
|+
|
<tt>demo-004</tt>
|
|
Sca21
|
|
Designing high speed trains
|
|+
|
<tt>demo-005</tt>
|
|
aut00
|
|
title
|
|}
<br/>
Once a dataset is accessible as xml tree, you can use the regular <tt>\xml...</tt> commands. We start with loading a dataset, in this case from just one file.
<pre detail='buffer'> \usebtxdataset[tugboat][tugboat.bib]
</pre>
<br/>
The dataset has to be converted to xml:
<pre detail='buffer'> \convertbtxdatasettoxml[tugboat]
</pre>
<br/>
The tree is now accessible by its root reference <tt>btx:tugboat</tt>. If we want simple field access we can use a few setups:
<pre detail='buffer'> \startxmlsetups btx:initialize \xmlsetsetup{#1}{bibtex|entry|field}{btx:*} \xmlmain{#1} \stopxmlsetups
</pre>
\startxmlsetups btx:field \xmlflushcontext{#1} \stopxmlsetups
\xmlsetup{btx:tugboat}{btx:initialize}
<br/>
The two setups are predefined in the core already, but you might want to change them. They are applied in for instance:
<pre detail='buffer'> \starttabulate[|||] \NC \type {tag} \NC \xmlfirst {btx:tugboat} {/bibtex/entry[string.find(@tag,'Hagen')]/attribute('tag')} \NC \NR \NC \type {title} \NC \xmlfirst {btx:tugboat} {/bibtex/entry[string.find(@tag,'Hagen')]/field[@name='title']} \NC \NR \stoptabulate
</pre>
{|
|+
|
<tt>tag</tt>
|
|
Hagen:TB17-1-54
|
|+
|
<tt>title</tt>
|
|
PPCHTEX: typesetting chemical formulas in TEX
|
|}
<pre detail='buffer'> \startxmlsetups btx:demo \xmlcommand {#1} {/bibtex/entry[string.find(@tag,'Hagen')][1]}{btx:table} \stopxmlsetups
</pre>
\startxmlsetups btx:table \starttabulate[|||] \NC \type {tag} \NC \xmlatt{#1}{tag} \NC \NR \NC \type {title} \NC \xmlfirst{#1}{/field[@name='title']} \NC \NR \stoptabulate \stopxmlsetups
\xmlsetup{btx:tugboat}{btx:demo}
{|
|+
|
<tt>tag</tt>
|
|
Hagen:TB17-1-54
|
|+
|
<tt>title</tt>
|
|
PPCHTEX: typesetting chemical formulas in TEX
|
|}
<br/>
Here is another example:
<pre detail='buffer'> \startxmlsetups btx:row \NC \xmlatt{#1}{tag} \NC \xmlfirst{#1}{/field[@name='title']} \NC \NR\stopxmlsetups</pre> \startxmlsetups btx:demo\xmlfilter {#1} {/bibtex/entry[@category='article']/field[@name='author' and (find(text(),'Knuth') or find(text(),'DEK'))]/../command(btx:row)}\stopxmlsetups
\starttabulate[|||]\xmlsetup{btx:tugboat}{btx:demo}\stoptabulatestopxmlsetups
</pre>
\startxmlsetups btx:demo \xmlfilter {#1} {|
|+ /bibtex
| Knuth:TB10-1-31| /entry[@category='article']
/field[@name='author' and (find(text(),'Knuth') or find(text(),'DEK'))] /../command(btx:row) } \stopxmlsetups \starttabulate[|||] \xmlsetup{btx:tugboat}{btx:demo} \stoptabulate {| |+ | Knuth:TB10-1-31| |
Typesetting Concrete Mathematics
|
|+
|
Knuth:TB10-1-8
|
|
TEX would find it difficult …
|
|+
|
Knuth:TB10-3-325
|
|
The new versions of TEX and MF
|
|+
|
Knuth:TB10-4-529
|
|
The errors of TEX
|
|+
|
Knuth:TB11-1-13
|
|
Virtual Fonts: More Fun for Grand Wizards
|
|+
|
Knuth:TB11-2-165
|
|
Exercises for TEX: The Program
|
|+
|
Knuth:TB11-4-489
|
|
The future of TEX and MF
|
|+
|
Knuth:TB11-4-497
|
|
Arthur Lee Samuel, 1901--1990
|
|+
|
Knuth:TB11-4-499
|
|
Answers to Exercises for TEX: The Program
|
|+
|
Knuth:TB12-2-313
|
|
Fixed-point glue setting: Errata
|
|+
|
Knuth:TB14-4-387
|
|
Icons for TEX and MF
|
|+
|
Knuth:TB17-1-29
|
|
Important message regarding CM fonts
|
|+
|
Knuth:TB2-3-5
|
|
The current state of things
|
|+
|
Knuth:TB3-1-10
|
|
Fixed-point glue settingDash an example of WEB
|
|+
|
Knuth:TB31-2-121
|
|
An Earthshaking Announcement
|
|+
|
Knuth:TB4-2-64
|
|
A note on hyphenation
|
|+
|
Knuth:TB5-1-4
|
|
TEX incunabula
|
|+
|
Knuth:TB5-1-67
|
|
Comments on quality in publishing
|
|+
|
Knuth:TB5-2-105
|
|
A course on MF programming
|
|+
|
Knuth:TB6-1-36
|
|
Recipes and fractions
|
|+
|
Knuth:TB7-2-101
|
|
The TEX logo in various fonts
|
|+
|
Knuth:TB7-2-95
|
|
Remarks to celebrate the publication of Computers & Typesetting
|
|+
|
Knuth:TB8-1-14
|
|
Mixing right-to-left texts with left-to-right texts
|
|+
|
Knuth:TB8-1-6
|
|
It happened: announcement of TEX 2.1
|
|+
|
Knuth:TB8-1-73
|
|
Problem for a Saturday afternoon
|
|+
|
Knuth:TB8-2-135
|
|
Fonts for digital halftones
|
|+
|
Knuth:TB8-2-210
|
|
Saturday morning problemDash solution
|
|+
|
Knuth:TB8-2-217
|
|
Reply: Printing out selected pages
|
|+
|
Knuth:TB8-3-309
|
|
Macros for Jill
|
|+
|
Knuth:TB9-2-152
|
|
A Punk Meta-Font
|
|}
<br/>
A more extensive example is the following. Of course this assumes that you know what xml support mechanisms and macros are available.
<pre detail='buffer'> \startxmlsetups btx:getkeys \xmladdsortentry{btx}{#1}{\xmlfilter{#1}{/field[@name='author']/text()}} \xmladdsortentry{btx}{#1}{\xmlfilter{#1}{/field[@name='year' ]/text()}}\xmladdsortentry{btx}{#1}{\xmlatt{#1}{tag}}\stopxmlsetups</pre> \startxmlsetups btx:sorter\xmlresetsorter{btx}% \xmlfilter{#1}{entry/command(btx:getkeys)}\xmlfilter{#1}{/bibtex/entry[@category='article']/field[@name='author' and find(text(),'Knuth')]/../command(btx:getkeys)}\xmlsortentries{btx}\starttabulate[||||]\xmlflushsorter{btx}{btx:entry:flush}\stoptabulate\stopxmlsetups
\startxmlsetups xmladdsortentry{btx:entry:flush\NC \xmlfilter}{#1}{/field[@name='year' ]/context()}\NC \xmlatt{#1}{tag}\NC \xmlfilter{#1}{/field[@name='author']/context()}\NC \NR\stopxmlsetups
\xmlsetup{btx:tugboat}{btx:sorter}stopxmlsetups
</pre>
\startxmlsetups btx:sorter \xmlresetsorter{|btx}
|+ % \xmlfilter{#1}{entry/command(btx:getkeys)}
| 1984| \xmlfilter{#1}{
| Knuth:TB5-1-67| /bibtex
/entry[@category='article'] /field[@name='author' and find(text(),'Knuth')] /../command(btx:getkeys)} \xmlsortentries{btx} \starttabulate[||| |] \xmlflushsorter{btx}{btx:entry:flush} \stoptabulateDon Knuth \stopxmlsetups \startxmlsetups btx:entry:flush \NC \xmlfilter{#1}{/field[@name='year' ]/context()} \NC \xmlatt{#1}{tag} \NC \xmlfilter{#1}{/field[@name='author']/context()} \NC \NR \stopxmlsetups \xmlsetup{btx:tugboat}{btx:sorter} {|
|+
|
1984
|
|
Knuth:TB5-1-467
|
|
Donald E. Don Knuth
|
|+
|
1984
|
|
Knuth:TB5-1-4
|
|
Donald E. Knuth
|
|+
|
1984
|
|
Knuth:TB5-2-105
|
|
Donald E. Knuth
|
|+
|
1985
|
|
Knuth:TB6-1-36
|
|
Donald E. Knuth
|
|+
|
1986
|
|
Knuth:TB7-2-101
|
|
Donald E. Knuth
|
|+
|
1987
|
|
Knuth:TB8-2-135
|
|
Donald E. Knuth
|
|+
|
1987
|
|
Knuth:TB8-3-309
|
|
Donald E. Knuth
|
|+
|
1988
|
|
Knuth:TB9-2-152
|
|
Donald E. Knuth
|
|+
|
1989
|
|
Knuth:TB10-3-325
|
|
Donald E. Knuth
|
|+
|
1989
|
|
Knuth:TB10-4-529
|
|
Donald E. Knuth
|
|+
|
1990
|
|
Knuth:TB11-4-489
|
|
Donald E. Knuth
|
|+
|
1993
|
|
Knuth:TB14-4-387
|
|
Donald E. Knuth
|
|+
|
1996
|
|
Knuth:TB17-1-29
|
|
Donald E. Knuth
|
|+
|
1987
|
|
Knuth:TB8-1-14
|
|
Donald Knuth and Pierre MacKay
|
|+
|
1981
|
|
Knuth:TB2-3-5
|
|
Donald Knuth
|
|+
|
1982
|
|
Knuth:TB3-1-10
|
|
Donald Knuth
|
|+
|
1983
|
|
Knuth:TB4-2-64
|
|
Donald Knuth
|
|+
|
1986
|
|
Knuth:TB7-2-95
|
|
Donald Knuth
|
|+
|
1987
|
|
Knuth:TB8-1-6
|
|
Donald Knuth
|
|+
|
1987
|
|
Knuth:TB8-1-73
|
|
Donald Knuth
|
|+
|
1987
|
|
Knuth:TB8-2-210
|
|
Donald Knuth
|
|+
|
1987
|
|
Knuth:TB8-2-217
|
|
Donald Knuth
|
|+
|
1989
|
|
Knuth:TB10-1-8
|
|
Donald Knuth
|
|+
|
1989
|
|
Knuth:TB10-1-31
|
|
Donald Knuth
|
|+
|
1990
|
|
Knuth:TB11-1-13
|
|
Donald Knuth
|
|+
|
1990
|
|
Knuth:TB11-2-165
|
|
Donald Knuth
|
|+
|
1990
|
|
Knuth:TB11-4-497
|
|
Donald Knuth
|
|+
|
1990
|
|
Knuth:TB11-4-499
|
|
Donald Knuth
|
|+
|
1991
|
|
Knuth:TB12-2-313
|
|
Donald Knuth
|
|+
|
2010
|
|
Knuth:TB31-2-121
|
|
Donald Knuth
|
|}
In the original bibliography support module usage was as follows (example taken from the contextgarden wiki):
<pre detail='typing'> % engine=pdftex \usemodule[bib] \usemodule[bibltx] \setupbibtex [database=xampl] \setuppublications [numbering=yes] \starttext As \cite [article-full] already indicated, bibtex is a \LATEX||centric program. \completepublications \stoptext
</pre>
<br/>
For MkIV the modules were partly rewritten and ended up in the core so the two commands are not were no longer needed there. One advantage The overhead associated with the automatic loading of explicitly loading a module is that a job that doesn’t need references to publications doesn’t suffer from the associated overhead. Nowadays this overhead bibliography macros can be neglected. The first setup command in this example is needed to bootstrap the process: it tells what database has to be processed by bibTEX between runs. The second setup command is optional. Each citation (tagged with these days, so standardized modules such as <tt>\citebib</tt>) ends up in are all being moved to the list of publicationscore and do not need to be explicitly loaded.
<br/>
In The first <tt>\setupbibtex</tt> command in this example is needed to bootstrap the new approach again the code process: it tells what database has to be processed by bibTEX between runs. The second <tt>\setuppublications</tt> command is optional. Each citation (tagged with <tt>\cite</tt>) ends up in the ConTEXt kernel, so no modules need to be loadedlist of publications. But, as <br/>In the new approach we no longer use bibTEX, bibTEXso we don’t need to setup bibTEX. Instead we define dataset(s). We also no longer set up publications with one command, but have split that up in rendering-, list-, and cite-variants. The basic <tt>\cite</tt> command remains. The above example becomes: <pre detail='typing'> \definebtxdataset [document] \usebtxdataset [document] [mybibfile.bib] \definebtxrendering [document] \setupbtxrendering [document] [numbering=yes] \starttext As \cite [article-full] already indicated, bibtex is a \LATEX||centric program. \completebtxrendering[document] \stoptext
</pre>
<br/>
So, we have a few more commands to set up things. If you intend to use just one a single dataset and rendering, the above preamble can be simplified to: <pre detail='typing'> \usebtxdataset [mybibfile.bib] \setupbtxrendering [numbering=yes]
</pre>
<br/>
But keep in mind, that compared to the old MkII derived method we have moved some of the setup options to setting up the rendering, list and cite setup variants.
<br/>
Another difference is now the use of lists. When you define a rendering, you also define a list. However, all entries are collected in a common list tagged <tt>btx</tt>. Although you will normally configure a rendering you can still set some properties of lists, but in that case you need to prefix the list identifier. In the case of the above example this is <tt>btx:document</tt>.
As TEX and Lua are both open and accessible in ConTEXt it is possible to extend the functionality of the bibliography related code. For instance, you can add extra loaders.
<pre detail='typing'> function publications.loaders.myformat(dataset,filename) local t = { } -- Load data from 'filename' and convert it to a Lua table 't' with -- the key as hash entry and fields conforming the luadata table -- format. loaders.lua(dataset,t) end
</pre>
<br/>
This then permits loading a database (into a dataset) with the command:
<pre detail='typing'> \usebtxdataset[standard][myfile.myformat]
</pre>
<br/>
The <tt>myformat</tt> suffix is recognized automatically. If you want to use another suffix, you can do this:
<pre detail='typing'> \usebtxdataset[standard][myformat::myfile.txt]
</pre>