summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bib2qr/bib2qr.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/bib2qr/bib2qr.sty')
-rw-r--r--Master/texmf-dist/tex/latex/bib2qr/bib2qr.sty107
1 files changed, 107 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/bib2qr/bib2qr.sty b/Master/texmf-dist/tex/latex/bib2qr/bib2qr.sty
new file mode 100644
index 00000000000..093c38dba6d
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bib2qr/bib2qr.sty
@@ -0,0 +1,107 @@
+%%
+%% This is file `bib2qr.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bib2qr.dtx (with options: `package')
+%%
+%% Copyright (C) 2024 Christian Schreinemachers
+%%
+%% This work may be distributed and/or modified under the conditions
+%% of the LaTeX Project Public License, either version 1.3c 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.3c or later is part of all distributions of LaTeX
+%% version 2008-05-04 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The current maintainer of this work is
+%% Christian Schreinemachers.
+%%
+%% This work consists of the files
+%% bib2qr.dtx
+%% bib2qr.ins
+%% and the derived files
+%% bib2qr.sty
+%% bib2qr.pdf
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bib2qr}
+ [2024-07-31 v0.2 Cite BibTeX entries with QR codes]
+\RequirePackage{biblatex}
+\RequirePackage{ifthen}
+\RequirePackage{qrcode}
+\RequirePackage{xstring}
+\DeclareKeys[@bibiiqr]{
+ doiurlbase.store = \@bibiiqr@doiurlbase,
+ doiurlbase.usage = load,
+ qrdelimiter.store = \@bibiiqr@qrdelimiter,
+ qrdelimiter.usage = load,
+ qrversion.store = \@bibiiqr@qrversion,
+ qrversion.usage = load,
+ qrwidth.store = \@bibiiqr@qrwidth,
+ qrwidth.usage = load,
+}%
+\SetKeys[@bibiiqr]{
+ doiurlbase=https://doi.org/,
+ qrdelimiter=\space,
+ qrversion=0,
+ qrwidth=2cm,
+}%
+\ProcessKeyOptions[@bibiiqr]\relax
+\newcommand\@bibiiqr@showqr[1]{%
+ \qrcode[height=\@bibiiqr@qrwidth,version=\@bibiiqr@qrversion]{#1}%
+}%
+\DeclareFieldFormat{@bibiiqr@fldFmtDoi}{%
+ \IfBeginWith{#1}{\@bibiiqr@doiurlbase}%
+ {\@bibiiqr@showqr{#1}}%
+ {\@bibiiqr@showqr{\@bibiiqr@doiurlbase#1}}%
+}%
+\DeclareFieldFormat{@bibiiqr@fldFmtUrl}{\@bibiiqr@showqr{#1}}
+\DeclareBibliographyDriver{@bibiiqr@bibDrvQR}{%
+ \usebibmacro{begentry}%
+ \ifboolexpr{test{\iffieldundef{doi}}}
+ {%
+ \ifboolexpr{test{\iffieldundef{url}}}%
+ {%
+ \PackageWarning{bib2qr}%
+ {BibTeX entry without DOI or URL: \thefield{entrykey}}{}%
+ }%
+ {\printfield[@bibiiqr@fldFmtUrl]{url}}%
+ }%
+ {\printfield[@bibiiqr@fldFmtDoi]{doi}}%
+ \usebibmacro{finentry}%
+}
+\DeclareCiteCommand{\qrcite}
+ {\usebibmacro{prenote}}%
+ {\usedriver{}{@bibiiqr@bibDrvQR}}%
+ {\@bibiiqr@qrdelimiter}%
+ {\usebibmacro{postnote}}%
+\NewDocumentCommand{\qrfullcite}{O{}m}{%
+ \par%
+ \ifthenelse{\equal{#1}{noindent}}{%
+ \noindent%
+ \edef\@bibiiqr@mpiiwidth{\dimexpr\linewidth-\@bibiiqr@qrwidth-0.5em}%
+ }{%
+ \edef\@bibiiqr@mpiiwidth{%
+ \dimexpr\linewidth-\parindent-\@bibiiqr@qrwidth-0.5em}%
+ }%
+ \begin{minipage}[t]{\@bibiiqr@qrwidth}
+ \qrcite{#2}%
+ \end{minipage}
+ \hspace{0.5em}%
+ \begin{minipage}{\@bibiiqr@mpiiwidth}
+ \fullcite{#2}%
+ \end{minipage}
+ \par%
+}%
+
+\endinput
+%%
+%% End of file `bib2qr.sty'.