Difference between revisions of "Simple Bibliography"

From Wiki
Jump to navigation Jump to search
Line 1: Line 1:
(Version 0.03)
+
(Version 0.04)
  
 
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.
 
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
+
* interface should be multilingual (this version has german output, but it can be replaced easily)
 
* \item[...] should be rightaligned
 
* \item[...] should be rightaligned
* modulesparamter referenzfarbe is always empty
+
* modulesparamter refcolor is always empty - so not working
 +
* rewrite code into module-form
 +
 
  
 
<texcode>
 
<texcode>
\startmodule[quellenverzeichnis]
+
\startmodule[simplebib]
 +
 
 
\unprotect
 
\unprotect
  
\setupmodule[itemspace=12,referenzfarbe=red]
+
\setupmodule[itemspace=12,refcolor=grau]
 +
 
 +
\definecolor[grau][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}}}}%
  
\defineitemgroup[quellenverzeichnis]
+
\def\bibref[#1]#2{\doifemptyelse{#2}
\setupitemgroup[quellenverzeichnis][levels=1,left={[},right={]},stopper=]
+
{\color[grau]{[\in[#1]]}}
\expanded{\setupitemgroup[quellenverzeichnis][1][n,\currentmoduleparameter{itemspace}*broad]}  
+
{\color[grau]{[\in[#1], #2]}}}
  
\def\referenz[#1]#2{\doifemptyelse{#2}
+
\def\cbibref[#1][#2]#3{\doifemptyelse{#3}
{[\color[\currentmoduleparameter{referenzfarbe}]{\in[#1]]}}
+
{\color[#1]{[\in[#2]]}}
{[\color[\currentmoduleparameter{referenzfarbe}]{\in[#1], #2]}}}
+
{\color[#1]{[\in[#2], #3]}}}
        % problem: \currentmoduleparamter{referenzfarbe} is always empty :-(
 
  
\def\dekodiereQuelle#1[#2]
+
 
{\getparameters[tmp][autor=,herausgeber=,jahr=,titel=,in=,serie=,band=,heft=,auflage=,bauflage=,verlag=,ort=,isbn=,url=,seiten=,#2]%
+
\def\decodebibsource#1[#2]
\doifnot{\tmpautor}{}  {\tmpautor\doifnot{\tmpjahr}{}{ }}%
+
{\getparameters[tmp][author=,editor=,year=,title=,in=,series=,volume=,magazine=,edition=,revedition=, datedition=,publisher=,place=,isbn=,url=,pages=,#2]%
\doifnot{\tmpherausgeber}{}{\doifnot{\tmpautor}{}{ - }\tmpherausgeber~(Hrsg.)\doifnot{\tmpjahr}{}{ }}%
+
\doifnot{\tmpauthor}{}  {\tmpauthor\doifnot{\tmpyear}{}{ }}%
\doifnot{\tmpjahr}{}  {(\tmpjahr)}%
+
\doifnot{\tmpeditor}{}{\doifnot{\tmpauthor}{}{ - }\tmpeditor~(Hrsg.)\doifnot{\tmpyear}{}{ }}%
\doifelse{\tmpautor}{}
+
\doifnot{\tmpyear}{}  {(\tmpyear)}%
{\doifelse{\tmpherausgeber}{}%
+
\doifelse{\tmpauthor}{}
{\doifnot{\tmpjahr}{}{: }}{: }}{: }%
+
{\doifelse{\tmpeditor}{}%
\doifnot{\tmptitel}{}  {{\it \tmptitel}}%
+
{\doifnot{\tmpyear}{}{: }}{: }}{: }%
\doifnot{\tmpserie}{}  { aus der Reihe {\it \tmpserie}}%
+
\doifnot{\tmptitle}{}  {{\it \tmptitle}}%
\doifnot{\tmpband}{}  { (Band~\tmpband)}%
+
\doifnot{\tmpseries}{}  { aus der Reihe {\it \tmpseries}}%
\doifnot{\tmpheft}{}  { (Heft~\tmpheft)}%
+
\doifnot{\tmpvolume}{}  { (Band~\tmpvolume)}%
\doifnot{\tmpauflage}{}{, \tmpauflage.~Auflage}%
+
\doifnot{\tmpmagazine}{}  { (Heft~\tmpmagazine)}%
\doifnot{\tmpbauflage}{}{, \tmpbauflage.~überarbeitete Auflage}%
+
\doifnot{\tmpedition}{}{, \tmpedition.~Auflage}%
\doifnot{\tmpverlag}{} {, \tmpverlag}%
+
\doifnot{\tmprevedition}{}{, \tmprevedition.~überarbeitete Auflage}%
\doifnot{\tmport}{}    { \tmport}%
+
\doifnot{\tmpdatedition}{}{, Auflage vom \tmpdatedition}%
 +
\doifelse{\tmppublisher}{}{\doifnot{\tmpplace}{}{,}}{,}%
 +
\doifnot{\tmppublisher}{} { \tmppublisher}%
 +
\doifnot{\tmpplace}{}    { \tmpplace}%
 
\doifnot{\tmpisbn}{}  {, ISBN~\tmpisbn}%
 
\doifnot{\tmpisbn}{}  {, ISBN~\tmpisbn}%
\doifnot{\tmpseiten}{} {, S.~\tmpseiten}%
+
\doifnot{\tmppages}{} {, S.~\tmppages}%
 
\doifnot{\tmpurl}{}    {, \tmpurl}%
 
\doifnot{\tmpurl}{}    {, \tmpurl}%
   \doifnot{\tmpin}{}    { in \expanded{\dekodiereQuelle[\tmpin]}}
+
   \doifnot{\tmpin}{}    { in \expanded{\decodebibsource[\tmpin]}}
 
}
 
}
  
\def\quelle#1[#2]
+
\def\bibsource#1[#2]
{\getparameters[tmp][schluessel=,abkuerzung=,#2]
+
{\getparameters[tmp][key=,abbr=,#2]
\doifelse{\tmpabkuerzung}{}
+
\doifelse{\tmpabbr}{}
      {\item[\tmpschluessel]}
+
{\item[\tmpkey]}
      {\sym{\cap{\tmpabkuerzung}}\expanded{\textreference[\tmpschluessel]{\cap{\tmpabkuerzung}}}}%
+
{\sym{\cap{\tmpabbr}}\expanded{\textreference[\tmpkey]{\cap{\tmpabbr}}}}%
\dekodiereQuelle[#2]
+
\decodebibsource[#2]
 
}
 
}
 
 
\protect
 
\protect
 
\stopmodule
 
\stopmodule
 
\endinput
 
\endinput
</texcode>
 
 
And here is an example how to use it:
 
 
<texcode>
 
 
\usemodule[quellenverzeichnis]
 
 
\starttext
 
 
blabla blabla blabla blabla blabla\referenz[rv]{S. 4}
 
 
\chapter{Quellen}
 
\subject{Textrepräsentation}
 
\startquellenverzeichnis
 
 
\quelle[schluessel=cha8,autor={Paul, Hugo},jahr=2008,titel={Das Nirgendwo...},
 
in={titel={Die große Sammlung},herausgeber={Markoven, Heiner},
 
verlag={Frühschuss}}]
 
 
\stopquellenverzeichnis
 
\subsubject{Internationalität}
 
\startquellenverzeichnis[continue]
 
 
\quelle[schluessel=rv,abkuerzung=Etd05,autor={Etemad, Elika J.},jahr=2005,
 
titel={Robuts vertical text layout},serie={Technical Note},band=22,
 
verlag={Unicode Inc.},url={http://www.unicode.org/notes/tn22/}]
 
 
\stopquellenverzeichnis
 
  
\stoptext
+
<\texcode>
</texcode>
 

Revision as of 14:09, 27 November 2007

(Version 0.04)

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:

  • interface should be multilingual (this version has german output, but it can be replaced easily)
  • \item[...] should be rightaligned
  • modulesparamter refcolor is always empty - so not working
  • rewrite code into module-form


<texcode> \startmodule[simplebib]

\unprotect

\setupmodule[itemspace=12,refcolor=grau]

\definecolor[grau][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}{} Template:\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>