Difference between revisions of "User:Luigi.scarso/testpage"
Luigi.scarso (talk | contribs) (test page for new publ module) |
Luigi.scarso (talk | contribs) |
||
Line 1: | Line 1: | ||
− | = | + | =1 The database= |
+ | |||
+ | The bibTEX format is rather popular in the TEX community and even with its shortcomings it will stay around for a while. Many publication websites can export and many tools are available to work with this database format. It is rather simple and looks a bit like Lua tables. Unfortunately the content can be polluted with non-standardized TEX commands which complicates pre- or postprocessing outside TEX . In that sense a bibTEX database is often not coded neutrally. Some limitations, like the use of commands to encode accented characters root in the ascii world and can be bypassed by using utf instead (as handled somewhat in LATEX through extensions such as <pre>bibtex8</pre> ). | ||
+ | <br/> | ||
+ | The normal way to deal with a bibliography is to refer to entries using a unique tag or key. When a list of entries is typeset, this reference can be used for linking purposes. The typeset list can be processed and sorted using the <pre>bibtex</pre> program that converts the database into something more TEX friendly (a <pre>.bbl</pre> file). I never used the program myself (nor bibliographies) so I will not go into too much detail here, if only because all I say can be wrong. | ||
+ | <br/> | ||
+ | In ConTEXt we no longer use the <pre>bibtex</pre> program: we just use database files and deal with the necessary manipulations directly in ConTEXt . One or more such databases can be used and combined with additional entries defined within the document. We can have several such datasets active at the same time. | ||
+ | <br/> | ||
+ | A bibTEX file looks like this: | ||
+ | <pre detail='typing'> | ||
+ | @Article{sometag, | ||
+ | author = "An Author and Another One", | ||
+ | title = "A hopefully meaningful title", | ||
+ | journal = maps, | ||
+ | volume = "25", | ||
+ | number = "2", | ||
+ | pages = "5--9", | ||
+ | month = mar, | ||
+ | year = "2013", | ||
+ | ISSN = "1234-5678", | ||
+ | } | ||
+ | </pre><br/> | ||
+ | Normally a value is given between quotes (or curly brackets) but single words are also OK (there is no real benefit in not using quotes, so we advise to always use them). There can be many more fields and instead of strings one can use predefined shortcuts. The title for example quite often contains TEX macros. Some fields, like <pre>pages</pre> have funny characters such as the endash (typically as <pre>--</pre> ) so we have a mixture of data and typesetting directives. If you are covering non--english references, you often need characters that are not in the ascii subset but ConTEXt is quite happy with utf . If your database file uses old-fashioned TEX accent commands then these will be internally converted automatically to utf . Commands (macros) are converted to an indirect call, which is quite robust. | ||
+ | <br/> | ||
+ | The bibTEX files are loaded in memory as Lua table but can be converted to xml so that we can access them in a more flexible way, but that is a subject for specialists. | ||
+ | <br/> | ||
+ | In the old MkII setup we have two kinds of entries: the ones that come from the bibTEX run and user supplied ones. We no longer rely on bibTEX output but we do still support the user supplied definitions. These were in fact prepared in a way that suits the processing of bibTEX generated entries. The next variant reflects the ConTEXt recoding of the old bibTEX output. | ||
+ | <pre detail='typing'> | ||
+ | \startpublication[k=Hagen:Second,t=article,a={Hans Hagen},y=2013,s=HH01] | ||
+ | \artauthor[]{Hans}[H.]{}{Hagen} | ||
+ | \arttitle{Who knows more?} | ||
+ | \journal{MyJournal} | ||
+ | \pubyear{2013} | ||
+ | \month{8} | ||
+ | \volume{1} | ||
+ | \issue{3} | ||
+ | \issn{1234-5678} | ||
+ | \pages{123--126} | ||
+ | \stoppublication | ||
+ | </pre><br/> | ||
+ | The split <pre>\artauthor</pre> fields are collapsed into a single <pre>author</pre> field as we deal with the splitting later when it gets parsed in Lua . The <pre>\artauthor</pre> syntax is only kept around for backward compatibility with the previous use of bibTEX . | ||
+ | <br/> | ||
+ | In the new setup we support these variants as well: | ||
+ | <pre detail='typing'> | ||
+ | \startpublication[k=Hagen:Third,t=article] | ||
+ | \author{Hans Hagen} | ||
+ | \title{Who knows who?} | ||
+ | ... | ||
+ | \stoppublication | ||
+ | </pre><br/> | ||
+ | and | ||
+ | <pre detail='typing'> | ||
+ | \startpublication[tag=Hagen:Third,category=article] | ||
+ | \author{Hans Hagen} | ||
+ | \title{Who knows who?} | ||
+ | ... | ||
+ | \stoppublication | ||
+ | </pre><br/> | ||
+ | and | ||
+ | <pre detail='typing'> | ||
+ | \startpublication | ||
+ | \tag{Hagen:Third} | ||
+ | \category{article} | ||
+ | \author{Hans Hagen} | ||
+ | \title{Who knows who?} | ||
+ | ... | ||
+ | \stoppublication | ||
+ | </pre><br/> | ||
+ | Because internally the entries are Lua tables, we also support loading of Lua based definitions: | ||
+ | <pre detail='typing'> | ||
+ | return { | ||
+ | ["Hagen:First"] = { | ||
+ | author = "Hans Hagen", | ||
+ | category = "article", | ||
+ | issn = "1234-5678", | ||
+ | issue = "3", | ||
+ | journal = "MyJournal", | ||
+ | month = "8", | ||
+ | pages = "123--126", | ||
+ | tag = "Hagen:First", | ||
+ | title = "Who knows nothing?", | ||
+ | volume = "1", | ||
+ | year = "2013", | ||
+ | }, | ||
+ | } | ||
+ | </pre><br/> | ||
+ | Files set up like this can be loaded too. The following xml input is rather close to this, and is also accepted as input. | ||
+ | <pre detail='typing'> | ||
+ | <?xml version="2.0" standalone="yes" ?> | ||
+ | <bibtex> | ||
+ | <entry tag="Hagen:First" category="article"> | ||
+ | <field name="author">Hans Hagen</field> | ||
+ | <field name="category">article</field> | ||
+ | <field name="issn">1234-5678</field> | ||
+ | <field name="issue">3</field> | ||
+ | <field name="journal">MyJournal</field> | ||
+ | <field name="month">8</field> | ||
+ | <field name="pages">123--126</field> | ||
+ | <field name="tag">Hagen:First</field> | ||
+ | <field name="title">Who knows nothing?</field> | ||
+ | <field name="volume">1</field> | ||
+ | <field name="year">2013</field> | ||
+ | </entry> | ||
+ | </bibtex> | ||
+ | </pre><br/> | ||
+ | Todo: Add some remarks about loading EndNote and RIS formats, but first we need to complete the tag mapping (on Alan’s plate). | ||
+ | <br/> | ||
+ | So the user has a rather wide choice of formatting style for bibliography database files. |
Revision as of 18:26, 15 January 2014
1 The database
The bibTEX format is rather popular in the TEX community and even with its shortcomings it will stay around for a while. Many publication websites can export and many tools are available to work with this database format. It is rather simple and looks a bit like Lua tables. Unfortunately the content can be polluted with non-standardized TEX commands which complicates pre- or postprocessing outside TEX . In that sense a bibTEX database is often not coded neutrally. Some limitations, like the use of commands to encode accented characters root in the ascii world and can be bypassed by using utf instead (as handled somewhat in LATEX through extensions such as
bibtex8
).
The normal way to deal with a bibliography is to refer to entries using a unique tag or key. When a list of entries is typeset, this reference can be used for linking purposes. The typeset list can be processed and sorted using the
bibtex
program that converts the database into something more TEX friendly (a
.bbl
file). I never used the program myself (nor bibliographies) so I will not go into too much detail here, if only because all I say can be wrong.
In ConTEXt we no longer use the
bibtex
program: we just use database files and deal with the necessary manipulations directly in ConTEXt . One or more such databases can be used and combined with additional entries defined within the document. We can have several such datasets active at the same time.
A bibTEX file looks like this:
@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", }
Normally a value is given between quotes (or curly brackets) but single words are also OK (there is no real benefit in not using quotes, so we advise to always use them). There can be many more fields and instead of strings one can use predefined shortcuts. The title for example quite often contains TEX macros. Some fields, like
pages
have funny characters such as the endash (typically as
--
) so we have a mixture of data and typesetting directives. If you are covering non--english references, you often need characters that are not in the ascii subset but ConTEXt is quite happy with utf . If your database file uses old-fashioned TEX accent commands then these will be internally converted automatically to utf . Commands (macros) are converted to an indirect call, which is quite robust.
The bibTEX files are loaded in memory as Lua table but can be converted to xml so that we can access them in a more flexible way, but that is a subject for specialists.
In the old MkII setup we have two kinds of entries: the ones that come from the bibTEX run and user supplied ones. We no longer rely on bibTEX output but we do still support the user supplied definitions. These were in fact prepared in a way that suits the processing of bibTEX generated entries. The next variant reflects the ConTEXt recoding of the old bibTEX output.
\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
The split
\artauthor
fields are collapsed into a single
author
field as we deal with the splitting later when it gets parsed in Lua . The
\artauthor
syntax is only kept around for backward compatibility with the previous use of bibTEX .
In the new setup we support these variants as well:
\startpublication[k=Hagen:Third,t=article] \author{Hans Hagen} \title{Who knows who?} ... \stoppublication
and
\startpublication[tag=Hagen:Third,category=article] \author{Hans Hagen} \title{Who knows who?} ... \stoppublication
and
\startpublication \tag{Hagen:Third} \category{article} \author{Hans Hagen} \title{Who knows who?} ... \stoppublication
Because internally the entries are Lua tables, we also support loading of Lua based definitions:
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", }, }
Files set up like this can be loaded too. The following xml input is rather close to this, and is also accepted as input.
<?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>
Todo: Add some remarks about loading EndNote and RIS formats, but first we need to complete the tag mapping (on Alan’s plate).
So the user has a rather wide choice of formatting style for bibliography database files.