Changes

Jump to navigation Jump to search
1,012 bytes removed ,  09:05, 21 January 2014
no edit summary
__TOC__<h1>The database</h1>
  <h1>The data­base</h1> The <span tag="MKIV" style="font-style:sans;">bibTEX</span> for­mat format is rather pop­u­lar popular in the <span tag="MKIV" style="font-style:sans;">TEX</span> com­mu­nity community and even with its short­com­ings shortcomings it will stay around for a while. Many pub­li­ca­tion web­sites publication websites can ex­port export and many tools are avail­able available to work with this data­base for­matdatabase format. It is rather sim­ple simple and looks a bit like <span tag="MKIV" style="font-style:sans;">Lua</span> ta­blestables. Un­for­tu­nately Unfortunately the con­tent content can be pol­luted polluted with non-stan­dard­ized standardized <span tag="MKIV" style="font-style:sans;">TEX</span> com­mands commands which com­pli­cates complicates pre- or post­pro­cess­ing out­side postprocessing outside <span tag="MKIV" style="font-style:sans;">TEX</span>. In that sense a <span tag="MKIV" style="font-style:sans;">bibTEX</span> data­base database is of­ten often not coded neu­trallyneutrally. Some lim­i­ta­tionslimitations, like the use of com­mands commands to en­code ac­cented char­ac­ters encode accented characters root in the <span tag="MKIV" style="font-style:sans;">ascii</span> world and can be by­passed bypassed by us­ing using <span tag="MKIV" style="font-style:sans;">utf</span> in­stead instead (as han­dled some­what handled somewhat in <span tag="MKIV" style="font-style:sans;">LATEX</span> through ex­ten­sions extensions such as <tt style="color:rgb(0,102,102);font-size:100%;" >bibtex8</tt>).
<p></p>
The nor­mal normal way to deal with a bib­li­og­ra­phy bibliography is to re­fer refer to en­tries us­ing entries using a unique tag or key. When a list of en­tries entries is type­settypeset, this ref­er­ence reference can be used for link­ing pur­poseslinking purposes. The type­set typeset list can be processed and sorted us­ing using the <tt style="color:rgb(0,102,102);font-size:100%;" >bibtex</tt> pro­gram program that con­verts converts the data­base database into some­thing something more <span tag="MKIV" style="font-style:sans;">TEX</span> friendly (a <tt style="color:rgb(0,102,102);font-size:100%;" >.bbl</tt> file). I never used the pro­gram my­self program myself (nor bib­li­ogra­phiesbibliographies) so I will not go into too much de­tail detail here, if only be­cause because all I say can be wrong.
<p></p>
In <span tag="MKIV" style="font-style:sans;">ConTEXt</span> we no longer use the <tt style="color:rgb(0,102,102);font-size:100%;" >bibtex</tt> pro­gramprogram: we just use data­base database files and deal with the nec­es­sary ma­nip­u­la­tions di­rectly necessary manipulations directly in <span tag="MKIV" style="font-style:sans;">ConTEXt</span>. One or more such data­bases databases can be used and com­bined combined with ad­di­tional en­tries de­fined additional entries defined within the doc­u­mentdocument. We can have sev­eral several such datasets ac­tive active at the same time.
<p></p>
A <span tag="MKIV" style="font-style:sans;">bibTEX</span> file looks like this:
</pre>
<p></p>
Nor­mally Normally a value is given be­tween between quotes (or curly brack­etsbrackets) but sin­gle single words are also OK (there is no real ben­e­fit benefit in not us­ing using quotes, so we ad­vise advise to al­ways always use them). There can be many more fields and in­stead instead of strings one can use pre­de­fined short­cutspredefined shortcuts. The ti­tle title for ex­am­ple example quite of­ten con­tains often contains <span tag="MKIV" style="font-style:sans;">TEX</span> macros. Some fields, like <tt style="color:rgb(0,102,102);font-size:100%;" >pages</tt> have funny char­ac­ters characters such as the en­dash endash (typ­i­cally typically as <tt style="color:rgb(0,102,102);font-size:100%;" >--</tt>) so we have a mix­ture mixture of data and type­set­ting di­rec­tivestypesetting directives. If you are cov­er­ing covering non--eng­lish ref­er­encesenglish references, you of­ten often need char­ac­ters characters that are not in the <span tag="MKIV" style="font-style:sans;">ascii</span> sub­set subset but <span tag="MKIV" style="font-style:sans;">ConTEXt</span> is quite happy with <span tag="MKIV" style="font-style:sans;">utf</span>. If your data­base database file uses old-fash­ioned fashioned <span tag="MKIV" style="font-style:sans;">TEX</span> ac­cent com­mands accent commands then these will be in­ter­nally con­verted au­to­mat­i­cally internally converted automatically to <span tag="MKIV" style="font-style:sans;">utf</span>. Com­mands Commands (macros) are con­verted converted to an in­di­rect indirect call, which is quite ro­bustrobust.
<p></p>
The <span tag="MKIV" style="font-style:sans;">bibTEX</span> files are loaded in mem­ory memory as <span tag="MKIV" style="font-style:sans;">Lua</span> ta­ble table but can be con­verted converted to <span tag="MKIV" style="font-style:sans;">xml</span> so that we can ac­cess access them in a more flex­i­ble flexible way, but that is a sub­ject subject for spe­cial­istsspecialists.
<p></p>
In the old <span tag="MKIV" style="font-style:sans;">MkII</span> setup we have two kinds of en­triesentries: the ones that come from the <span tag="MKIV" style="font-style:sans;">bibTEX</span> run and user sup­plied supplied ones. We no longer rely on <span tag="MKIV" style="font-style:sans;">bibTEX</span> out­put output but we do still sup­port support the user sup­plied de­f­i­n­i­tionssupplied definitions. These were in fact pre­pared prepared in a way that suits the pro­cess­ing processing of <span tag="MKIV" style="font-style:sans;">bibTEX</span> gen­er­ated en­triesgenerated entries. The next vari­ant re­flects variant reflects the <span tag="MKIV" style="font-style:sans;">ConTEXt</span> re­cod­ing recoding of the old <span tag="MKIV" style="font-style:sans;">bibTEX</span> out­putoutput.
<pre style="color:rgb(102,0,102);font-size:100%">\startpublication[k=Hagen:Second,t=article,a={Hans Hagen},y=2013,s=HH01]
</pre>
<p></p>
The split <tt style="color:rgb(0,102,102);font-size:100%;" >\artauthor</tt> fields are col­lapsed collapsed into a sin­gle single <tt style="color:rgb(0,102,102);font-size:100%;" >author</tt> field as we deal with the split­ting splitting later when it gets parsed in <span tag="MKIV" style="font-style:sans;">Lua</span>. The <tt style="color:rgb(0,102,102);font-size:100%;" >\artauthor</tt> syn­tax syntax is only kept around for back­ward com­pat­i­bil­ity backward compatibility with the pre­vi­ous previous use of <span tag="MKIV" style="font-style:sans;">bibTEX</span>.
<p></p>
In the new setup we sup­port support these vari­ants variants as well:
<pre style="color:rgb(102,0,102);font-size:100%">\startpublication[k=Hagen:Third,t=article]
</pre>
<p></p>
Be­cause in­ter­nally Because internally the en­tries entries are <span tag="MKIV" style="font-style:sans;">Lua</span> ta­blestables, we also sup­port load­ing support loading of <span tag="MKIV" style="font-style:sans;">Lua</span> based de­f­i­n­i­tionsdefinitions:
<pre style="color:rgb(102,0,102);font-size:100%">return {
</pre>
<p></p>
Files set up like this can be loaded too. The fol­low­ing following <span tag="MKIV" style="font-style:sans;">xml</span> in­put input is rather close to this, and is also ac­cepted accepted as in­putinput.
<pre style="color:rgb(102,0,102);font-size:100%"><?xml version="2.0" standalone="yes" ?>
</pre>
<p></p>
Todo: Add some re­marks remarks about load­ing End­Note loading EndNote and RIS for­matsformats, but first we need to com­plete complete the tag map­ping mapping (on Alan’s plate).
<p></p>
So the user has a rather wide choice of for­mat­ting formatting style for bib­li­og­ra­phy data­base bibliography database files.
You can load more data than you ac­tu­ally actually need. Only en­tries entries that are re­ferred referred to ex­plic­itly explicitly through the <tt style="color:rgb(0,102,102);font-size:100%;" >\cite</tt> and <tt style="color:rgb(0,102,102);font-size:100%;" >\nocite</tt> com­mands commands will be shown in lists. We will cover these de­tails details later.
<h1>Com­mands Commands in en­triesentries</h1>
One un­for­tu­nate as­pect com­monly unfortunate aspect commonly found in <span tag="MKIV" style="font-style:sans;">bibTEX</span> files is that they of­ten con­tain often contain <span tag="MKIV" style="font-style:sans;">TEX</span> com­mandscommands. Even worse is that there is no stan­dard standard on what these com­mands commands can be and what they mean, at least not for­mallyformally, as <span tag="MKIV" style="font-style:sans;">bibTEX</span> is a pro­gram in­tended program intended to be used with many vari­ants variants of <span tag="MKIV" style="font-style:sans;">TEX</span> style: plain, <span tag="MKIV" style="font-style:sans;">LATEX</span>, and oth­ersothers. This means that we need to de­fine define our use of these type­set­ting com­mandstypesetting commands. How­everHowever, in most cases, they are just ab­bre­vi­a­tions abbreviations or font switches and these are of­ten often known. There­foreTherefore, <span tag="MKIV" style="font-style:sans;">ConTEXt</span> will try to re­solve resolve them be­fore re­port­ing before reporting an is­sueissue. In the log file there is a list of com­mands commands that has been seen in the loaded data­basesdatabases. For in­stanceinstance, load­ing loading <tt style="color:rgb(0,102,102);font-size:100%;" >tugboat.bib</tt> gives a long list of com­mands commands of which we show a small set here:
<pre style="color:rgb(102,0,102);font-size:100%">publications > start used btx commands
</pre>
<p></p>
You can de­fine un­known com­mandsdefine unknown commands, or over­load ex­ist­ing de­f­i­n­i­tions overload existing definitions in the fol­low­ing following way:
<pre style="color:rgb(102,0,102);font-size:100%">\definebtxcommand\TUB {TUGboat}
</pre>
<p></p>
Un­known com­mands Unknown commands do not stall pro­cess­ingprocessing, but their names are then type­set typeset in a mono- spaced font so they prob­a­bly probably stand out for proof­read­ingproofreading. You can ac­cess access the com­mands commands with <tt style="color:rgb(0,102,102);font-size:100%;" >\btxcommand{...}</tt>, as in:
<pre style="color:rgb(102,0,102);font-size:100%">commands like \btxcommand{MySpecialCommand} are handled in an indirect way
</pre>
<p></p>
As this is an un­de­fined com­mand undefined command we get: “com­mands “commands like MySpe­cial­Com­mand MySpecialCommand are han­dled handled in an in­di­rect indirect way”.
<p></p>
??
<h1>Datasets</h1>
Nor­mally Normally in a doc­u­ment document you will use only one bib­li­o­graphic data­basebibliographic database, whether or not dis­trib­uted distributed over mul­ti­ple multiple files. Nev­er­the­less Nevertheless we sup­port mul­ti­ple data­bases support multiple databases as well which is why we talk of datasets in­steadinstead. A dataset is loaded with the <tt style="color:rgb(0,102,102);font-size:100%;" >\usebtxdataset</tt> com­mandcommand. Al­though cur­rently Although currently it is not nec­es­sary necessary to de­fine define a (de­faultdefault) dataset you can best do this be­cause because in the fu­ture future we might pro­vide provide more op­tionsoptions. Here are some ex­am­plesexamples:
<pre style="color:rgb(102,0,102);font-size:100%">\definebtxdataset[standard]
</pre>
<p></p>
These three suf­fixes suffixes are un­der­stood understood by the loader. Here the dataset has the name <tt style="color:rgb(0,102,102);font-size:100%;" >standard</tt> and the three data­base database files are merged, where later en­tries hav­ing entries having the same tag over­load pre­vi­ous overload previous ones. De­f­i­n­i­tions Definitions in the doc­u­ment document source (coded in <span tag="MKIV" style="font-style:sans;">TEX</span> speak) are also added, and they are saved for suc­ces­sive successive runs. This means that if you load and de­fine en­triesdefine entries, they will be known at a next run be­fore­handbeforehand, so that ref­er­ences references to them are in­de­pen­dent independent of when load­ing loading and de­f­i­n­i­tions definitions take place.
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition setupbtxdataset </span >
</div>
<p></p>
In this doc­u­ment document we use some ex­am­ple data­basesexample databases, so let’s load one of them now:
<pre style="color:rgb(102,0,102);font-size:100%">\definebtxdataset[example]
</pre>
<p></p>
You can ask for an overview of en­tries entries in a dataset with:
<pre style="color:rgb(102,0,102);font-size:100%">\showbtxdatasetfields[example]
</pre>
<p></p>this gives:
<table>
<tr><td>tag</td><td>cat­e­gorycategory</td><td>fields</td></tr><tr><td>demo-001</td><td>book</td><td>au­thor in­dex ti­tle author index title year</td></tr><tr><td>demo-002</td><td>book</td><td>cross­ref in­dex crossref index year</td></tr><tr><td>demo-003</td><td>book</td><td>au­thor com­ment in­dex ti­tle author comment index title year</td></tr><tr><td>demo-004</td><td>book</td><td>au­thor com­ment in­dex ti­tle author comment index title year</td></tr><tr><td>demo-005</td><td>book</td><td>au­thor author doi in­dex index pages se­r­ial ti­tle serial title url year</td></tr>
</table>
<p></p>
You can set the cur­rent ac­tive current active dataset with
<pre style="color:rgb(102,0,102);font-size:100%">\setbtxdataset[standard]
</pre>
<p></p>
but most pub­li­ca­tionpublication-re­lated com­mands ac­cept op­tional ar­gu­ments related commands accept optional arguments that de­note denote the dataset and ref­er­ences references to en­tries entries can be pre­fixed prefixed with a dataset iden­ti­fieridentifier.. More about that later.<p></p>Sometimes you want to check a database. One way of doing that is the following: <pre style="color:rgb(102,0,102);font-size:100%">\definebtxdataset[check]\usebtxdataset[check][mkiv-publications-check.bib]\showbtxdatasetcompleteness[check]</pre><p></p>The database like like this:<p></p>The completeness check shows (with green field names) the required fields and when one is missing this is indicated in red. In blue we show what gets inherited.
<h1>Ren­der­ingsRenderings</h1>
A list of pub­li­ca­tions publications can be ren­dered rendered at any place in the doc­u­mentdocument. A data­base database can be much larger than needed for a doc­u­mentdocument. The same is true for the fields that make up an en­tryentry. Here is the list of fields that are cur­rently han­dledcurrently handled, but of course there can be ad­di­tional additional ones:
<p></p>
<tt style="color:rgb(0,102,102);font-size:100%;" >abstract</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >address</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >annotate</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >assignee</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >author</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >bibnumber</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >booktitle</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >chapter</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >comment</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >country</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >day</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >dayfiled</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >doi</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >edition</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >editor</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >eprint</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >howpublished</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >institution</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >isbn</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >issn</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >journal</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >key</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >keyword</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >keywords</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >language</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >lastchecked</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >month</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >monthfiled</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >names</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >nationality</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >note</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >notes</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >number</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >organization</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >pages</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >publisher</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >revision</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >school</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >series</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >size</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >title</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >type</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >url</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >volume</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >year</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >yearfiled</tt>
<p></p>
If you want to see what pub­li­ca­tions publications are in the data­basedatabase, the eas­i­est easiest way is to ask for a com­plete complete list:
<pre style="color:rgb(102,0,102);font-size:100%">\definebtxrendering
</pre>
<p></p>
This gives:1 Ha­genHagen, H. and Ot­tenOtten, T. (1996). Type­set­ting ed­u­ca­tion doc­u­mentsTypesetting education documents.2 Scarso, L. (2021). De­sign­ing Designing high speed trains.3 au­thor author (year). ti­tletitle. pages p.
<p></p>
The ren­der­ing it­self rendering itself is some­what com­plex somewhat complex to set up be­cause because we have not only many dif­fer­ent stan­dards different standards but also many fields that can be set up. This means that there are sev­eral com­mands in­volvedseveral commands involved. Of­ten Often there is a pre­scribed prescribed style to ren­der bib­li­o­graphic de­scrip­tionsrender bibliographic descriptions, for ex­am­ple example <tt style="color:rgb(0,102,102);font-size:100%;" >apa</tt>. A ren­der­ing rendering is setup and de­fined defined with:
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition setupbtxrendering </span >
</div>
<p></p>
And a list of such de­scrip­tions descriptions is gen­er­ated generated with:
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition placebtxrendering </span >
</div>
<p></p>
A dataset can have all kind of en­triesentries:
<p></p>
<tt style="color:rgb(0,102,102);font-size:100%;" >article</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >book</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >booklet</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >conference</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >inbook</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >incollection</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >inproceedings</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >manual</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >mastersthesis</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >misc</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >phdthesis</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >proceedings</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >techreport</tt>, <tt style="color:rgb(0,102,102);font-size:100%;" >unpublished</tt><p></p>Each has its own ren­der­ing vari­antrendering variant. To keep things sim­ple simple we have their set­tings sep­a­ratedsettings separated. How­everHowever, these set­tings settings are shared for all ren­der­ing al­ter­na­tivesrendering alternatives. In prac­tice practice this is sel­dom seldom a prob­lem problem in a pub­li­ca­tion publication as only one ren­der­ing al­ter­na­tive rendering alternative will be ac­tiveactive. If this be not suf­fi­cientsufficient, you can al­ways always group lo­cal set­tings local settings in a setup and hook that into the spe­cific ren­der­ingspecific rendering.
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition setupbtxlistvariant </span >
</div>
<p></p>
Ex­am­ples Examples of list vari­ants variants are:
<p></p>
<tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxlistvariant : artauthor</tt>
</table>
<p></p>
<tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxlistvariant : editor</tt>
<p></p>
The ex­act ren­der­ing exact rendering of list en­tries entries is de­ter­mined determined by the <tt style="color:rgb(0,102,102);font-size:100%;" >alternative</tt> key and de­faults defaults to <tt style="color:rgb(0,102,102);font-size:100%;" >apa</tt> which uses de­f­i­n­i­tions definitions from <tt style="color:rgb(0,102,102);font-size:100%;" >publ-imp-apa.mkiv</tt>. If you look at that file you will see that each cat­e­gory category has its own setup. You may also no­tice notice that ad­di­tional additional tests are needed to make sure that empty fields don’t trig­ger sep­a­ra­tors trigger separators and such.
<p></p>
There are a cou­ple couple of ac­ces­sors accessors and helpers to get the job done. When you want to fetch a field from the cur­rent en­try current entry you use <tt style="color:rgb(0,102,102);font-size:100%;" >\btxfield</tt>. In most cases you want to make sure this field has a value, for in­stance be­cause instance because you don’t want fences or punc­tu­a­tion punctuation that be­longs belongs to a field.
<pre style="color:rgb(102,0,102);font-size:100%">\btxdoif {title} {
</pre>
<p></p>
An ex­tra con­di­tional extra conditional is avail­able available for test­ing in­ter­ac­tiv­itytesting interactivity:
<pre style="color:rgb(102,0,102);font-size:100%">\btxdoifelseinteraction{action when true}{action when false}
</pre>
<p></p>
In ad­di­tion addition there is also a con­di­tional conditional <tt style="color:rgb(0,102,102);font-size:100%;" >\btxinteractive</tt> which is more ef­fi­cientefficient, al­though although in prac­tice ef­fi­ciency practice efficiency is not so im­por­tant important here.
<p></p>
There are three com­mands commands to flush data:
<table>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >\btxfield</tt></td><td>fetch a ex­plicit explicit field (e.g. <tt style="color:rgb(0,102,102);font-size:100%;" >year</tt>)</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >\btxdetail</tt></td><td>fetch a de­rived derived field (e.g. <tt style="color:rgb(0,102,102);font-size:100%;" >short</tt>)</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >\btxflush</tt></td><td>fetch a de­rived derived or ex­plicit explicit field</td></tr>
</table>
<p></p>
Nor­mally Normally you can use <tt style="color:rgb(0,102,102);font-size:100%;" >\btxfield</tt> or <tt style="color:rgb(0,102,102);font-size:100%;" >\btxflush</tt> as de­rived derived fields just like an­a­lyzed au­thor analyzed author fields are flushed in a spe­cial special way.
<p></p>
You can im­prove read­abil­ity improve readability by us­ing se­tupsusing setups, for in­stanceinstance:
<pre style="color:rgb(102,0,102);font-size:100%">\btxdoifelse {author} {
</pre>
<p></p>
Keep in mind that nor­mally normally you don’t need to mess with de­f­i­n­i­tions definitions like this be­cause stan­dard ren­der­ing because standard rendering styles are pro­videdprovided. These styles use a few helpers that in­ject sym­bols inject symbols but also take care of lead­ing leading and trail­ing trailing spaces:
<table>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >\btxspace</tt></td><td>be­fore af­terbefore after</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >\btxperiod</tt></td><td>be­forebefore. af­terafter</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >\btxcomma</tt></td><td>be­forebefore, af­terafter</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >\btxlparent</tt></td><td>be­fore before (af­terafter</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >\btxrparent</tt></td><td>be­forebefore) af­terafter</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >\btxlbracket</tt></td><td>be­fore before [af­terafter</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >\btxrbracket</tt></td><td>be­forebefore] af­terafter</td></tr>
</table>
<p></p>
So, the pre­vi­ous ex­am­ple previous example setup can be rewrit­ten rewritten as:
<pre style="color:rgb(102,0,102);font-size:100%">\btxdoif {title} {
</pre>
<p></p>
There is a spe­cial com­mand special command for ren­der­ing rendering a (com­bi­na­tioncombination) of au­thorsauthors:
<pre style="color:rgb(102,0,102);font-size:100%">\btxflushauthor{author}
</pre>
<p></p>
In­stead Instead of the last one you can also use:
<pre style="color:rgb(102,0,102);font-size:100%">\btxflushauthorinverted{editor}
</pre>
<p></p>
You can use a (con­fig­urableconfigurable) de­fault default or pass di­rec­tivesdirectives: Valid di­rec­tives directives are
<table>
<tr><td>con­ver­sionconversion</td><td>ren­der­ingrendering</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >inverted</tt></td><td>the Frog jr, Ker­mitKermit</td></tr>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >invertedshort</tt></td><td>the Frog jr, K</td></tr>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >normal</tt></td><td>Ker­mitKermit, the Frog, jr</td></tr>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >normalshort</tt></td><td>K, the Frog, jr</td></tr>
</table>
<h1>Ci­ta­tionsCitations</h1>
Ci­ta­tions Citations are ref­er­ences references to bib­li­o­graphic en­tries bibliographic entries that nor­mally normally show up in lists some­place someplace in the doc­u­mentdocument: at the end of a chap­terchapter, in an ap­pen­dixappendix, at the end of an ar­ti­clearticle, etc. We dis­cussed discussed the ren­der­ing rendering of these lists in the pre­vi­ous chap­terprevious chapter. A ci­ta­tion citation is nor­mally normally pretty short as its main pur­pose purpose is to re­fer refer uniquely to a more de­tailed de­scrip­tiondetailed description. But, there are sev­eral several ways to re­ferrefer, which is why the ci­ta­tion sub­sys­tem citation subsystem is con­fig­urable configurable and ex­ten­si­bleextensible. Just look at the fol­low­ing com­mandsfollowing commands:
<pre style="color:rgb(102,0,102);font-size:100%">\cite[author][example::demo-003]
</pre>
<divli>:<ul>(Hans Ha­gen Hagen and Ton Ot­tenOtten)</ul>:<ul>(Hans Ha­gen Hagen and Ton Ot­ten Otten (1996))</ul>:<ul>(Hans Ha­gen Hagen and Ton Ot­tenOtten, 1996)</ul>:<ul>(Hans Ha­gen Hagen and Ton Ot­tenOtten, Luigi Scarso)</ul>:<ul>(Hans Ha­gen Hagen and Ton Ot­ten Otten (1996), Luigi Scarso (2021))</ul>:<ul>(Hans Ha­gen Hagen and Ton Ot­tenOtten, 1996, Luigi Scarso, 2021)</ul>:<ul>(Luigi Scarso, Hans Ha­gen Hagen and Ton Ot­tenOtten)</ul>:<ul>(Luigi Scarso (2021), Hans Ha­gen Hagen and Ton Ot­ten Otten (1996))</ul>:<ul>(Luigi Scarso, 2021, Hans Ha­gen Hagen and Ton Ot­tenOtten, 1996)</ul></divli
<p></p>
The first ar­gu­ment argument is op­tionaloptional.
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition cite </span >
</div>
<p></p>
You can tune the way a ci­ta­tion citation shows up:
<pre style="color:rgb(102,0,102);font-size:100%">\setupbtxcitevariant[author] [sorttype=author,color=darkyellow]
</pre>
<p></p>
Here we sort the au­thors authors and color the ci­ta­tioncitation:
<divli>:<ul>(Hans Ha­gen Hagen and Ton Ot­tenOtten, Luigi Scarso)</ul>:<ul>(Hans Ha­gen Hagen and Ton Ot­ten Otten (1996), Luigi Scarso (2021))</ul>:<ul>(Hans Ha­gen Hagen and Ton Ot­tenOtten, 1996, Luigi Scarso, 2021)</ul></divli
<p></p>
For rea­sons reasons of back­ward com­pat­i­bil­ity backward compatibility the <tt style="color:rgb(0,102,102);font-size:100%;" >\cite</tt> com­mand command is a bit picky about spaces be­tween between the two ar­gu­mentsarguments, of which the first is op­tionaloptional. This is a con­se­quence consequence of al­low­ing allowing its use with the key spec­i­fied be­tween specified between curly brack­ets brackets as is the tra­di­tional prac­ticetraditional practice. (We do en­cour­age encourage users to adopt the more co­her­ent coherent <span tag="MKIV" style="font-style:sans;">ConTEXt</span> syn­tax syntax by us­ing using square brack­ets brackets for key­words keywords and re­serv­ing reserving curly brack­ets brackets to re­group regroup text to be type­settypeset.)
<p></p>
The <tt style="color:rgb(0,102,102);font-size:100%;" >\citation</tt> com­mand command is syn­ony­mous synonymous but is more flex­i­ble flexible with re­spect respect to spac­ing spacing of its ar­gu­mentsarguments:
<pre style="color:rgb(102,0,102);font-size:100%">\citation[author] [example::demo-004,demo-003]
</pre>
<p></p>
There is a whole bunch of cite op­tions options and more can be eas­ily de­finedeasily defined.
<table>
<tr><td>key</td><td>ren­der­ingrendering</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >author</tt></td><td>(au­thorauthor)</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >authornum</tt></td><td>[au­thor author [btx er­ror error 1]]</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >authoryear</tt></td><td>(au­thor author (year))</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >authoryears</tt></td><td>(au­thorauthor, year)</td></tr>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >doi</tt></td><td>[todo: doi]</td></tr>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >key</tt></td><td>[demo-005]</td></tr>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >none</tt></td><td></td></tr>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >num</tt></td><td>[[btx er­ror error 1]]</td></tr>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >page</tt></td><td>pages</td></tr>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >serial</tt></td><td>[5]</td></tr>
<p></p>
Be­cause Because we are deal­ing dealing with data­base in­put database input and be­cause because we gen­er­ally generally need to ma­nip­u­late en­triesmanipulate entries, much of the work is del­e­gated delegated to <span tag="MKIV" style="font-style:sans;">Lua</span>. This makes it eas­ier easier to main­tain maintain and ex­tend extend the code. Of course <span tag="MKIV" style="font-style:sans;">TEX</span> still does the ren­der­ingrendering. The ty­po­graphic de­tails typographic details are con­trolled controlled by pa­ra­me­ters parameters but not all are used in all vari­antsvariants. As with most <span tag="MKIV" style="font-style:sans;">ConTEXt</span> com­mandscommands, it starts out with a gen­eral general setup com­mandcommand:
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition setupbtxcitevariant </span >
</div>
<p></p>
On top of that we can de­fine in­stances define instances that in­herit ei­ther inherit either from a given par­ent parent or from the top­most topmost setup.
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition definebtxcitevariant </span >
</div>
<p></p>
But, spe­cific vari­ants specific variants can have them over­loadedoverloaded:
<p></p>
<tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : author</tt>
</table>
A ci­ta­tion vari­ant citation variant is de­fined defined in sev­eral several steps and if you re­ally really want to know the dirty de­tailsdetails, you should look into the <tt style="color:rgb(0,102,102);font-size:100%;" >publ-imp-*.mkiv</tt> files. Here we stick to the con­ceptconcept.
<pre style="color:rgb(102,0,102);font-size:100%">\startsetups btx:cite:author
</pre>
<p></p>
You can over­load overload such se­tups setups if needed, but that only makes sense when you can­not con­fig­ure cannot configure the ren­der­ing rendering with pa­ra­me­tersparameters. The <tt style="color:rgb(0,102,102);font-size:100%;" >\btxcitevariant</tt> com­mand command is one of the build in ac­ces­sors accessors and it calls out to <span tag="MKIV" style="font-style:sans;">Lua</span> where more com­plex ma­nip­u­la­tion complex manipulation takes place if needed. If no ma­nip­u­la­tion manipulation is known, the field with the same name (if found) will be flushed. A com­mand command like <tt style="color:rgb(0,102,102);font-size:100%;" >\btxcitevariant</tt> as­sumes assumes that a dataset and spe­cific specific tag has been set. This is nor­mally normally done in the wrap­per wrapper macros, like <tt style="color:rgb(0,102,102);font-size:100%;" >\cite</tt>. For spe­cial pur­poses special purposes you can use these com­mands commands
<pre style="color:rgb(102,0,102);font-size:100%">\setbtxdataset[example]
</pre>
<p></p>
But don’t ex­pect expect too much sup­port support for such low level ren­der­ing con­trolrendering control.
<p></p>
Un­less Unless you use <tt style="color:rgb(0,102,102);font-size:100%;" >criterium=all</tt> only pub­li­ca­tions publications that are cited will end up in the lists. You can force a ci­ta­tion citation into a list us­ing using <tt style="color:rgb(0,102,102);font-size:100%;" >\usecitation</tt>, for ex­am­pleexample:
<pre style="color:rgb(102,0,102);font-size:100%">\usecitation[example::demo-004,demo-003]
</pre>
<p></p>
This com­mand command has two syn­onymssynonyms: <tt style="color:rgb(0,102,102);font-size:100%;" >\nocite</tt> and <tt style="color:rgb(0,102,102);font-size:100%;" >\nocitation</tt> so you can choose what­ever whatever fits you best.
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition nocite </span >
<h1>The LUA view</h1>
Be­cause Because we man­age manage data at the <span tag="MKIV" style="font-style:sans;">Lua</span> end it is tempt­ing tempting to ac­cess access it there for other pur­posespurposes. This is fine as long as you keep in mind that as­pects aspects of the im­ple­men­ta­tion implementation may change over time, al­though although this is un­likely unlikely once the mod­ules be­come sta­blemodules become stable.
<p></p>
The en­tries entries are col­lected collected in datasets and each set has a unique name. In this doc­u­ment document we have the set named <tt style="color:rgb(0,102,102);font-size:100%;" >example</tt>. A dataset ta­ble table has sev­eral several fields, and prob­a­bly probably the one of most in­ter­est interest is the <tt style="color:rgb(0,102,102);font-size:100%;" >luadata</tt> field. Each en­try entry in this ta­ble de­scribes table describes a pub­li­ca­tionpublication:
<pre style="color:rgb(102,0,102);font-size:100%">t={
}
</pre>
This is <tt style="color:rgb(0,102,102);font-size:100%;" >publications.datasets.example.luadata["demo-001"]</tt>. There can be a com­pan­ion en­try companion entry in the par­al­lel parallel <tt style="color:rgb(0,102,102);font-size:100%;" >details</tt> ta­bletable.
<pre style="color:rgb(102,0,102);font-size:100%">t={
}
</pre>
These de­tails details are ac­cessed accessed as <tt style="color:rgb(0,102,102);font-size:100%;" >publications.datasets.example.details["demo-001"]</tt> and by us­ing using a sep­a­rate ta­ble separate table we can over­load overload fields in the orig­i­nal en­try with­out los­ing original entry without losing the orig­i­naloriginal.
<p></p>
You can loop over the en­tries us­ing reg­u­lar entries using regular <span tag="MKIV" style="font-style:sans;">Lua</span> code com­bined combined with <span tag="MKIV" style="font-style:sans;">MkIV</span> helpers:
<pre style="color:rgb(102,0,102);font-size:100%">local dataset = publications.datasets.example
</pre>
<p></p>
This re­sults results in:
<table>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >demo-001</tt></td><td>Hag13</td><td><span tag="MKIV" style="font-style:sans;">bibTEX</span>, the <span tag="MKIV" style="font-style:sans;">ConTEXt</span> way</td></tr>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >demo-002</tt></td><td>Hag14</td><td><span tag="MKIV" style="font-style:sans;">bibTEX</span>, the <span tag="MKIV" style="font-style:sans;">ConTEXt</span> way</td></tr>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >demo-003</tt></td><td>HO96</td><td>Type­set­ting ed­u­ca­tion doc­u­mentsTypesetting education documents</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >demo-004</tt></td><td>Sca21</td><td>De­sign­ing Designing high speed trains</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >demo-005</tt></td><td>aut00</td><td>ti­tletitle</td></tr>
</table>
<p></p>
You can ma­nip­u­late manipulate a dataset af­ter load­ingafter loading. Of course this as­sumes assumes that you know what kind of con­tent content you have and what you need for ren­der­ingrendering. As ex­am­ple example we load a small dataset.
<pre style="color:rgb(102,0,102);font-size:100%">\definebtxdataset[drumming]
</pre>
<p></p>
Be­cause Because we’re go­ing going to do some <span tag="MKIV" style="font-style:sans;">Lua</span>, we could also have loaded the dataset with:
<pre style="color:rgb(102,0,102);font-size:100%">publications.load("drumming","mkiv-publications.lua","lua")
</pre>
<p></p>
The dataset has three en­triesentries:
<p></p>
As you can see, we can have a sub­ti­tlesubtitle. We will com­bine combine the ti­tle title and sub­ti­tle subtitle into one:
<pre style="color:rgb(102,0,102);font-size:100%">\startluacode
</pre>
<p></p>
We can now type­set typeset the en­tries entries with:
<pre style="color:rgb(102,0,102);font-size:100%">\definebtxrendering[drumming][dataset=drumming,method=dataset]
</pre>
<p></p>
Be­cause Because we just want to show the en­triesentries, and have no ci­ta­tions citations that force them to be shown, we have to the <tt style="color:rgb(0,102,102);font-size:100%;" >method</tt> to <tt style="color:rgb(0,102,102);font-size:100%;" >dataset</tt>.1
<h1>The XML view</h1>
The <tt style="color:rgb(0,102,102);font-size:100%;" >luadata</tt> ta­ble table can be con­verted converted into an <span tag="MKIV" style="font-style:sans;">xml</span> rep­re­sen­ta­tionrepresentation. This is a fol­low follow up on ear­lier ex­per­i­ments earlier experiments with an <span tag="MKIV" style="font-style:sans;">xml</span>-only ap­proachapproach. I de­cided decided in the end to stick to a <span tag="MKIV" style="font-style:sans;">Lua</span> ap­proach approach and pro­vide provide some sim­ple simple <span tag="MKIV" style="font-style:sans;">xml</span> sup­port support in ad­di­tionaddition.
<p></p>
Once a dataset is ac­ces­si­ble accessible as <span tag="MKIV" style="font-style:sans;">xml</span> tree, you can use the reg­u­lar regular <tt style="color:rgb(0,102,102);font-size:100%;" >\xml...</tt> com­mandscommands. We start with load­ing loading a dataset, in this case from just one file.
<pre style="color:rgb(102,0,102);font-size:100%">\usebtxdataset[tugboat][tugboat.bib]
</pre>
<p></p>
The dataset has to be con­verted converted to <span tag="MKIV" style="font-style:sans;">xml</span>:
<pre style="color:rgb(102,0,102);font-size:100%">\convertbtxdatasettoxml[tugboat]
</pre>
<p></p>
The tree is now ac­ces­si­ble accessible by its root ref­er­ence reference <tt style="color:rgb(0,102,102);font-size:100%;" >btx:tugboat</tt>. If we want sim­ple simple field ac­cess access we can use a few se­tupssetups:
<pre style="color:rgb(102,0,102);font-size:100%">\startxmlsetups btx:initialize
</pre>
<p></p>
The two se­tups setups are pre­de­fined predefined in the core al­readyalready, but you might want to change them. They are ap­plied applied in for in­stanceinstance:
<pre style="color:rgb(102,0,102);font-size:100%">\starttabulate[|||]
<table>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >tag</tt></td><td>Ha­genHagen:TB17-1-54</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >title</tt></td><td>PPCHTEX: type­set­ting chem­i­cal for­mu­las typesetting chemical formulas in TEX</td></tr>
</table>
<table>
<tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >tag</tt></td><td>Ha­genHagen:TB17-1-54</td></tr><tr><td><tt style="color:rgb(0,102,102);font-size:100%;" >title</tt></td><td>PPCHTEX: type­set­ting chem­i­cal for­mu­las typesetting chemical formulas in TEX</td></tr>
</table>
<p></p>
Here is an­other ex­am­pleanother example:
<pre style="color:rgb(102,0,102);font-size:100%">\startxmlsetups btx:row
<table>
<tr><td>Knuth:TB10-1-31</td><td>Type­set­ting Con­crete Math­e­mat­icsTypesetting Concrete Mathematics</td></tr><tr><td>Knuth:TB10-1-8</td><td>TEX would find it dif­fi­cult difficult …</td></tr><tr><td>Knuth:TB10-3-325</td><td>The new ver­sions versions of TEX and MF</td></tr><tr><td>Knuth:TB10-4-529</td><td>The er­rors errors of TEX</td></tr><tr><td>Knuth:TB11-1-13</td><td>Vir­tual Virtual Fonts: More Fun for Grand Wiz­ardsWizards</td></tr><tr><td>Knuth:TB11-2-165</td><td>Ex­er­cises Exercises for TEX: The Pro­gramProgram</td></tr><tr><td>Knuth:TB11-4-489</td><td>The fu­ture future of TEX and MF</td></tr>
<tr><td>Knuth:TB11-4-497</td><td>Arthur Lee Samuel, 1901--1990</td></tr>
<tr><td>Knuth:TB11-4-499</td><td>An­swers Answers to Ex­er­cises Exercises for TEX: The Pro­gramProgram</td></tr><tr><td>Knuth:TB12-2-313</td><td>Fixed-point glue set­tingsetting: Er­rataErrata</td></tr>
<tr><td>Knuth:TB14-4-387</td><td>Icons for TEX and MF</td></tr>
<tr><td>Knuth:TB17-1-29</td><td>Im­por­tant mes­sage re­gard­ing Important message regarding CM fonts</td></tr><tr><td>Knuth:TB2-3-5</td><td>The cur­rent current state of things</td></tr><tr><td>Knuth:TB3-1-10</td><td>Fixed-point glue set­ting­Dash an ex­am­ple settingDashan example of WEB</td></tr><tr><td>Knuth:TB31-2-121</td><td>An Earth­shak­ing An­nounce­mentEarthshaking Announcement</td></tr><tr><td>Knuth:TB4-2-64</td><td>A note on hy­phen­ationhyphenation</td></tr><tr><td>Knuth:TB5-1-4</td><td>TEX in­cunab­ulaincunabula</td></tr><tr><td>Knuth:TB5-1-67</td><td>Com­ments Comments on qual­ity quality in pub­lish­ingpublishing</td></tr><tr><td>Knuth:TB5-2-105</td><td>A course on MF pro­gram­mingprogramming</td></tr><tr><td>Knuth:TB6-1-36</td><td>Recipes and frac­tionsfractions</td></tr><tr><td>Knuth:TB7-2-101</td><td>The TEX logo in var­i­ous various fonts</td></tr><tr><td>Knuth:TB7-2-95</td><td>Re­marks Remarks to cel­e­brate celebrate the pub­li­ca­tion publication of Com­put­ers Computers & Type­set­tingTypesetting</td></tr><tr><td>Knuth:TB8-1-14</td><td>Mix­ing Mixing right-to-left texts with left-to-right texts</td></tr><tr><td>Knuth:TB8-1-6</td><td>It hap­penedhappened: an­nounce­ment announcement of TEX 2.1</td></tr><tr><td>Knuth:TB8-1-73</td><td>Prob­lem Problem for a Sat­ur­day af­ter­noonSaturday afternoon</td></tr><tr><td>Knuth:TB8-2-135</td><td>Fonts for dig­i­tal digital halftones</td></tr><tr><td>Knuth:TB8-2-210</td><td>Sat­ur­day morn­ing prob­lem­Dash so­lu­tionSaturday morning problemDashsolution</td></tr><tr><td>Knuth:TB8-2-217</td><td>Re­plyReply: Print­ing Printing out se­lected selected pages</td></tr>
<tr><td>Knuth:TB8-3-309</td><td>Macros for Jill</td></tr>
<tr><td>Knuth:TB9-2-152</td><td>A Punk Meta-Font</td></tr>
<p></p>
A more ex­ten­sive ex­am­ple extensive example is the fol­low­ingfollowing. Of course this as­sumes assumes that you know what <span tag="MKIV" style="font-style:sans;">xml</span> sup­port mech­a­nisms support mechanisms and macros are avail­ableavailable.
<pre style="color:rgb(102,0,102);font-size:100%">\startxmlsetups btx:getkeys
<table>
<tr><td>1984</td><td>Knuth:TB5-1-67</td><td>Don Knuth</td></tr>
<tr><td>1984</td><td>Knuth:TB5-1-4</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1984</td><td>Knuth:TB5-2-105</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1985</td><td>Knuth:TB6-1-36</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1986</td><td>Knuth:TB7-2-101</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1987</td><td>Knuth:TB8-2-135</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1987</td><td>Knuth:TB8-3-309</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1988</td><td>Knuth:TB9-2-152</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1989</td><td>Knuth:TB10-3-325</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1989</td><td>Knuth:TB10-4-529</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1990</td><td>Knuth:TB11-4-489</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1993</td><td>Knuth:TB14-4-387</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1996</td><td>Knuth:TB17-1-29</td><td>Don­ald Donald E. Knuth</td></tr><tr><td>1987</td><td>Knuth:TB8-1-14</td><td>Don­ald Donald Knuth and Pierre MacKay</td></tr><tr><td>1981</td><td>Knuth:TB2-3-5</td><td>Don­ald Donald Knuth</td></tr><tr><td>1982</td><td>Knuth:TB3-1-10</td><td>Don­ald Donald Knuth</td></tr><tr><td>1983</td><td>Knuth:TB4-2-64</td><td>Don­ald Donald Knuth</td></tr><tr><td>1986</td><td>Knuth:TB7-2-95</td><td>Don­ald Donald Knuth</td></tr><tr><td>1987</td><td>Knuth:TB8-1-6</td><td>Don­ald Donald Knuth</td></tr><tr><td>1987</td><td>Knuth:TB8-1-73</td><td>Don­ald Donald Knuth</td></tr><tr><td>1987</td><td>Knuth:TB8-2-210</td><td>Don­ald Donald Knuth</td></tr><tr><td>1987</td><td>Knuth:TB8-2-217</td><td>Don­ald Donald Knuth</td></tr><tr><td>1989</td><td>Knuth:TB10-1-8</td><td>Don­ald Donald Knuth</td></tr><tr><td>1989</td><td>Knuth:TB10-1-31</td><td>Don­ald Donald Knuth</td></tr><tr><td>1990</td><td>Knuth:TB11-1-13</td><td>Don­ald Donald Knuth</td></tr><tr><td>1990</td><td>Knuth:TB11-2-165</td><td>Don­ald Donald Knuth</td></tr><tr><td>1990</td><td>Knuth:TB11-4-497</td><td>Don­ald Donald Knuth</td></tr><tr><td>1990</td><td>Knuth:TB11-4-499</td><td>Don­ald Donald Knuth</td></tr><tr><td>1991</td><td>Knuth:TB12-2-313</td><td>Don­ald Donald Knuth</td></tr><tr><td>2010</td><td>Knuth:TB31-2-121</td><td>Don­ald Donald Knuth</td></tr>
</table>
<p></p>
The orig­i­nal original data is stored in a <span tag="MKIV" style="font-style:sans;">Lua</span> ta­bletable, hashed by tag. Start­ing Starting with <span tag="MKIV" style="font-style:sans;">Lua</span> 5.2 each run of <span tag="MKIV" style="font-style:sans;">Lua</span> gets a dif­fer­ent or­der­ing different ordering of such a hash. In older ver­sionsversions, when you looped over a hash, the or­der order was un­de­finedundefined, but the same as long as you used the same bi­narybinary. This had the ad­van­tage advantage that suc­ces­sive successive runs, some­thing something we of­ten often have in doc­u­ment pro­cess­ing document processing gave con­sis­tent re­sultsconsistent results. In to­day’s today’s <span tag="MKIV" style="font-style:sans;">Lua</span> we need to do much more sort­ing sorting of hashes be­fore before we loop, es­pe­cially especially when we save multi--pass data. It is for this rea­son reason that the <span tag="MKIV" style="font-style:sans;">xml</span> tree is sorted by hash key by de­faultdefault. That way lookups (es­pe­cially especially the first of a set) give con­sis­tent out­comesconsistent outcomes.
<h1>Stan­dardsStandards</h1>
The ren­der­ing rendering of bib­li­o­graphic en­tries bibliographic entries is of­ten stan­dard­ized often standardized and pre­scribed prescribed by the pub­lisherpublisher. If you sub­mit submit an ar­ti­cle article to a jour­naljournal, nor­mally normally it will be re­for­mat­ted reformatted (or even re- keyed) and the ren­der­ing rendering will hap­pen happen at the pub­lish­ers publishers end. In that case it may not mat­ter matter how en­tries entries were ren­dered rendered when writ­ing writing the pub­li­ca­tionpublication, be­cause because the pub­lisher publisher will do it his or her way. This means that most users prob­a­bly probably will stick to the stan­dard standard <span tag="MKIV" style="font-style:sans;">apa</span> rules and for them we pro­vide provide some con­fig­u­ra­tionconfiguration. Be­cause Because we use se­tups setups it is easy to over­load overload specifics. If you re­ally really want to tweak, best look in the files that deal with it.
<p></p>
Many stan­dards ex­ist standards exist and sup­port support for other ren­der­ings renderings may be added to the core. In­ter­ested Interested users are in­vited invited to de­velop develop and to test al­ter­nate stan­dard ren­der­ings ac­cord­ing alternate standard renderings according to their needs.
<p></p>
Todo: maybe a list of cat­e­gories categories and fields.
<h1>Clean­ing Cleaning up</h1>
Al­though Although the <span tag="MKIV" style="font-style:sans;">bibTEX</span> for­mat format is rea­son­ably reasonably well de­fineddefined, in prac­tice practice there are many ways to or­ga­nize organize the data. For in­stanceinstance, one can use pre­de­fined predefined string con­stants constants that get used (ei­ther either or not com­bined combined with other strings) later on. A string can be en­closed enclosed in curly braces or dou­ble double quotes. The strings can con­tain contain <span tag="MKIV" style="font-style:sans;">TEX</span> com­mands commands but these are not stan­dard­izedstandardized. The data­bases of­ten databases often have some­what com­plex somewhat complex ways to deal with spe­cial char­ac­ters special characters and the use of braces in their de­f­i­n­i­tion definition is also not nor­mal­izednormalized.
<p></p>
The most com­plex complex to deal with are the fields that con­tain contain names of peo­plepeople. At some point it might be needed to split a com­bi­na­tion combination of names into in­di­vid­ual individual ones that then get split into ti­tletitle, first name, op­tional in­be­tweensoptional inbetweens, sur­namesurname(s) and ad­di­tionaladditional: <tt style="color:rgb(0,102,102);font-size:100%;" >Prof. Dr. Alfred B. C. von Kwik Kwak Jr. II and P. Q. Olet</tt> is just one ex­am­ple example of this. The con­ven­tion convention seems to be not to use com­mas commas but <tt style="color:rgb(0,102,102);font-size:100%;" >and</tt> to sep­a­rate separate names (of­ten often each name will be spec­i­fied specified as last­namelastname, first­namefirstname).
<p></p>
We don’t see it as chal­lenge challenge nor as a duty to sup­port support all kinds of messy de­f­i­n­i­tionsdefinitions. Of course we try to be some­what tol­er­antsomewhat tolerant, but you will be sure to get bet­ter re­sults better results if you use nicely setup, con­sis­tent data­basesconsistent databases.
<p></p>
Todo: maybe some ex­am­ples examples of bad.
<h1>Tran­si­tionTransition</h1>
In the orig­i­nal bib­li­og­ra­phy sup­port mod­ule us­age original bibliography support module usage was as fol­lows follows (ex­am­ple example taken from the con­textgar­den contextgarden wiki):
<pre style="color:rgb(102,0,102);font-size:100%">% engine=pdftex
</pre>
<p></p>
For <span tag="MKIV" style="font-style:sans;">MkIV</span> the mod­ules modules were partly rewrit­ten rewritten and ended up in the core so the two com­mands commands were no longer needed. The over­head as­so­ci­ated overhead associated with the au­to­matic load­ing automatic loading of the bib­li­og­ra­phy bibliography macros can be ne­glected neglected these days, so stan­dard­ized mod­ules standardized modules such as <tt style="color:rgb(0,102,102);font-size:100%;" >bib</tt> are all be­ing being moved to the core and do not need to be ex­plic­itly explicitly loaded.
<p></p>
The first <tt style="color:rgb(0,102,102);font-size:100%;" >\setupbibtex</tt> com­mand command in this ex­am­ple example is needed to boot­strap bootstrap the process: it tells what data­base database has to be processed by <span tag="MKIV" style="font-style:sans;">bibTEX</span> be­tween between runs. The sec­ond second <tt style="color:rgb(0,102,102);font-size:100%;" >\setuppublications</tt> com­mand command is op­tionaloptional. Each ci­ta­tion citation (tagged with <tt style="color:rgb(0,102,102);font-size:100%;" >\cite</tt>) ends up in the list of pub­li­ca­tionspublications.
<p></p>
In the new ap­proach approach we no longer use <span tag="MKIV" style="font-style:sans;">bibTEX</span>so we don’t need to setup <span tag="MKIV" style="font-style:sans;">bibTEX</span>. In­stead Instead we de­fine define dataset(s). We also no longer set up pub­li­ca­tions publications with one com­mandcommand, but have split that up in ren­der­ingrendering-, list-, and cite-vari­antsvariants. The ba­sic basic <tt style="color:rgb(0,102,102);font-size:100%;" >\cite</tt> com­mand re­mainscommand remains. The above ex­am­ple be­comesexample becomes:
<pre style="color:rgb(102,0,102);font-size:100%">\definebtxdataset
</pre>
<p></p>
So, we have a few more com­mands commands to set up things. If you in­tend intend to use just a sin­gle single dataset and ren­der­ingrendering, the above pre­am­ble preamble can be sim­pli­fied simplified to:
<pre style="color:rgb(102,0,102);font-size:100%">\usebtxdataset
</pre>
<p></p>
But keep in mind that com­pared compared to the old <span tag="MKIV" style="font-style:sans;">MkII</span> de­rived derived method we have moved some of the op­tions options to the ren­der­ingrendering, list and cite setup vari­antsvariants.
<p></p>
An­other dif­fer­ence Another difference is now the use of lists. When you de­fine define a ren­der­ingrendering, you also de­fine define a list. How­everHowever, all en­tries entries are col­lected collected in a com­mon common list tagged <tt style="color:rgb(0,102,102);font-size:100%;" >btx</tt>. Al­though Although you will nor­mally con­fig­ure normally configure a ren­der­ing rendering you can still set some prop­er­ties properties of lists, but in that case you need to pre­fix prefix the list iden­ti­fieridentifier. In the case of the above ex­am­ple example this is <tt style="color:rgb(0,102,102);font-size:100%;" >btx:document</tt>.
<h1>ML­BIBTEXMLBIBTEX</h1>
Todo: how to plug in <span tag="MKIV" style="font-style:sans;">ML­bibTEXMLbibTEX</span> for sort­ing sorting and other ad­vanced op­er­a­tionsadvanced operations.
<h1>Ex­ten­sionsExtensions</h1>
As <span tag="MKIV" style="font-style:sans;">TEX</span> and <span tag="MKIV" style="font-style:sans;">Lua</span> are both open and ac­ces­si­ble accessible in <span tag="MKIV" style="font-style:sans;">ConTEXt</span> it is pos­si­ble possible to ex­tend extend the func­tion­al­ity functionality of the bib­li­og­ra­phy re­lated bibliography related code. For in­stanceinstance, you can add ex­tra load­ersextra loaders.
<pre style="color:rgb(102,0,102);font-size:100%">function publications.loaders.myformat(dataset,filename)
</pre>
<p></p>
This then per­mits load­ing permits loading a data­base database (into a dataset) with the com­mandcommand:
<pre style="color:rgb(102,0,102);font-size:100%">\usebtxdataset[standard][myfile.myformat]
</pre>
<p></p>
The <tt style="color:rgb(0,102,102);font-size:100%;" >myformat</tt> suf­fix suffix is rec­og­nized au­to­mat­i­callyrecognized automatically. If you want to use an­other suf­fixanother suffix, you can do this:
<pre style="color:rgb(102,0,102);font-size:100%">\usebtxdataset[standard][myformat::myfile.txt]
</pre>
<h1>Notes</h1>
 
The move from external <span tag="MKIV" style="font-style:sans;">bibTEX</span> processing to internal processing has the advantage that we stay within the same run. In the traditional approach we had roughly the following steps:
<div >
 
<div >
 
<span>• </span>
<span>the first run information is collected and written to file</span>
</div>
 
<div >
 
<span>• </span>
<span>after that run the <span tag="MKIV" style="font-style:sans;">bibTEX</span> program converts that file to another one</span>
</div>
 
<div >
 
<span>• </span>
<span>successive runs use that data for references and producing lists</span>
</div>
 
</div>
 
<p></p>
In the <span tag="MKIV" style="font-style:sans;">MkIV</span> approach the bibliographic database is loaded in memory each run and processing also happens each run. On paper this looks less efficient but as <span tag="MKIV" style="font-style:sans;">Lua</span> is quite fast, in practice performance is much better.
<p></p>
Probably most demanding is the treatment of authors as we have to analyze names, split multiple authors and reassemble firstnames, vons, surnames and juniors. When we sort by author sorting vectors have to be made which also has a penalty. However, in practice the user will not notice a performance degradation. We did some tests with a list of 500.000 authors, sorted them and typeset them as list (producing some 5400 dense pages in a small font and with small margins). This is typical one of these cases where using <span tag="MKIV" style="font-style:sans;">LuajitTEX</span> saves quite time. On my machine it took just over 100 seconds to get this done. Unfortunately not all operating systems performed equally well: 32 bit versions worked fine, but 64 bit <span tag="MKIV" style="font-style:sans;">linux</span> either crashed (stalled) the machine or ran out of memory rather fast, while <span tag="MKIV" style="font-style:sans;">MacOSX</span> and <span tag="MKIV" style="font-style:sans;">Windows</span> performed fine. In practice you will never run into this, unless you produce massive amounts of bibliographic entries. <span tag="MKIV" style="font-style:sans;">LuaJIT</span> has some benefits but also some drawbacks.

Navigation menu