Changes

Jump to navigation Jump to search
no edit summary
<pre style="color:rgb(102,0,102);font-size:120%">@Article{sometag,
author = "An Author and Another One", title = "A hopefully meaningful title", journal = maps, volume = "25", number = "2", pages = "5--9", month = mar, year = "2013", ISSN = "1234-5678",
}
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\startpublication[k=Hagen:Second,t=article,a={Hans Hagen},y=2013,s=HH01]
\artauthor[]{Hans}[H.]{}{Hagen} \arttitle{Who knows more?} \journal{MyJournal} \pubyear{2013} \month{8} \volume{1} \issue{3} \issn{1234-5678} \pages{123--126}
\stoppublication
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\startpublication[k=Hagen:Third,t=article]
\author{Hans Hagen} \title{Who knows who?} ...
\stoppublication
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\startpublication[tag=Hagen:Third,category=article]
\author{Hans Hagen} \title{Who knows who?} ...
\stoppublication
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\startpublication
\tag{Hagen:Third} \category{article} \author{Hans Hagen} \title{Who knows who?} ...
\stoppublication
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">return {
["Hagen:First"] = { author = "Hans Hagen", category = "article", issn = "1234-5678", issue = "3", journal = "MyJournal", month = "8", pages = "123--126", tag = "Hagen:First", title = "Who knows nothing?", volume = "1", year = "2013", },
}
</pre>
<pre style="color:rgb(102,0,102);font-size:120%"><?xml version="2.0" standalone="yes" ?>
<bibtex>
<entry tag="Hagen:First" category="article"> <field name="author">Hans Hagen</field> <field name="category">article</field> <field name="issn">1234-5678</field> <field name="issue">3</field> <field name="journal">MyJournal</field> <field name="month">8</field> <field name="pages">123--126</field> <field name="tag">Hagen:First</field> <field name="title">Who knows nothing?</field> <field name="volume">1</field> <field name="year">2013</field> </entry>
</bibtex>
</pre>
publications > standard ConTeXt 4 known
publications > standard TeXLive 3 KNOWN
publications > standard eTeX 1 knownpublications > standard hbox 6 knownpublications > standard sltt 1 unknown
publications > stop used btxcommands
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\definebtxrendering
[example] [dataset=example, method=local, alternative=apa]
\placelistofpublications % \placebtxrendering
[example] [criterium=all]
</pre>
<br/>
<pre style="color:rgb(102,0,102);font-size:120%">\btxdoif {title} {
\bold{\btxfield{title}},
}
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\btxdoifelse{fieldname}{action when found}{action when not found}
\btxdoif {fieldname}{action when found}\btxdoifnot {fieldname} {action when not found}
</pre>
<br/>
<pre style="color:rgb(102,0,102);font-size:120%">\btxdoifelse {author} {
\btxsetup{btx:apa:author:yes}
} {
\btxsetup{btx:apa:author:nop}
}
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\btxdoif {title} {
\bold{\btxfield{title}} \btxcomma
}
</pre>
You can tune the way a citation shows up:
<pre style="color:rgb(102,0,102);font-size:120%">\setupbtxcitevariant[author] [sorttype=author,color=darkyellow]
\setupbtxcitevariant[authoryear] [sorttype=author,color=darkyellow]
\setupbtxcitevariant[authoryears][sorttype=author,color=darkyellow]
The <tt style="color:rgb(0,102,102);font-size:120%;" >\citation</tt> command is synonymous but is more flexible with respect to spacing of its arguments:
<pre style="color:rgb(102,0,102);font-size:120%">\citation[author] [example::demo-004,demo-003]
\citation[authoryear] [example::demo-004,demo-003]
\citation[authoryears][example::demo-004,demo-003]
<pre style="color:rgb(102,0,102);font-size:120%">\startsetups btx:cite:author
\btxcitevariant{author}
\stopsetups
</pre>
The entries are collected in datasets and each set has a unique name. In this document we have the set named <tt style="color:rgb(0,102,102);font-size:120%;" >example</tt>. A dataset table has several fields, and probably the one of most interest is the <tt style="color:rgb(0,102,102);font-size:120%;" >luadata</tt> field. Each entry in this table describes a publication:
<pre style="color:rgb(102,0,102);font-size:120%">t={ ["author"]="Hans Hagen", ["category"]="book", ["index"]=1, ["tag"]="demo-001", ["title"]="\\btxcmd{BIBTEX}, the \\btxcmd{CONTEXT}\\ way", ["year"]="2013",}
</pre>
This is <tt style="color:rgb(0,102,102);font-size:120%;" >publications.datasets.example.luadata["demo-001"]</tt>. There can be a companion entry in the parallel <tt style="color:rgb(0,102,102);font-size:120%;" >details</tt> table.
<pre style="color:rgb(102,0,102);font-size:120%">t={ ["author"]={ { ["firstnames"]={ "Hans" }, ["initials"]={ "H" }, ["original"]="Hans Hagen", ["surnames"]={ "Hagen" }, ["vons"]={}, }, }, ["short"]="Hag13",}
</pre>
These details are accessed as <tt style="color:rgb(0,102,102);font-size:120%;" >publications.datasets.example.details["demo-001"]</tt> and by using a separate table we can overload fields in the original entry without losing the original.
<pre style="color:rgb(102,0,102);font-size:120%">context.starttabulate { "|l|l|l|" }
for tag, entry in table.sortedhash(dataset.luadata) do
local detail = dataset.details[tag] or { } context.NC() context.type(tag) context.NC() context(detail.short) context.NC() context(entry.title) context.NC() context.NR()
end
context.stoptabulate()
<pre style="color:rgb(102,0,102);font-size:120%">\startxmlsetups btx:initialize
\xmlsetsetup{#1}{bibtex|entry|field}{btx:*} \xmlmain{#1}
\stopxmlsetups
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\startxmlsetups btx:field
\xmlflushcontext{#1}
\stopxmlsetups
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\starttabulate[|||]
\NC \type {tag} \NC \xmlfirst {btx:tugboat} {/bibtex/entry[string.find(@tag,'Hagen')]/attribute('tag')} \NC \NR \NC \type {title} \NC \xmlfirst {btx:tugboat} {/bibtex/entry[string.find(@tag,'Hagen')]/field[@name='title']} \NC \NR
\stoptabulate
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\startxmlsetups btx:demo
\xmlcommand {#1} {/bibtex/entry[string.find(@tag,'Hagen')][1]}{btx:table}
\stopxmlsetups
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\startxmlsetups btx:table
\starttabulate[|||]
\NC \type {tag} \NC \xmlatt{#1}{tag} \NC \NR \NC \type {title} \NC \xmlfirst{#1}{/field[@name='title']} \NC \NR
\stoptabulate
\stopxmlsetups
<pre style="color:rgb(102,0,102);font-size:120%">\startxmlsetups btx:row
\NC \xmlatt{#1}{tag} \NC \xmlfirst{#1}{/field[@name='title']} \NC \NR
\stopxmlsetups
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\startxmlsetups btx:demo
\xmlfilter {#1} { /bibtex /entry[@category='article'] /field[@name='author' and (find(text(),'Knuth') or find(text(),'DEK'))] /../command(btx:row) }
\stopxmlsetups
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\starttabulate[|||]
\xmlsetup{btx:tugboat}{btx:demo}
\stoptabulate
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\startxmlsetups btx:getkeys
\xmladdsortentry{btx}{#1}{\xmlfilter{#1}{/field[@name='author']/text()}} \xmladdsortentry{btx}{#1}{\xmlfilter{#1}{/field[@name='year' ]/text()}} \xmladdsortentry{btx}{#1}{\xmlatt{#1}{tag}}
\stopxmlsetups
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\startxmlsetups btx:sorter
\xmlresetsorter{btx} % \xmlfilter{#1}{entry/command(btx:getkeys)} \xmlfilter{#1}{ /bibtex /entry[@category='article'] /field[@name='author' and find(text(),'Knuth')] /../command(btx:getkeys)} \xmlsortentries{btx} \starttabulate[||||] \xmlflushsorter{btx}{btx:entry:flush} \stoptabulate
\stopxmlsetups
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\startxmlsetups btx:entry:flush
\NC \xmlfilter{#1}{/field[@name='year' ]/context()} \NC \xmlatt{#1}{tag} \NC \xmlfilter{#1}{/field[@name='author']/context()} \NC \NR
\stopxmlsetups
</pre>
\usemodule[bibltx]
\setupbibtex
[database=xampl]
\setuppublications
[numbering=yes]
\starttext
As \cite [article-full] already indicated, bibtex is a \LATEX||centric program. \completepublications
\stoptext
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\definebtxdataset
[document]
\usebtxdataset
[document] [mybibfile.bib]
\definebtxrendering
[document]
\setupbtxrendering
[document] [numbering=yes]
\starttext
As \cite [article-full] already indicated, bibtex is a \LATEX||centric program. \completebtxrendering[document]
\stoptext
</pre>
<pre style="color:rgb(102,0,102);font-size:120%">\usebtxdataset
[mybibfile.bib]
\setupbtxrendering
[numbering=yes]
</pre>
<br/>
<pre style="color:rgb(102,0,102);font-size:120%">function publications.loaders.myformat(dataset,filename)
local t = { } -- Load data from 'filename' and convert it to a Lua table 't' with -- the key as hash entry and fields conforming the luadata table -- format. loaders.lua(dataset,t)
end
</pre>

Navigation menu