latex-packages/wip/mkessler-bibliography.sty
2021-09-17 20:03:57 +02:00

39 lines
1.4 KiB
TeX

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-bibliography}[2021-09-06 - Package to easily print bibliography and image attributions in document]
%%%%%%%%%%%%%%%%%%
\RequirePackage{xkeyval}
\newif\ifenglish\englishtrue
\DeclareOptionX{german}{\englishfalse}
\DeclareOptionX{english}{\englishtrue}
\def\mkessler@bibliography@bibfile{bibliography.bib}
\def\mkessler@bibliography@imagefile{images.bib}
\DeclareOptionX{bibfile}[bibliography.bib]{\def\mkessler@bibliography@bibfile{#1}}
\DeclareOptionX{imagefile}[images.bib]{\def\mkessler@bibliography@imagefile{#1}}
\DeclareOptionX*{\PackageWarning{mkessler-bibliography}{Unknown '\CurrentOption'}}
\ProcessOptionsX\relax
%%%%Bibliography management
\RequirePackage[backend=biber,style=alphabetic]{biblatex}
\addbibresource{\mkessler@bibliography@bibfile}
\addbibresource{\mkessler@bibliography@imagefile}
%Provide simpler commands to properly print image attributions and literature
\DeclareRobustCommand*{\printimageattributions}{
\def\imageattributionstitle{\ifenglish Image attributions \else Bildquellen\fi}
\phantomsection
\addcontentsline{toc}{section}{\imageattributionstitle}
\printbibliography[title={\imageattributionstitle}, type=image]
}
\DeclareRobustCommand*{\printliterature}{
\def\literaturetitle{\ifenglish Literature\else Literatur\fi}
\phantomsection
\addcontentsline{toc}{section}{\literaturetitle}
\printbibliography[title={\literaturetitle}, nottype=image]
}