Open main menu

Changes

no edit summary
 
==The data­base==
</pre>
this gives:
{||+|
tag
||
||
au­thor doi in­dex pages se­r­ial ti­tle url year
||} 
<br/>
You can set the cur­rent ac­tive dataset with
<br/>
<tt>setupbtxlistvariant : artauthor</tt>
{||+|
<tt>no specific settings</tt>
||
||} 
<br/>
<tt>setupbtxlistvariant : author</tt>
{||+|
<tt>no specific settings</tt>
||
||} 
<br/>
<tt>setupbtxlistvariant : editor</tt>
{||+|
<tt>no specific settings</tt>
||
||} 
<br/>
The ex­act ren­der­ing of list en­tries is de­ter­mined by the <tt>alternative</tt> key and de­faults to <tt>apa</tt> which uses de­f­i­n­i­tions from <tt>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.
<br/>
There are three com­mands to flush data:
{||+|
<tt>\btxfield</tt>
||
||
fetch a de­rived or ex­plicit field
||} 
<br/>
Nor­mally you can use <tt>\btxfield</tt> or <tt>\btxflush</tt> as de­rived fields just like an­a­lyzed au­thor fields are flushed in a spe­cial way.
<br/>
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:
{||+|
<tt>\btxspace</tt>
||
||
be­fore] af­ter
||} 
<br/>
So, the pre­vi­ous ex­am­ple setup can be rewrit­ten as:
<br/>
You can use a (con­fig­urable) de­fault or pass di­rec­tives: Valid di­rec­tives are
{||+|
con­ver­sion
||
||
K, the Frog, jr
||} 
<br/>
There is a whole bunch of cite op­tions and more can be eas­ily de­fined.
{||+|
key
||
||
(year)
||} 
<br/>
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 Lua. This makes it eas­ier to main­tain and ex­tend the code. Of course TEX 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 ConTEXt com­mands, it starts out with a gen­eral setup com­mand:
<br/>
<tt>setupbtxcitevariant : author</tt>
{||+|
<tt>right</tt>
||
||
<tt>(</tt>
||} 
<br/>
<tt>setupbtxcitevariant : authornum</tt>
{||+|
<tt>right</tt>
||
||
<tt>[</tt>
||} 
<br/>
<tt>setupbtxcitevariant : authoryear</tt>
{||+|
<tt>compress</tt>
||
||
<tt>(</tt>
||} 
<br/>
<tt>setupbtxcitevariant : authoryears</tt>
{||+|
<tt>compress</tt>
||
||
<tt>(</tt>
||} 
<br/>
<tt>setupbtxcitevariant : doi</tt>
{||+|
<tt>right</tt>
||
||
<tt>[</tt>
||} 
<br/>
<tt>setupbtxcitevariant : key</tt>
{||+|
<tt>right</tt>
||
||
<tt>[</tt>
||} 
<br/>
<tt>setupbtxcitevariant : none</tt>
{||+|
<tt>no specific settings</tt>
||
||} 
<br/>
<tt>setupbtxcitevariant : num</tt>
{||+|
<tt>compress</tt>
||
||
<tt>[</tt>
||} 
<br/>
<tt>setupbtxcitevariant : page</tt>
{||+|
<tt>inbetween</tt>
||
<tt>–</tt>
||} 
<br/>
<tt>setupbtxcitevariant : serial</tt>
{||+|
<tt>right</tt>
||
||
<tt>[</tt>
||} 
<br/>
<tt>setupbtxcitevariant : short</tt>
{||+|
<tt>right</tt>
||
||
<tt>[</tt>
||} 
<br/>
<tt>setupbtxcitevariant : type</tt>
{||+|
<tt>right</tt>
||
||
<tt>[</tt>
||} 
<br/>
<tt>setupbtxcitevariant : url</tt>
{||+|
<tt>right</tt>
||
||
<tt>[</tt>
||} 
<br/>
<tt>setupbtxcitevariant : year</tt>
{||+|
<tt>right</tt>
||
||
<tt>(</tt>
||} 
A ci­ta­tion vari­ant is de­fined in sev­eral steps and if you re­ally want to know the dirty de­tails, you should look into the <tt>publ-imp-*.mkiv</tt> files. Here we stick to the con­cept.
<pre detail='typing'>\startsetups btx:cite:author
<br/>
This re­sults in:
{||+|
<tt>demo-001</tt>
||
||
ti­tle
||} 
\stoptabulate
</pre>
{||+|
<tt>tag</tt>
||
||
PPCHTEX: type­set­ting chem­i­cal for­mu­las in TEX
||} 
<pre detail='buffer'>\startxmlsetups btx:demo
\xmlcommand
\xmlsetup{btx:tugboat}{btx:demo}
{||+|
<tt>tag</tt>
||
||
PPCHTEX: type­set­ting chem­i­cal for­mu­las in TEX
||} 
<br/>
Here is an­other ex­am­ple:
\stoptabulate
{||+|
Knuth:TB10-1-31
||
||
A Punk Meta-Font
||} 
<br/>
A more ex­ten­sive ex­am­ple is the fol­low­ing. Of course this as­sumes that you know what xml sup­port mech­a­nisms and macros are avail­able.
\xmlsetup{btx:tugboat}{btx:sorter}
{||+|
1984
||
||
Don­ald Knuth
||} 
<br/>
The orig­i­nal data is stored in a Lua ta­ble, hashed by tag. Start­ing with Lua 5.2 each run of Lua 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 Lua 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 xml 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.