summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/qrbill/qrbill.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-07-25 03:01:17 +0000
committerNorbert Preining <norbert@preining.info>2023-07-25 03:01:17 +0000
commitbe53973de38a7aa9a3a0a8c70fd92bdf893c1a35 (patch)
tree50d18c7e399afeaa37df77a57667580ba93fea0a /macros/latex/contrib/qrbill/qrbill.dtx
parent19444d4440a66200b03e05b567996375d0404a46 (diff)
CTAN sync 202307250301
Diffstat (limited to 'macros/latex/contrib/qrbill/qrbill.dtx')
-rw-r--r--macros/latex/contrib/qrbill/qrbill.dtx204
1 files changed, 139 insertions, 65 deletions
diff --git a/macros/latex/contrib/qrbill/qrbill.dtx b/macros/latex/contrib/qrbill/qrbill.dtx
index c7739d81d3..4455b15575 100644
--- a/macros/latex/contrib/qrbill/qrbill.dtx
+++ b/macros/latex/contrib/qrbill/qrbill.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright (C) 2020–2023 by Marei Peischl (peiTeX) <marei@peitex.de>
%
@@ -30,7 +30,7 @@
% https://github.com/peitex/qrbill
% Please use the issue tracker for feedback!
%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \fi
% \iffalse
@@ -54,7 +54,7 @@
% \fi
% \iffalse
%<*driver>
-\ProvidesFile{qrbill.dtx}[2023/02/28 v2.00 \ create QR-bills based on the Swiss standard]
+\ProvidesFile{qrbill.dtx}[2023/07/24 v2.01 \ create QR-bills based on the Swiss standard]
\documentclass[english, parskip=half-]{scrartcl}
\usepackage{iftex}
\ifPDFTeX
@@ -76,6 +76,12 @@
\inputminted[autogobble, escapeinside=||,tabsize=4]{latex}{minted.doc.out}
}
+\newenvironment{doccode*}{
+ \VerbatimEnvironment
+ \begin{VerbatimOut}[tabsize=4]{minted.doc.out}}
+ {\end{VerbatimOut}
+ \inputminted[autogobble, escapeinside=||,tabsize=4]{latex}{minted.doc.out}
+}
\usepackage{babel}
\usepackage[babel]{csquotes}
@@ -161,6 +167,9 @@
\usepackage{qrbill}
+\usepackage{geometry}
+\geometry{left=4cm}
+
\usepackage[hidelinks]{hyperref}
\begin{document}
@@ -186,9 +195,7 @@
%
% By means of the \LaTeX{} framework, the qrbill can simply be integrated into existing accounting environments and automated billing systems.
% \iffalse
-% \begin{macrocode}
-%<*qrbill.sty>
-% \end{macrocode}
+%<*package>
% \fi
% \section{Example of use}
% The easies way to use the qrbill package is to create a bill with the standalone documentclass:
@@ -214,8 +221,9 @@
% \end{document}
% \end{doccode}
%
-% \DescribeMacro{\QRbill}\oarg{Data Setup}
+% \DescribeMacro{\QRbill}\sarg\oarg{Data Setup}
% The macro \latexinline{\QRbill} creates a box of 210\,mm${}\times{}$105\,mm size. It will include a qrbill as described in the design guide \cite{qrbill-design} and insert all available data.
+% The starred version (\latexinline{\QRbill*}) is only creating the QRcode without additional visible data. This is not necessarry for the swiss standard, but allows the usage with other QRcode schemes like the EPC QR codes (see section \ref{sec:epc}).
%
% There is also an example in the appendix showing all data fields (see appendix \ref{standalone-complete} on page \pageref{standalone-complete}).
%
@@ -287,10 +295,16 @@
% \changes{v2.00}{2023/02/28}{qrencode.lua now is part of the qrbill package}
% With Version 2.0 the package supports usage of the the luaqrcode library \cite{luaqrcode}. This can be enabled by using the \latexinline{qmode=lua} option.
%
-% \item[qrscheme (Name of a custom QRbill scheme) (swiss)]
-% Loads the definitions for the QRcode and the BillingInformation. Currently only the
-% swiss qrbill scheme is available, but one can define own variants based on this file.
-% Users can copy the file swiss.qrbill-cfg.tex as an example.
+% \changes{v2.01}{2023/07/24}{add qrsize option}
+% \item[qrsize (length) (46mm)]
+% Allows to change the size of the created QRcoode.
+% The default setting is chosen to match the swiss QRbills.
+%
+% \item[qrscheme (Name of a QRbill scheme e.g. swiss or epc) (swiss)]
+% Loads the definitions for the QRcode and the BillingInformation.
+% Currently only the swiss qrbill scheme (\latexinline{qrscheme=swiss}) and EPC QRcodes (\latexinline{qrscheme=epc}) are available, but one can define own variants based on this file.
+% Users can copy the file swiss.qrbill-cfg.tex as a template.
+% The package will look for a file named “\textlangle value of the qrscheme option\textrangle.qrbill-cfg.tex” to load the scheme.
%
% \changes{v1.02}{2020/08/25}{add referenceseparator option}
% \item[referenceseparator (tokenlist) (\textbackslash,)]
@@ -404,14 +418,14 @@
% \end{center}
% To set an address of type \enquote{K} one can use they option key \latexinline{debtor} or \latexinline{creditor}. Type \enquote{S} can be achieved using the starred variant (\latexinline{debtor*}/\latexinline{creditor*}).
%
-% \begin{minipage}{.5\linewidth}
+% \begin{minipage}{.4\linewidth}
% \begin{doccode}
% creditor={Name\\
% Street Nr.\\
% PostalCode City\\
% CountryCode},
% \end{doccode}
-% \end{minipage}%
+% \end{minipage}\hfill
% \begin{minipage}{.5\linewidth}
% \begin{doccode}
% creditor*={Name\\
@@ -479,42 +493,53 @@
% \par\medskip
% Data fields to automatically create the BillingInfo string. The key in parentheses indicates the prefix to be used to construct the string.\par
% \ExplSyntaxOn
-% \prop_map_inline:Nn \g__qrbill_billing_info_prop {#2~(#1)\\}
+% \prop_map_inline:Nn \g__qrbill_billing_info_prop {#2~(#1)\\}\strut
% \ExplSyntaxOff
-%
% \section{Setup for EPC QR codes}
+% \label{sec:epc}
% EPC QR codes can be used for SEPA credit transfer (SCT).
% They do not include any data about the debtor or tax information.
% Therefore they may only be used with the starred variant of \latexinline{\QRbill*} or the user has to provide additional data interfaces.
+%
+% To use this kind of QRcodes with qrbill one has to select the corresponding \latexinline{qrscheme}:
+% \begin{doccode}
+% \usepackage[qrscheme=epc]{qrbill}
+% \end{doccode}
% \subsection{Preconfigured data}
% \changes{v1.04}{2022/07/01}{Add basic support for EPC QR codes}
% The epc qrscheme provided by this package preset the following data:
% \begin{doccode}
% \SetupQrBill{
-% QRType=BCD,
-% Version=002,
-% CodingType=1,% UTF-8, 2 would be ISO
-% Trailer=SCT,
-% }
+% QRType=BCD,
+% Version=002,
+% CodingType=1,% UTF-8, 2 would be ISO
+% Trailer=SCT,
+% }
% \end{doccode}
% These fields are required to use these values for the current version of the EPC QR code.
%
% \subsection{Required data}
-% The data fields required by the EPC QRcode can be set directly. A full example for an easy EPC qrcode would be
-% \begin{doccode}
-% \QRbill*[
-% BIC=BYLADEM1GLS,
-% Account=DE68430609671013251700,
-% Name=peiTeX,
-% Amount=EUR123.42,
-% Message={Invoice 2022:1337, customer 1337}
-% ]
-% \end{doccode}
+% The data fields required by the EPC QRcode can be set directly. A full example for an easy EPC qrcode can be found in appendix \ref{sec:example-epc}.
+%
+% \subsection{Overview over all data fields}
+% \label{sec:epc-data-complete}
+% \changes{v2.01}{2023/07/24}{Add overview over all epc qrcode data fields}
+% Data fields which are used in the QRcode:\par
+% \begingroup
+% \ExplSyntaxOn
+% \file_get:nnN {epc.qrbill-cfg.tex} {\char_set_catcode_comment:N \% } \l_tmpa_tl
+% \let\endinput\relax
+% \l_tmpa_tl
+% \seq_use:Nn \g__qrbill_qrscheme_seq {\\}
+% \ExplSyntaxOff
+% \par\medskip
+% The DTA field is completly optional and can be used to encode the reason for the transfer.
+% \endgroup
% \iffalse
% \section{Implementation}
-% \begin{macrocode}
+% \begin{doccode*}
\RequirePackage{expl3}
-\ProvidesExplPackage{qrbill}{2023/02/28}{2.00}{
+\ProvidesExplPackage{qrbill}{2023/07/24}{2.01}{
Template for QR-bills based on the Swiss Payment Standards
}
\RequirePackage{iftex}
@@ -536,14 +561,21 @@
exists~for~backwards~compatibility~and~will~be~removed.
}
+\tl_new:N \g__qrbill_qrscheme_tl
+
\keys_define:nn {qrbill} {
font .choices:nn = {Frutiger, Arial, Helvetica, Liberation Sans} {
\tl_gset_eq:NN \g__qrbill_font_tl \l_keys_choice_tl
},
font .initial:n = Liberation Sans,
font / custom .code:n = {\tl_gclear:N \g__qrbill_font_tl},
- qrscheme .tl_gset:N = \g__qrbill_qrscheme_tl,
+ qrscheme .choice:,
+ qrscheme / epc .code:n = \tl_gset:Nn \g__qrbill_qrscheme_tl {epc}\tl_gclear:N \g__qrbill_font_tl,
+ qrscheme / unknown .code:n = \tl_gset:Nn \g__qrbill_qrscheme_tl {
+ #1},
qrscheme .initial:n = swiss,
+ qrsize .dim_gset:N = \g_qrbill_QRcode_dim,
+ qrsize .initial:n = 46mm,
creditorprefix .tl_gset:N = \g__qrbill_creditorprefix_tl,
creditorprefix .initial:n = CR-,
debtorprefix .tl_gset:N = \g__qrbill_debtorprefix_tl,
@@ -687,8 +719,6 @@
\RequirePackage{anyfontsize}
}
-\dim_new:N \g_qrbill_QRcode_dim
-\dim_gset:Nn \g_qrbill_QRcode_dim {46mm}
\bool_if:NT \g__qrbill_luamode_bool {
\lua_load_module:n {qrbill-latexluaqrcode}
@@ -697,22 +727,36 @@
\cs_set_protected:Npn \qrbill_qrcode_black: {\rule{\l__qrbill_QRblocksize_dim}{\l__qrbill_QRblocksize_dim}}
\cs_set_protected:Npn \qrbill_qrcode_white: {\rule{\l__qrbill_QRblocksize_dim}{0pt}\rule{0pt}{\l__qrbill_QRblocksize_dim}}
\cs_new:Nn \qrbill_parse_QRcode:n {
- \lua_now:e {
- num, string = printQRcode("\lua_escape:n {#1}")
- }
+ \__qrbill_setup_lua_qrcode:x {#1}
\dim_set:Nn \l__qrbill_QRblocksize_dim {\g_qrbill_QRcode_dim/\lua_now:n {tex.print(num)}}
\let\qrblack\qrbill_qrcode_black:
\let\qrwhite\qrbill_qrcode_white:
\def\qrnewline{\\[\dimexpr-\baselineskip+\l__qrbill_QRblocksize_dim]}
- \noindent\parbox{\g_qrbill_QRcode_dim}{
- \lua_now:n {tex.sprint(string)}
+% \end{doccode*}
+% \changes{v2.01}{2023/07/24}{fix icon alignment for qrmode=lua}
+% \begin{doccode*}
+ \raisebox{\dimexpr\depth-\l__qrbill_QRblocksize_dim}[\dimexpr\height+\depth-\l__qrbill_QRblocksize_dim][0pt]{
+ \noindent\parbox{\g_qrbill_QRcode_dim}{
+ \lua_now:n {tex.sprint(string)}
+ \hss
+ }
}
}
+
+ \cs_new:Nn \__qrbill_setup_lua_qrcode:n {
+ \lua_now:e {
+ num, string = printQRcode("\lua_escape:n {#1}")
+ }
+ }
+
+ \cs_generate_variant:Nn \__qrbill_setup_lua_qrcode:n {x}
}
-% \end{macrocode}
+
+
+% \end{doccode*}
% \changes{v1.07}{2022/10/20}{patch the qrcode package to work with utf-8 strings}
-% \begin{macrocode}
+% \begin{doccode*}
\bool_if:NF \g__qrbill_luamode_bool {
\usepackage{qrcode}
@@ -765,7 +809,10 @@
\cs_set_eq:NN \qr@encode@binary \__qrbill_encode_unicode_binary:n
\raisebox{\depth}{
\__qrbill_enable_unicode_qrcode_patch:
- \qrcode[height= \g_qrbill_QRcode_dim]{#1}
+% \end{doccode*}
+% \changes{v2.01}{2023/07/24}{Disable hyperlink for qrcode in case hyperref is loaded}
+% \begin{doccode*}
+ \qrcode[nolink,height= \g_qrbill_QRcode_dim]{#1}
}
}
@@ -1033,7 +1080,19 @@
\IfBooleanTF {#1}
{
\qrcode_setup_QRcode:
- \qrbill_parse_QRcode:V \l_qrbill_data_str
+ \leavevmode\qrbill_parse_QRcode:V \l_qrbill_data_str
+% \end{doccode*}
+% \changes{v2.01}{2023/07/24}{Add icon support for epc qrcodes}
+% \begin{doccode*}
+ \tl_if_empty:NF \g_qrbill_icon_tl {
+ \llap{\hbox_to_wd:nn {\g_qrbill_QRcode_dim} {
+ \hfill
+ \raisebox{\dimexpr-.5\height+.5\g_qrbill_QRcode_dim}[0pt][0pt]{
+ \includegraphics[width=\g_qrbill_iconwidth_dim]{\g_qrbill_icon_tl}
+ }
+ \hfill
+ }}
+ }
}{
\qrbill_bill_create:
}
@@ -1300,9 +1359,8 @@
\input{\g__qrbill_qrscheme_tl.qrbill-cfg}
-% \end{macrocode}
-% \begin{macrocode}
-%</qrbill.sty>
+% \end{doccode*}
+%</package>
% \section{The file swiss.qrbill-cfg.tex as a custom qrbill scheme}
%<*swiss.qrbill-cfg.tex>
\qrbillsetup{
@@ -1387,18 +1445,16 @@
invoicedate=\QRbillParseDate{\the\year}{\the\month}{\the\day},
vatdate=\QRbillParseDate{\the\year}{\the\month}{\the\day}
}
-% \end{macrocode}
+% \end{doccode*}
% \iffalse
-% \begin{macrocode}
%</swiss.qrbill-cfg.tex>
-% \end{macrocode}
-% \section{The file epc.qrbill-cfg.tex as a custom qrbill scheme}
+% \section{The file epc.qrbill-cfg.tex as additional qrbill scheme}
% This scheme supports much less variables in contrast to the swiss scheme.
% Therefore the \latexinline{\QRbill} macro has to be used as the starred variant or additional variables have to be provided by the user.
%<*epc.qrbill-cfg.tex>
-% \end{macrocode}
+% \end{doccode*}
% \fi
-% \begin{macrocode}
+% \begin{doccode*}
\SetQrScheme{
QRType,
Version,
@@ -1421,7 +1477,7 @@
Trailer=SCT,
}
%</epc.qrbill-cfg.tex>
-% \end{macrocode}
+% \end{doccode*}
% \fi
%
% \PrintChanges
@@ -1436,11 +1492,9 @@
% \changes{v1.03}{2021/05/07}{set sep-iban and sep-reference in examples}
% \label{standalone-complete}
% \iffalse
-% \begin{macrocode}
%<*qrbill-standalone-demo.tex>
-% \end{macrocode}
% \fi
-% \begin{macrocode}
+% \begin{doccode*}
% !TeX program=lualatex
\documentclass{standalone}
\usepackage[nswissgerman]{babel}
@@ -1480,15 +1534,14 @@
]
\end{document}
-% \end{macrocode}
+% \end{doccode*}
% \iffalse
-% \begin{macrocode}
%</qrbill-standalone-demo.tex>
%<*qrbill-letter-demo.tex>
-% \end{macrocode}
% \fi
% \section{qrbill scrletter example}
-% \begin{macrocode}
+% \label{sec:example-qrbill-letter}
+% \begin{doccode*}
% !TeX Program=lualatex
\documentclass[foldmarks=b]{scrletter}
\usepackage[
@@ -1552,12 +1605,33 @@ Text
\end{letter}
\end{document}
-% \end{macrocode}
-%
+% \end{doccode*}
% \iffalse
-% \begin{macrocode}
%</qrbill-letter-demo.tex>
-% \end{macrocode}
+%<*qrbill-epc-demo.tex>
+% \fi
+% \section{Example for EPC qrcode}
+% \label{sec:example-epc}
+% \changes{v2.01}{2023/07/24}{edd epc qrcode example document}
+% \begin{doccode*}
+\documentclass{article}
+\usepackage[qrscheme=epc]{qrbill}
+
+\begin{document}
+
+\QRbill*[
+ BIC=BYLADEM1GLS,
+ Account=DE68430609671013251700,
+ Name=peiTeX,
+ Amount=EUR1 .42,
+ Message={Invoice 2022:1337, customer 1337}
+]
+
+\end{document}
+% \end{doccode*}
+% \iffalse
+%\endinput
+%</qrbill-epc-demo.tex>
% \fi
%\Finale
\endinput