Changes

Jump to navigation Jump to search
no edit summary
The <span tag="MKIV" style="font-style:sans;">bibTEX</span> for­mat is rather pop­u­lar in the <span tag="MKIV" style="font-style:sans;">TEX</span> com­mu­nity and even with its short­com­ings it will stay around for a while. Many pub­li­ca­tion web­sites can ex­port and many tools are avail­able to work with this data­base for­mat. It is rather sim­ple and looks a bit like <span tag="MKIV" style="font-style:sans;">Lua</span> ta­bles. Un­for­tu­nately the con­tent can be pol­luted with non-stan­dard­ized <span tag="MKIV" style="font-style:sans;">TEX</span> com­mands which com­pli­cates pre- or post­pro­cess­ing out­side <span tag="MKIV" style="font-style:sans;">TEX</span>. In that sense a <span tag="MKIV" style="font-style:sans;">bibTEX</span> data­base is of­ten not coded neu­trally. Some lim­i­ta­tions, like the use of com­mands to en­code ac­cented char­ac­ters root in the <span tag="MKIV" style="font-style:sans;">ascii</span> world and can be by­passed by us­ing <span tag="MKIV" style="font-style:sans;">utf</span> in­stead (as han­dled some­what in <span tag="MKIV" style="font-style:sans;">LATEX</span> through ex­ten­sions such as <tt style="color:rgb(0,102,102);font-size:100%;" >bibtex8</tt>).
<p></p>The nor­mal way to deal with a bib­li­og­ra­phy is to re­fer to en­tries us­ing a unique tag or key. When a list of en­tries is type­set, this ref­er­ence can be used for link­ing pur­poses. The type­set list can be processed and sorted us­ing the <tt style="color:rgb(0,102,102);font-size:100%;" >bibtex</tt> pro­gram that con­verts the data­base into some­thing 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 (nor bib­li­ogra­phies) so I will not go into too much de­tail here, if only be­cause 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­gram: we just use data­base files and deal with the nec­es­sary ma­nip­u­la­tions di­rectly in <span tag="MKIV" style="font-style:sans;">ConTEXt</span>. One or more such data­bases can be used and com­bined with ad­di­tional en­tries de­fined within the doc­u­ment. We can have sev­eral such datasets ac­tive at the same time.<p></p>A <span tag="MKIV" style="font-style:sans;">bibTEX</span> file looks like this:
<pre style="color:rgb(102,0,102);font-size:100%">@Article{sometag,
}
</pre>
<p></p>Nor­mally a value is given be­tween quotes (or curly brack­ets) but sin­gle words are also OK (there is no real ben­e­fit in not us­ing quotes, so we ad­vise to al­ways use them). There can be many more fields and in­stead of strings one can use pre­de­fined short­cuts. The ti­tle for ex­am­ple quite of­ten con­tains <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 such as the en­dash (typ­i­cally as <tt style="color:rgb(0,102,102);font-size:100%;" >--</tt>) so we have a mix­ture of data and type­set­ting di­rec­tives. If you are cov­er­ing non--eng­lish ref­er­ences, you of­ten need char­ac­ters that are not in the <span tag="MKIV" style="font-style:sans;">ascii</span> sub­set 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 file uses old-fash­ioned <span tag="MKIV" style="font-style:sans;">TEX</span> ac­cent com­mands then these will be in­ter­nally con­verted au­to­mat­i­cally to <span tag="MKIV" style="font-style:sans;">utf</span>. Com­mands (macros) are con­verted to an in­di­rect call, which is quite ro­bust.<p></p>The <span tag="MKIV" style="font-style:sans;">bibTEX</span> files are loaded in mem­ory as <span tag="MKIV" style="font-style:sans;">Lua</span> ta­ble but can be con­verted to <span tag="MKIV" style="font-style:sans;">xml</span> so that we can ac­cess them in a more flex­i­ble way, but that is a sub­ject for spe­cial­ists.<p></p>In the old <span tag="MKIV" style="font-style:sans;">MkII</span> setup we have two kinds of en­tries: the ones that come from the <span tag="MKIV" style="font-style:sans;">bibTEX</span> run and user sup­plied ones. We no longer rely on <span tag="MKIV" style="font-style:sans;">bibTEX</span> out­put but we do still sup­port the user sup­plied de­f­i­n­i­tions. These were in fact pre­pared in a way that suits the pro­cess­ing of <span tag="MKIV" style="font-style:sans;">bibTEX</span> gen­er­ated en­tries. The next vari­ant re­flects the <span tag="MKIV" style="font-style:sans;">ConTEXt</span> re­cod­ing of the old <span tag="MKIV" style="font-style:sans;">bibTEX</span> out­put.
<pre style="color:rgb(102,0,102);font-size:100%">\startpublication[k=Hagen:Second,t=article,a={Hans Hagen},y=2013,s=HH01]
\stoppublication
</pre>
<p></p>The split <tt style="color:rgb(0,102,102);font-size:100%;" >\artauthor</tt> fields are col­lapsed into a sin­gle <tt style="color:rgb(0,102,102);font-size:100%;" >author</tt> field as we deal with the split­ting 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 is only kept around for back­ward com­pat­i­bil­ity with the pre­vi­ous use of <span tag="MKIV" style="font-style:sans;">bibTEX</span>.<p></p>In the new setup we sup­port these vari­ants as well:
<pre style="color:rgb(102,0,102);font-size:100%">\startpublication[k=Hagen:Third,t=article]
\stoppublication
</pre>
<p></p>and
<pre style="color:rgb(102,0,102);font-size:100%">\startpublication[tag=Hagen:Third,category=article]
\stoppublication
</pre>
<p></p>and
<pre style="color:rgb(102,0,102);font-size:100%">\startpublication
\stoppublication
</pre>
<p></p>Be­cause in­ter­nally the en­tries are <span tag="MKIV" style="font-style:sans;">Lua</span> ta­bles, we also sup­port load­ing of <span tag="MKIV" style="font-style:sans;">Lua</span> based de­f­i­n­i­tions:
<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 <span tag="MKIV" style="font-style:sans;">xml</span> in­put is rather close to this, and is also ac­cepted as in­put.
<pre style="color:rgb(102,0,102);font-size:100%"><?xml version="2.0" standalone="yes" ?>
</bibtex>
</pre>
<p></p>Todo: Add some re­marks about load­ing End­Note and RIS for­mats, but first we need to com­plete the tag map­ping (on Alan’s plate).<p></p>So the user has a rather wide choice of for­mat­ting style for bib­li­og­ra­phy data­base files.
You can load more data than you ac­tu­ally need. Only en­tries that are re­ferred to ex­plic­itly 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 will be shown in lists. We will cover these de­tails later.
publications > stop used btxcommands
</pre>
<p></p>You can de­fine un­known com­mands, or over­load ex­ist­ing de­f­i­n­i­tions in the fol­low­ing way:
<pre style="color:rgb(102,0,102);font-size:100%">\definebtxcommand\TUB {TUGboat}
\definebtxcommand\<#1>{\type{#1}}
</pre>
<p></p>Un­known com­mands do not stall pro­cess­ing, but their names are then type­set in a mono- spaced font so they prob­a­bly stand out for proof­read­ing. You can ac­cess the com­mands 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 we get: “com­mands like MySpe­cial­Com­mand are han­dled in an in­di­rect way”.<p></p>??
\usebtxdataset[standard][test-001-btx-standard.lua]
</pre>
<p></p>These three suf­fixes are un­der­stood 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 files are merged, where later en­tries hav­ing the same tag over­load pre­vi­ous ones. De­f­i­n­i­tions in the doc­u­ment source (coded in <span tag="MKIV" style="font-style:sans;">TEX</span> speak) are also added, and they are saved for suc­ces­sive runs. This means that if you load and de­fine en­tries, they will be known at a next run be­fore­hand, so that ref­er­ences to them are in­de­pen­dent of when load­ing and de­f­i­n­i­tions take place.
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition setupbtxdataset </span >
<span style="font-style:oblique;" > setup definition usebtxdataset </span >
</div>
<p></p>In this doc­u­ment we use some ex­am­ple data­bases, so let’s load one of them now:
<pre style="color:rgb(102,0,102);font-size:100%">\definebtxdataset[example]
<pre style="color:rgb(102,0,102);font-size:100%">\usebtxdataset[example][mkiv-publications.bib]
</pre>
<p></p>You can ask for an overview of en­tries in a dataset with:
<pre style="color:rgb(102,0,102);font-size:100%">\showbtxdatasetfields[example]
|}
<p></p>You can set the cur­rent ac­tive dataset with
<pre style="color:rgb(102,0,102);font-size:100%">\setbtxdataset[standard]
</pre>
<p></p>but most pub­li­ca­tion-re­lated com­mands ac­cept op­tional ar­gu­ments that de­note the dataset and ref­er­ences to en­tries can be pre­fixed with a dataset iden­ti­fier.. More about that later.
A list of pub­li­ca­tions can be ren­dered at any place in the doc­u­ment. A data­base can be much larger than needed for a doc­u­ment. The same is true for the fields that make up an en­try. Here is the list of fields that are cur­rently han­dled, but of course there can be ad­di­tional 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 are in the data­base, the eas­i­est way is to ask for a com­plete list:
<pre style="color:rgb(102,0,102);font-size:100%">\definebtxrendering
[criterium=all]
</pre>
<p></p>This gives:1 Ha­gen, H. and Ot­ten, T. (1996). Type­set­ting ed­u­ca­tion doc­u­ments2 Scarso, L. (2021). De­sign­ing high speed trains3 au­thor (year). ti­tle pages p.<p></p>The ren­der­ing it­self is some­what com­plex to set up be­cause we have not only many dif­fer­ent stan­dards but also many fields that can be set up. This means that there are sev­eral com­mands in­volved. Of­ten there is a pre­scribed style to ren­der bib­li­o­graphic de­scrip­tions, for ex­am­ple <tt style="color:rgb(0,102,102);font-size:100%;" >apa</tt>. A ren­der­ing is setup and de­fined with:
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition setupbtxrendering </span >
<span style="font-style:oblique;" > setup definition definebtxrendering </span >
</div>
<p></p>And a list of such de­scrip­tions is gen­er­ated 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­tries:<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­ant. To keep things sim­ple we have their set­tings sep­a­rated. How­ever, these set­tings are shared for all ren­der­ing al­ter­na­tives. In prac­tice this is sel­dom a prob­lem in a pub­li­ca­tion as only one ren­der­ing al­ter­na­tive will be ac­tive. If this be not suf­fi­cient, you can al­ways group lo­cal set­tings in a setup and hook that into the spe­cific ren­der­ing.
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition setupbtxlistvariant </span >
<span style="font-style:oblique;" > setup definition definebtxlistvariant </span >
</div>
<p></p>Ex­am­ples of list vari­ants are:<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxlistvariant : artauthor</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxlistvariant : author</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxlistvariant : editor</tt>
{|
|}
<p></p>The ex­act ren­der­ing of list en­tries is de­ter­mined by the <tt style="color:rgb(0,102,102);font-size:100%;" >alternative</tt> key and de­faults to <tt style="color:rgb(0,102,102);font-size:100%;" >apa</tt> which uses de­f­i­n­i­tions 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 has its own setup. You may also no­tice that ad­di­tional tests are needed to make sure that empty fields don’t trig­ger sep­a­ra­tors and such.<p></p>There are a cou­ple of ac­ces­sors and helpers to get the job done. When you want to fetch a field from the cur­rent en­try 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 you don’t want fences or punc­tu­a­tion that be­longs to a field.
<pre style="color:rgb(102,0,102);font-size:100%">\btxdoif {title} {
}
</pre>
<p></p>There are three test macros:
<pre style="color:rgb(102,0,102);font-size:100%">\btxdoifelse{fieldname}{action when found}{action when not found}
\btxdoifnot {fieldname} {action when not found}
</pre>
<p></p>An ex­tra con­di­tional is avail­able for test­ing in­ter­ac­tiv­ity:
<pre style="color:rgb(102,0,102);font-size:100%">\btxdoifelseinteraction{action when true}{action when false}
</pre>
<p></p>In ad­di­tion there is also a con­di­tional <tt style="color:rgb(0,102,102);font-size:100%;" >\btxinteractive</tt> which is more ef­fi­cient, al­though in prac­tice ef­fi­ciency is not so im­por­tant here.<p></p>There are three com­mands to flush data:
{|
|}
<p></p>Nor­mally 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 fields just like an­a­lyzed au­thor fields are flushed in a spe­cial way.<p></p>You can im­prove read­abil­ity by us­ing se­tups, for in­stance:
<pre style="color:rgb(102,0,102);font-size:100%">\btxdoifelse {author} {
}
</pre>
<p></p>Keep in mind that nor­mally you don’t need to mess with de­f­i­n­i­tions like this be­cause stan­dard ren­der­ing styles are pro­vided. These styles use a few helpers that in­ject sym­bols but also take care of lead­ing and trail­ing spaces:
{|
|}
<p></p>So, the pre­vi­ous ex­am­ple setup can be rewrit­ten as:
<pre style="color:rgb(102,0,102);font-size:100%">\btxdoif {title} {
}
</pre>
<p></p>There is a spe­cial com­mand for ren­der­ing a (com­bi­na­tion) of au­thors:
<pre style="color:rgb(102,0,102);font-size:100%">\btxflushauthor{author}
\btxflushauthor[inverted]{editor}
</pre>
<p></p>In­stead 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­urable) de­fault or pass di­rec­tives: Valid di­rec­tives are
{|
</div>
<p></p>The first ar­gu­ment is op­tional.
<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 shows up:
<pre style="color:rgb(102,0,102);font-size:100%">\setupbtxcitevariant[author] [sorttype=author,color=darkyellow]
\cite[authoryears][example::demo-004,demo-003]
</pre>
<p></p>Here we sort the au­thors and color the ci­ta­tion:
<div>
</div>
<p></p>For rea­sons of back­ward com­pat­i­bil­ity the <tt style="color:rgb(0,102,102);font-size:100%;" >\cite</tt> com­mand is a bit picky about spaces be­tween the two ar­gu­ments, of which the first is op­tional. This is a con­se­quence of al­low­ing its use with the key spec­i­fied be­tween curly brack­ets as is the tra­di­tional prac­tice. (We do en­cour­age users to adopt the more co­her­ent <span tag="MKIV" style="font-style:sans;">ConTEXt</span> syn­tax by us­ing square brack­ets for key­words and re­serv­ing curly brack­ets to re­group text to be type­set.)<p></p>The <tt style="color:rgb(0,102,102);font-size:100%;" >\citation</tt> com­mand is syn­ony­mous but is more flex­i­ble with re­spect to spac­ing of its ar­gu­ments:
<pre style="color:rgb(102,0,102);font-size:100%">\citation[author] [example::demo-004,demo-003]
\citation[authoryears][example::demo-004,demo-003]
</pre>
<p></p>There is a whole bunch of cite op­tions and more can be eas­ily de­fined.
{|
|}
<p></p>Be­cause we are deal­ing with data­base in­put and be­cause we gen­er­ally need to ma­nip­u­late en­tries, much of the work is del­e­gated to <span tag="MKIV" style="font-style:sans;">Lua</span>. This makes it eas­ier to main­tain and ex­tend the code. Of course <span tag="MKIV" style="font-style:sans;">TEX</span> still does the ren­der­ing. The ty­po­graphic de­tails are con­trolled by pa­ra­me­ters but not all are used in all vari­ants. As with most <span tag="MKIV" style="font-style:sans;">ConTEXt</span> com­mands, it starts out with a gen­eral setup com­mand:
<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 that in­herit ei­ther from a given par­ent or from the top­most setup.
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition definebtxcitevariant </span >
</div>
<p></p>But, spe­cific vari­ants can have them over­loaded: <p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : author</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : authornum</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : authoryear</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : authoryears</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : doi</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : key</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : none</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : num</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : page</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : serial</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : short</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : type</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : url</tt>
{|
|}
<p></p><tt style="color:rgb(102,0,102);font-size:100%;" >setupbtxcitevariant : year</tt>
{|
\stopsetups
</pre>
<p></p>You can over­load such se­tups if needed, but that only makes sense when you can­not con­fig­ure the ren­der­ing with pa­ra­me­ters. The <tt style="color:rgb(0,102,102);font-size:100%;" >\btxcitevariant</tt> com­mand is one of the build in ac­ces­sors and it calls out to <span tag="MKIV" style="font-style:sans;">Lua</span> where more com­plex ma­nip­u­la­tion takes place if needed. If no ma­nip­u­la­tion is known, the field with the same name (if found) will be flushed. A com­mand like <tt style="color:rgb(0,102,102);font-size:100%;" >\btxcitevariant</tt> as­sumes that a dataset and spe­cific tag has been set. This is nor­mally done in the wrap­per macros, like <tt style="color:rgb(0,102,102);font-size:100%;" >\cite</tt>. For spe­cial pur­poses you can use these com­mands
<pre style="color:rgb(102,0,102);font-size:100%">\setbtxdataset[example]
\setbtxentry[hh2013]
</pre>
<p></p>But don’t ex­pect too much sup­port for such low level ren­der­ing con­trol.<p></p>Un­less you use <tt style="color:rgb(0,102,102);font-size:100%;" >criterium=all</tt> only pub­li­ca­tions that are cited will end up in the lists. You can force a ci­ta­tion into a list us­ing <tt style="color:rgb(0,102,102);font-size:100%;" >\usecitation</tt>, for ex­am­ple:
<pre style="color:rgb(102,0,102);font-size:100%">\usecitation[example::demo-004,demo-003]
</pre>
<p></p>This com­mand has two syn­onyms: <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 fits you best.
<div style="border:thin solid black;" >
<span style="font-style:oblique;" > setup definition nocite </span >
Be­cause we man­age data at the <span tag="MKIV" style="font-style:sans;">Lua</span> end it is tempt­ing to ac­cess it there for other pur­poses. This is fine as long as you keep in mind that as­pects of the im­ple­men­ta­tion may change over time, al­though this is un­likely once the mod­ules be­come sta­ble.
<p></p>The en­tries are col­lected in datasets and each set has a unique name. In this doc­u­ment we have the set named <tt style="color:rgb(0,102,102);font-size:100%;" >example</tt>. A dataset ta­ble has sev­eral fields, and prob­a­bly the one of most in­ter­est is the <tt style="color:rgb(0,102,102);font-size:100%;" >luadata</tt> field. Each en­try in this ta­ble de­scribes a pub­li­ca­tion:
<pre style="color:rgb(102,0,102);font-size:100%">t={
</pre>
These de­tails are ac­cessed as <tt style="color:rgb(0,102,102);font-size:100%;" >publications.datasets.example.details["demo-001"]</tt> and by us­ing a sep­a­rate ta­ble we can over­load fields in the orig­i­nal en­try with­out los­ing the orig­i­nal.
<p></p>You can loop over the en­tries us­ing reg­u­lar <span tag="MKIV" style="font-style:sans;">Lua</span> code com­bined 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
context.stoptabulate()
</pre>
<p></p>This re­sults in:
{|
The <tt style="color:rgb(0,102,102);font-size:100%;" >luadata</tt> ta­ble can be con­verted into an <span tag="MKIV" style="font-style:sans;">xml</span> rep­re­sen­ta­tion. This is a fol­low up on ear­lier ex­per­i­ments with an <span tag="MKIV" style="font-style:sans;">xml</span>-only ap­proach. I de­cided in the end to stick to a <span tag="MKIV" style="font-style:sans;">Lua</span> ap­proach and pro­vide some sim­ple <span tag="MKIV" style="font-style:sans;">xml</span> sup­port in ad­di­tion.
<p></p>Once a dataset is ac­ces­si­ble as <span tag="MKIV" style="font-style:sans;">xml</span> tree, you can use the reg­u­lar <tt style="color:rgb(0,102,102);font-size:100%;" >\xml...</tt> com­mands. We start with load­ing 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 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 by its root ref­er­ence <tt style="color:rgb(0,102,102);font-size:100%;" >btx:tugboat</tt>. If we want sim­ple field ac­cess we can use a few se­tups:
<pre style="color:rgb(102,0,102);font-size:100%">\startxmlsetups btx:initialize
<pre style="color:rgb(102,0,102);font-size:100%">\xmlsetup{btx:tugboat}{btx:initialize}
</pre>
<p></p>The two se­tups are pre­de­fined in the core al­ready, but you might want to change them. They are ap­plied in for in­stance:
<pre style="color:rgb(102,0,102);font-size:100%">\starttabulate[|||]
|}
<p></p>Here is an­other ex­am­ple:
<pre style="color:rgb(102,0,102);font-size:100%">\startxmlsetups btx:row
|}
<p></p>A more ex­ten­sive ex­am­ple is the fol­low­ing. Of course this as­sumes that you know what <span tag="MKIV" style="font-style:sans;">xml</span> sup­port mech­a­nisms and macros are avail­able.
<pre style="color:rgb(102,0,102);font-size:100%">\startxmlsetups btx:getkeys
|}
<p></p>The orig­i­nal data is stored in a <span tag="MKIV" style="font-style:sans;">Lua</span> ta­ble, hashed by tag. Start­ing 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 of such a hash. In older ver­sions, when you looped over a hash, the or­der was un­de­fined, but the same as long as you used the same bi­nary. This had the ad­van­tage that suc­ces­sive runs, some­thing we of­ten have in doc­u­ment pro­cess­ing gave con­sis­tent re­sults. In to­day’s <span tag="MKIV" style="font-style:sans;">Lua</span> we need to do much more sort­ing of hashes be­fore we loop, es­pe­cially when we save multi--pass data. It is for this rea­son that the <span tag="MKIV" style="font-style:sans;">xml</span> tree is sorted by hash key by de­fault. That way lookups (es­pe­cially the first of a set) give con­sis­tent out­comes.
The ren­der­ing of bib­li­o­graphic en­tries is of­ten stan­dard­ized and pre­scribed by the pub­lisher. If you sub­mit an ar­ti­cle to a jour­nal, nor­mally it will be re­for­mat­ted (or even re- keyed) and the ren­der­ing will hap­pen at the pub­lish­ers end. In that case it may not mat­ter how en­tries were ren­dered when writ­ing the pub­li­ca­tion, be­cause the pub­lisher will do it his or her way. This means that most users prob­a­bly will stick to the stan­dard <span tag="MKIV" style="font-style:sans;">apa</span> rules and for them we pro­vide some con­fig­u­ra­tion. Be­cause we use se­tups it is easy to over­load specifics. If you re­ally want to tweak, best look in the files that deal with it.
<p></p>Many stan­dards ex­ist and sup­port for other ren­der­ings may be added to the core. In­ter­ested users are in­vited to de­velop and to test al­ter­nate stan­dard ren­der­ings ac­cord­ing to their needs.<p></p>Todo: maybe a list of cat­e­gories and fields.
Al­though the <span tag="MKIV" style="font-style:sans;">bibTEX</span> for­mat is rea­son­ably well de­fined, in prac­tice there are many ways to or­ga­nize the data. For in­stance, one can use pre­de­fined string con­stants that get used (ei­ther or not com­bined with other strings) later on. A string can be en­closed in curly braces or dou­ble quotes. The strings can con­tain <span tag="MKIV" style="font-style:sans;">TEX</span> com­mands but these are not stan­dard­ized. The data­bases of­ten have some­what com­plex ways to deal with spe­cial char­ac­ters and the use of braces in their de­f­i­n­i­tion is also not nor­mal­ized.
<p></p>The most com­plex to deal with are the fields that con­tain names of peo­ple. At some point it might be needed to split a com­bi­na­tion of names into in­di­vid­ual ones that then get split into ti­tle, first name, op­tional in­be­tweens, sur­name(s) and ad­di­tional: <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 of this. The con­ven­tion seems to be not to use com­mas but <tt style="color:rgb(0,102,102);font-size:100%;" >and</tt> to sep­a­rate names (of­ten each name will be spec­i­fied as last­name, first­name).<p></p>We don’t see it as chal­lenge nor as a duty to sup­port all kinds of messy de­f­i­n­i­tions. Of course we try to be some­what tol­er­ant, but you will be sure to get bet­ter re­sults if you use nicely setup, con­sis­tent data­bases.<p></p>Todo: maybe some ex­am­ples of bad.
\stoptext
</pre>
<p></p>For <span tag="MKIV" style="font-style:sans;">MkIV</span> the mod­ules were partly rewrit­ten and ended up in the core so the two com­mands were no longer needed. The over­head as­so­ci­ated with the au­to­matic load­ing of the bib­li­og­ra­phy macros can be ne­glected these days, so stan­dard­ized mod­ules such as <tt style="color:rgb(0,102,102);font-size:100%;" >bib</tt> are all be­ing moved to the core and do not need to be ex­plic­itly loaded.<p></p>The first <tt style="color:rgb(0,102,102);font-size:100%;" >\setupbibtex</tt> com­mand in this ex­am­ple is needed to boot­strap the process: it tells what data­base has to be processed by <span tag="MKIV" style="font-style:sans;">bibTEX</span> be­tween runs. The sec­ond <tt style="color:rgb(0,102,102);font-size:100%;" >\setuppublications</tt> com­mand is op­tional. Each ci­ta­tion (tagged with <tt style="color:rgb(0,102,102);font-size:100%;" >\cite</tt>) ends up in the list of pub­li­ca­tions.<p></p>In the new ap­proach 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 we de­fine dataset(s). We also no longer set up pub­li­ca­tions with one com­mand, but have split that up in ren­der­ing-, list-, and cite-vari­ants. The ba­sic <tt style="color:rgb(0,102,102);font-size:100%;" >\cite</tt> com­mand re­mains. The above ex­am­ple be­comes:
<pre style="color:rgb(102,0,102);font-size:100%">\definebtxdataset
\stoptext
</pre>
<p></p>So, we have a few more com­mands to set up things. If you in­tend to use just a sin­gle dataset and ren­der­ing, the above pre­am­ble can be sim­pli­fied to:
<pre style="color:rgb(102,0,102);font-size:100%">\usebtxdataset
[numbering=yes]
</pre>
<p></p>But keep in mind that com­pared to the old <span tag="MKIV" style="font-style:sans;">MkII</span> de­rived method we have moved some of the op­tions to the ren­der­ing, list and cite setup vari­ants.<p></p>An­other dif­fer­ence is now the use of lists. When you de­fine a ren­der­ing, you also de­fine a list. How­ever, all en­tries are col­lected in a com­mon list tagged <tt style="color:rgb(0,102,102);font-size:100%;" >btx</tt>. Al­though you will nor­mally con­fig­ure a ren­der­ing you can still set some prop­er­ties of lists, but in that case you need to pre­fix the list iden­ti­fier. In the case of the above ex­am­ple this is <tt style="color:rgb(0,102,102);font-size:100%;" >btx:document</tt>.
end
</pre>
<p></p>This then per­mits load­ing a data­base (into a dataset) with the com­mand:
<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 is rec­og­nized au­to­mat­i­cally. If you want to use an­other suf­fix, you can do this:
<pre style="color:rgb(102,0,102);font-size:100%">\usebtxdataset[standard][myformat::myfile.txt]
</pre>

Navigation menu