Difference between revisions of "Simple Bibliography"

From ConTeXt wiki
m (Another Approach)
(Replaced content with "<div style="color: red">Page in progress...</div> Sometimes the bibliography needs to be more flexible in the bibliographic item description. For this case exists the module...")
Line 1: Line 1:
= First Approach =
+
<div style="color: red">Page in progress...</div>
  
(Version 0.04)
+
Sometimes the bibliography needs to be more flexible in the bibliographic item description. For this case exists the module simplebib.
 
 
Sometimes the bibliography needs to be more flexible. For this case here is a simple module (still in development) to help. It is also a good starting-point for your own adaption.
 
  
 
Still open points:
 
Still open points:
* interface should be multilingual (this version has german output, but it can be replaced easily)
 
 
* \item[...] should be rightaligned
 
* \item[...] should be rightaligned
* modulesparamter refcolor is always empty - so not working
 
 
 
<texcode>
 
\startmodule[simplebib]
 
 
\unprotect
 
 
\setupmodule[itemspace=12,refcolor=grey]
 
 
\definecolor[grey][s=.35]
 
 
\defineitemgroup[bibliography]
 
\setupitemgroup[bibliography][levels=1,left={[},right={]},stopper=]
 
\expanded{\setupitemgroup[bibliography][1][n,\currentmoduleparameter{itemspace}*broad]}
 
 
 
\def\bibitem[#1]#2{\doifemptyelse{#2}%
 
{\item[#1]}%
 
{\sym{\cap{#2}}\textreference[#1]{\cap{#2}}}}%
 
 
\def\bibref[#1]#2{\doifemptyelse{#2}
 
{\color[grau]{[\in[#1]]}}
 
{\color[grau]{[\in[#1], #2]}}}
 
 
\def\cbibref[#1][#2]#3{\doifemptyelse{#3}
 
{\color[#1]{[\in[#2]]}}
 
{\color[#1]{[\in[#2], #3]}}}
 
 
 
\def\decodebibsource#1[#2]
 
{\getparameters[tmp][author=,editor=,year=,title=,in=,series=,volume=,magazine=,edition=,revedition=, datedition=,publisher=,place=,isbn=,url=,pages=,#2]%
 
\doifnot{\tmpauthor}{}  {\tmpauthor\doifnot{\tmpyear}{}{ }}%
 
\doifnot{\tmpeditor}{}{\doifnot{\tmpauthor}{}{ - }\tmpeditor~(Hrsg.)\doifnot{\tmpyear}{}{ }}%
 
\doifnot{\tmpyear}{}  {(\tmpyear)}%
 
\doifelse{\tmpauthor}{}
 
{\doifelse{\tmpeditor}{}%
 
{\doifnot{\tmpyear}{}{: }}{: }}{: }%
 
\doifnot{\tmptitle}{}  {{\it \tmptitle}}%
 
\doifnot{\tmpseries}{}  { aus der Reihe {\it \tmpseries}}%
 
\doifnot{\tmpvolume}{}  { (Band~\tmpvolume)}%
 
\doifnot{\tmpmagazine}{}  { (Heft~\tmpmagazine)}%
 
\doifnot{\tmpedition}{}{, \tmpedition.~Auflage}%
 
\doifnot{\tmprevedition}{}{, \tmprevedition.~überarbeitete Auflage}%
 
\doifnot{\tmpdatedition}{}{, Auflage vom \tmpdatedition}%
 
\doifelse{\tmppublisher}{}{\doifnot{\tmpplace}{}{,}}{,}%
 
\doifnot{\tmppublisher}{} { \tmppublisher}%
 
\doifnot{\tmpplace}{}    { \tmpplace}%
 
\doifnot{\tmpisbn}{}  {, ISBN~\tmpisbn}%
 
\doifnot{\tmppages}{} {, S.~\tmppages}%
 
\doifnot{\tmpurl}{}    {, \tmpurl}%
 
  \doifnot{\tmpin}{}    { in \expanded{\decodebibsource[\tmpin]}}
 
}
 
 
\def\bibsource#1[#2]
 
{\getparameters[tmp][key=,abbr=,#2]
 
\doifelse{\tmpabbr}{}
 
{\item[\tmpkey]}
 
{\sym{\cap{\tmpabbr}}\expanded{\textreference[\tmpkey]{\cap{\tmpabbr}}}}%
 
\decodebibsource[#2]
 
}
 
\protect
 
\stopmodule
 
\endinput
 
 
</texcode>
 
 
= Another Approach =
 
 
Here is another manual approach for simple bibliographies.
 
 
<texcode>
 
\definereferenceformat[cite][left={[},right={]}]
 
\defineitemgroup [bibliography] [levels=1]
 
\setupitemgroup  [bibliography]
 
                [symbol=n,
 
                  left={[},
 
                  right={]},
 
                  width=1.5em,
 
                  stopper=,
 
                  itemalign=flushright,
 
                  inbetween={\blank[4pt]}]
 
 
 
\appendtoks
 
  \let \bibitem \itemgroupitem
 
\to \itemgroupcommands
 
</texcode>
 
  
Now you can use
+
''Items''
  
<texcode>
+
''Referencing''
\section{References}
 
\startbibliography
 
  \bibitem[ref1] This is my first reference
 
  \bibitem[ref2] This is the second reference
 
\stopbibliography
 
</texcode>
 
  
and use <code>\cite[ref1]</code> etc to refer to bibliography items.
+
''Settings''

Revision as of 09:58, 13 October 2012

Page in progress...

Sometimes the bibliography needs to be more flexible in the bibliographic item description. For this case exists the module simplebib.

Still open points:

  • \item[...] should be rightaligned

Items

Referencing

Settings