summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cnltx/cnltx.bbx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/cnltx/cnltx.bbx
Initial commit
Diffstat (limited to 'macros/latex/contrib/cnltx/cnltx.bbx')
-rw-r--r--macros/latex/contrib/cnltx/cnltx.bbx205
1 files changed, 205 insertions, 0 deletions
diff --git a/macros/latex/contrib/cnltx/cnltx.bbx b/macros/latex/contrib/cnltx/cnltx.bbx
new file mode 100644
index 0000000000..1fd4dc2b1b
--- /dev/null
+++ b/macros/latex/contrib/cnltx/cnltx.bbx
@@ -0,0 +1,205 @@
+% --------------------------------------------------------------------------
+% the CNLTX bundle
+%
+% LaTeX source code and output
+%
+% --------------------------------------------------------------------------
+% Clemens Niederberger
+% Web: https://github.com/cgnieder/cnltx/
+% E-Mail: contact@mychemistry.eu
+% --------------------------------------------------------------------------
+% Copyright 2013-2014 Clemens Niederberger
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Clemens Niederberger.
+% --------------------------------------------------------------------------
+% If you have any ideas, questions, suggestions or bugs to report, please
+% feel free to contact me.
+% --------------------------------------------------------------------------
+\RequirePackage{cnltx-base}
+\ProvidesFile{cnltx.bbx}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info]
+
+\cnltx@load@modules{example,tools,translations}
+
+\RequireBibliographyStyle{alphabetic}
+\ExecuteBibliographyOptions{block=ragged,useprefix=true}
+
+\DeclareBibliographyDriver{latex}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+ \usebibmacro{maintainer}%
+ \setunit{\labelnamepunct}\newblock
+ \usebibmacro{title+subtitle}%
+ \printfield{version}%
+ \setunit{\addcomma\addspace}%
+ \usebibmacro{date}%
+ \newunit\newblock
+ \usebibmacro{url+urldate}%
+ \newunit\newblock
+ \usebibmacro{finentry}%
+}
+\DeclareBibliographyAlias{package}{latex}
+\DeclareBibliographyAlias{class}{latex}
+\DeclareBibliographyAlias{bundle}{latex}
+
+\newbibmacro{title+subtitle}{%
+ \iffieldundef{title}{}{%
+ \printfield{title}%
+ \ifbibindex{\indexfield{title}}{}%
+ \setunit{\adddot\addspace}%
+ \iffieldundef{subtitle}{}{%
+ \printfield{subtitle}%
+ \setunit{\adddot\addspace}%
+ }%
+ }%
+}
+
+\newbibmacro*{maintainer}{%
+ \printtext{%
+ \ifnameundef{maintainer}
+ {}
+ {%
+ \addcomma\addspace
+ \ifnumgreater{\value{maintainer}}{1}
+ {\GetTranslation{cnltx-maintainers}}
+ {\GetTranslation{cnltx-maintainer}}%
+ \addcolon\addspace
+ \printnames{maintainer}%
+ }%
+ }%
+}
+
+\renewcommand*{\mkbibnamelast}[1]{\cnltx@write@lastname{#1}}
+\renewcommand*{\mkbibnamefirst}[1]{\cnltx@write@firstname{#1}}
+\renewcommand*{\mkbibnameprefix}[1]{\cnltx@write@lastname{#1}}
+
+\DeclareNameAlias[package]{maintainer}{default}
+\DeclareNameAlias[class]{maintainer}{default}
+\DeclareNameAlias[bundle]{maintainer}{default}
+
+\RequirePackage{translations}
+\DeclareTranslationFallback{cnltx-maintainer}{current maintainer}
+\DeclareTranslation{English}{cnltx-maintainer}{current maintainer}
+\DeclareTranslation{German}{cnltx-maintainer}{aktueller Maintainer}
+
+\DeclareTranslationFallback{cnltx-maintainers}{current maintainers}
+\DeclareTranslation{English}{cnltx-maintainers}{current maintainers}
+\DeclareTranslation{German}{cnltx-maintainers}{aktuelle Maintainer}
+
+\DeclareFieldFormat[package]{title}{\pkg*{#1}}
+\DeclareFieldFormat[class]{title}{\cls*{#1}}
+\DeclareFieldFormat[bundle]{title}{\bnd*{#1}}
+
+\DeclareIndexFieldFormat[package]{title}{%
+ \ifstrequal{#1}{\KOMAScript}
+ {\pkgidx[KOMA-Script]{\KOMAScript}}
+ {\pkgidx{#1}}%
+}
+\DeclareIndexFieldFormat[class]{title}{%
+ \ifstrequal{#1}{\KOMAScript}
+ {\clsidx[KOMA-Script]{\KOMAScript}}
+ {\clsidx{#1}}%
+}
+\DeclareIndexFieldFormat[bundle]{title}{%
+ \ifstrequal{#1}{\KOMAScript}
+ {\bndidx[KOMA-Script]{\KOMAScript}}
+ {\bndidx{#1}}%
+}
+
+\DeclareIndexFieldFormat[package]{indextitle}{%
+ \ifstrequal{#1}{\KOMAScript}
+ {\pkgidx[KOMA-Script]{\KOMAScript}}
+ {\pkgidx{#1}}%
+}
+\DeclareIndexFieldFormat[class]{indextitle}{%
+ \ifstrequal{#1}{\KOMAScript}
+ {\clsidx[KOMA-Script]{\KOMAScript}}
+ {\clsidx{#1}}%
+}
+\DeclareIndexFieldFormat[bundle]{indextitle}{%
+ \ifstrequal{#1}{\KOMAScript}
+ {\bndidx[KOMA-Script]{\KOMAScript}}
+ {\bndidx{#1}}%
+}
+
+\def\cnltx@onlyonefirstname#1\bibnamedelima#2\q@stop{#1}
+
+\DeclareIndexNameFormat{cnltx}{%
+ \cnltx@if@in{#3}{\bibnamedelima}
+ {%
+ \usebibmacro{index:entry}{\index}{%
+ \ifblank{#5}{}{#5 }%
+ \@firstofone#1%
+ \ifblank{#3}{}{, \cnltx@onlyonefirstname#3\q@stop}%
+ \actualoperator
+ \ifblank{#5}
+ {\cnltx@write@lastname{#1}}
+ {\cnltx@write@lastname{#5 #1}}%
+ \ifblank{#3}{}{, \cnltx@write@firstname{\cnltx@onlyonefirstname#3\q@stop}}%
+ }%
+ }
+ {%
+ \usebibmacro{index:entry}{\index}{%
+ \ifblank{#5}{}{#5 }%
+ \@firstofone#1%
+ \ifblank{#3}{}{, #3}%
+ \actualoperator
+ \ifblank{#5}
+ {\cnltx@write@lastname{#1}}
+ {\cnltx@write@lastname{#5 #1}}%
+ \ifblank{#3}{}{, \cnltx@write@firstname{#3}}%
+ }%
+ }%
+}
+
+\DeclareIndexNameAlias{labelname}{cnltx}
+\DeclareIndexNameAlias{author}{cnltx}
+\DeclareIndexNameAlias{maintainer}{cnltx}
+\DeclareIndexNameAlias{labelname}{cnltx}
+\DeclareIndexNameAlias{author}{cnltx}
+\DeclareIndexNameAlias{maintainer}{cnltx}
+\DeclareIndexNameAlias{labelname}{cnltx}
+\DeclareIndexNameAlias{author}{cnltx}
+\DeclareIndexNameAlias{maintainer}{cnltx}
+
+\DeclareFieldFormat[package]{subtitle}{\mkbibemph{#1}}
+\DeclareFieldFormat[class]{subtitle}{\mkbibemph{#1}}
+\DeclareFieldFormat[bundle]{subtitle}{\mkbibemph{#1}}
+
+\DeclareLabelname[package,class,bundle]{%
+ \field{shortauthor}
+ \field{author}
+ \field{maintainer}
+ \field{shorteditor}
+ \field{editor}
+ \field{translator}
+}
+
+\DeclareDriverSourcemap[datatype=bibtex]{
+ \map{
+ \step[fieldsource=info, fieldtarget=subtitle]
+ }
+}
+
+\endinput
+
+HISTORY:
+2013/09/14 v0.4 - first version added to the bundle
+2013/10/04 v0.7a - added drivers `@class' and `@bundle'
+2013/11/22 v0.9 - made independent from the `cnltx-doc' class
+2014/03/11 v0.11 - change name format so that names are printed according to
+ the format of the \newname commands from the `tools'
+ module;
+ this is going to need tests if it really is consistent
+ for different types of name formats (prefixes, affixes...)
+