diff options
author | Karl Berry <karl@freefriends.org> | 2018-01-17 23:47:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-01-17 23:47:37 +0000 |
commit | c3ad965169a16576b7214e764b9226ae7dd293f1 (patch) | |
tree | 6b84552588bec2d50394bb914b00ca4537f9331e /Master/texmf-dist/source | |
parent | 0dd1fb55e27838f2788f3e371825be277201f051 (diff) |
invoice2 (17jan18)
git-svn-id: svn://tug.org/texlive/trunk@46364 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/invoice2/invoice2.dtx | 154 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/invoice2/invoice2.ins | 6 |
2 files changed, 124 insertions, 36 deletions
diff --git a/Master/texmf-dist/source/latex/invoice2/invoice2.dtx b/Master/texmf-dist/source/latex/invoice2/invoice2.dtx index 93ffb629aa1..fba5861a081 100644 --- a/Master/texmf-dist/source/latex/invoice2/invoice2.dtx +++ b/Master/texmf-dist/source/latex/invoice2/invoice2.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: invoice2.dtx Copyright (C) 2017 Simon Dierl +% File: invoice2.dtx Copyright (C) 2017-2018 Simon Dierl % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -46,9 +46,9 @@ % \author{Simon Dierl % \texttt{\href{mailto:simon.dierl@cs.tu-dortmund.de} % {<simon.dierl@cs.tu-dortmund.de>}}\\[.25\baselineskip] -% \url{https://github.com/no-preserve-root/invoice2}} +% \url{https://github.com/no-preserve-root/invoice2}} % -% \date{Version 1.1\\[.25\baselineskip]\DTMDate{2017-08-16}} +% \date{Version 1.2\\[.25\baselineskip]\DTMDate{2018-01-15}} % % \maketitle % @@ -94,6 +94,9 @@ % \item[currency-fraction-digits] The fractional digits to use for the % currency. For almost all currencies, this is two (100 of the smaller % unit make 1 of the larger). Default is 2. +% \item[currency-in-header] Controls if the currency symbol should be +% printed in the invoice header instead of printing it after each amount. +% Default is printing after each amount. % \item[colorize] Enables colorization. While the typographical results may % be mixed, colorization can help read very long invoices. Default is % off. @@ -118,9 +121,10 @@ % package. \pkg{translations} uses a key-to-translation mapping that can be % overridden by the user. See the package documentation for further information. % -% At the moment, localizations for english and german are provided. See the -% documentation for the \pkg{translations} package for adding new localizations. -% Please consider contributing your translations to this project. +% At the moment, localizations for english, german and swiss german are +% provided. See the documentation for the \pkg{translations} package for adding +% new localizations. Please consider contributing your translations to this +% project. % % The following keys are defined: % \begin{description} @@ -194,10 +198,11 @@ % % Let us begin with a simple invoice with single items and no VAT. The invoice % will only have two columns and a gross total. We do, however, change the -% currency symbol to \euro{}. Since we only have single copies, we will use -% the \cmd{\invoicesingleitem} command. +% currency symbol to \euro{} (provided by the \pkg{eurosym} package). Since we +% only have single copies, we will use the \cmd{\invoicesingleitem} command. % % \begin{verbatim} +% \usepackage{eurosym} % \begin{invoice}[currency-symbol={\euro{}}] % \invoicesingleitem{Ignition!}{4087.99} % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99} @@ -210,10 +215,27 @@ % \invoicesingleitem{The TeXbook}{55.69} % \end{invoice} % +% For some currencies, the symbol ist fairly long. In this case, it is advisable +% to move the currency symbol to the invoice header. +% +% \begin{verbatim} +% \begin{invoice}[currency-symbol={CHF}, currency-in-header] +% \invoicesingleitem{Ignition!}{4087.99} +% \invoicesingleitem{The Art of Computer Programming 1--4}{162.99} +% \invoicesingleitem{The TeXbook}{55.69} +% \end{invoice} +% \end{verbatim} +% \begin{invoice}[currency-symbol={CHF}, currency-in-header] + % \invoicesingleitem{Ignition!}{4087.99} + % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99} + % \invoicesingleitem{The TeXbook}{55.69} + % \end{invoice} +% % Now, let us apply a VAT of 9\,\%. This will show the VAT column, the item % price column and the extended total. % % \begin{verbatim} +% \usepackage{eurosym} % \invoiceoptions{vat=.09} % \begin{invoice}[currency-symbol={\euro{}}] % \invoicesingleitem{Ignition!}{4087.99} @@ -233,6 +255,7 @@ % different. Additionally, we specify our options as environment options. % % \begin{verbatim} +% \usepackage{eurosym} % \begin{invoice}[vat=.09, included-vat=true, currency-symbol={\euro{}}] % \invoicesingleitem{Ignition!}{4087.99} % \invoicesingleitem{The Art of Computer Programming 1--4}{162.99} @@ -251,6 +274,7 @@ % TeXbook. This will enable all columns and an extended total. % % \begin{verbatim} +% \usepackage{eurosym} % \invoiceoptions{vat=.09} % \begin{invoice}[currency-symbol={\euro{}}] % \invoicesingleitem{Ignition!}{4087.99} @@ -271,6 +295,7 @@ % rows. % % \begin{verbatim} +% \usepackage{eurosym} % \begin{invoice}[currency-symbol={\euro{}}, colorize, % even-color={lightgray!50}] % \invoicesingleitem{Ignition!}{4087.99} @@ -287,6 +312,22 @@ % % \section{Version History} % +% \subsection{Version 1.2} +% \changes{1.2}{2018/01/15}{Bugfix release} +% \begin{itemize}[nosep] +% \item Fix option loading for the \pkg{xcolor} package. Thanks to Alfred +% H.\ Gitter for reporting. +% \item Corrected german translation of ``VAT'' to ``USt''. Thanks to Alfred +% H.\ Gitter for reporting. +% \item Clarified that \pkg{eurosym} is required to use the \cmd{euro} +% symbol. Thanks to Alfred H.\ Gitter for the suggestion. +% \item Split the \texttt{README.md} into a Github version and one for CTAN. +% \item Add support for Swiss German. Thanks to \texttt{@foreachthing} for +% the translation. +% \item Permit moving the currency symbol to the header. Thanks to +% \texttt{@foreachthing} for the report. +% \end{itemize} +% % \subsection{Version 1.1} % \changes{1.1}{2017/08/16}{Bugfix release} % \begin{itemize}[nosep] @@ -343,9 +384,10 @@ \RequirePackage{longtable} \RequirePackage{siunitx} \RequirePackage{translations} -\RequirePackage[table]{xcolor} +\PassOptionsToPackage{table}{xcolor} +\RequirePackage{xcolor} \RequirePackage{xparse} -\ProvidesExplPackage{invoice2}{2017/08/16}{1.1} +\ProvidesExplPackage{invoice2}{2018/01/15}{1.2} {Intelligent invoices with LaTeX3} % \end{macrocode} % @@ -355,6 +397,7 @@ % \begin{macrocode} \LoadDictionaryFor{english}{invoice2} \LoadDictionaryFor{german}{invoice2} +\LoadDictionaryFor{swissgerman}{invoice2} \DeclareTranslationFallback{invoice2-thousands-sep}{\,} \DeclareTranslationFallback{invoice2-decimal-point}{.} \DeclareTranslationFallback{invoice2-amount}{Amount} @@ -418,6 +461,16 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_currency_in_header_bool} +% Controls if the invoice currency symbol should be moved intro the table +% header (``Unit Price (\$)'') instead of printing it after each amount +% (``123.45\ \$''). Can save space for long currencies. +% +% \begin{macrocode} +\bool_new:N \l_@@_currency_in_header_bool +% \end{macrocode} +% \end{variable} +% % \subsection{Colorization} % % \begin{variable}{\l_@@_colorize_bool} @@ -557,6 +610,8 @@ currency-fraction-digits .int_set:N = \l_@@_currency_fraction_digits_int, currency-fraction-digits .value_required:n = true, currency-fraction-digits .initial:n = 2, + currency-in-header .bool_set:N = \l_@@_currency_in_header_bool, + currency-in-header .initial:n = false, colorize .bool_set:N = \l_@@_colorize_bool, colorize .initial:n = false, odd-color .initial:n = white, @@ -604,18 +659,18 @@ % centered or skipped, if all VATs are zero. The unit price and price columns % are right-justified; unit price is skipped if amount is. % -% Sind \pkg{longtable} refuses to expand the column specification, we force +% Since \pkg{longtable} refuses to expand the column specification, we force % prior expansion of the booleans. % % \begin{macrocode} \cs_new:Nn {\@@_print_begin_table:}{ - \exp_args:Nx \longtable { - \bool_if:NT \l_@@_amount_nonone_bool { c } - l - \bool_if:NT \l_@@_vat_nonzero_bool { c } - r - \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } { r } - } + \exp_args:Nx \longtable { + \bool_if:NT \l_@@_amount_nonone_bool { c } + l + \bool_if:NT \l_@@_vat_nonzero_bool { c } + r + \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } { r } + } } % \end{macrocode} % \end{macro} @@ -678,7 +733,12 @@ % \begin{macrocode} \cs_new:Nn {\@@_print_unit_price_title:}{ \bool_if:nT { \l_@@_amount_nonone_bool || \l_@@_vat_nonzero_bool } { - \@@_print_column_title:n {\GetTranslation{invoice2-unit-price}} & + \@@_print_column_title:n { + \GetTranslation{invoice2-unit-price} + \bool_if:NT \l_@@_currency_in_header_bool { + \ (\tl_use:N \l_@@_currency_symbol_tl) + } + } & } } % \end{macrocode} @@ -689,7 +749,11 @@ % % \begin{macrocode} \cs_new:Nn {\@@_print_price_title:}{ - \@@_print_column_title:n {\GetTranslation{invoice2-price}} + \@@_print_column_title:n {\GetTranslation{invoice2-price} + \bool_if:NT \l_@@_currency_in_header_bool { + \ (\tl_use:N \l_@@_currency_symbol_tl) + } + } } % \end{macrocode} % \end{macro} @@ -721,12 +785,12 @@ % % \begin{macrocode} \cs_new:Nn {\@@_print_real_value:n}{ - \num[round-integer-to-decimal, - group-minimum-digits=4, - group-separator={\GetTranslation{invoice2-thousands-sep}}, - output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{ - #1 - } + \num[round-integer-to-decimal, + group-minimum-digits=4, + group-separator={\GetTranslation{invoice2-thousands-sep}}, + output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{ + #1 + } } % \end{macrocode} % \end{macro} @@ -745,7 +809,9 @@ output-decimal-marker={\GetTranslation{invoice2-decimal-point}}]{ #1 } - \, \tl_use:N \l_@@_currency_symbol_tl + \bool_if:NF \l_@@_currency_in_header_bool { + \, \tl_use:N \l_@@_currency_symbol_tl + } } \cs_new:Nn {\@@_print_currency_value:N}{ \@@_print_currency_value:n {\fp_use:N #1} @@ -941,8 +1007,8 @@ % \begin{macrocode} \NewDocumentCommand{\invoiceitem}{ommm}{ \@@_add_row:nnnn {#2} {#3} - {\IfValueTF{#1}{#1}{\fp_use:N \l_@@_vat_fp}} - {#4} + {\IfValueTF{#1}{#1}{\fp_use:N \l_@@_vat_fp}} + {#4} } \NewDocumentCommand{\invoicesingleitem}{omm}{ \@@_add_row:nnnn {1} {#2} @@ -994,7 +1060,12 @@ % \begin{macrocode} \cs_new:Nn {\@@_print_net_item:}{ \bool_if:NT \l_@@_vat_nonzero_bool { - \@@_print_footer_item:n {\GetTranslation{invoice2-net-total}} + \@@_print_footer_item:n { + \GetTranslation{invoice2-net-total} + \bool_if:NT \l_@@_currency_in_header_bool { + \ (\tl_use:N \l_@@_currency_symbol_tl) + } + } \@@_print_currency_value:N \l_@@_net_total_fp \\ } } @@ -1019,7 +1090,12 @@ % % \begin{macrocode} \cs_new:Nn {\@@_print_gross_item:}{ - \@@_print_footer_item:n {\GetTranslation{invoice2-gross-total}} + \@@_print_footer_item:n { + \GetTranslation{invoice2-gross-total} + \bool_if:NT \l_@@_currency_in_header_bool { + \ (\tl_use:N \l_@@_currency_symbol_tl) + } + } \@@_print_currency_value:N \l_@@_gross_total_fp \\ } % \end{macrocode} @@ -1125,16 +1201,26 @@ \ProvideDictTranslation{invoice2-decimal-point}{,} \ProvideDictTranslation{invoice2-amount}{Anzahl} \ProvideDictTranslation{invoice2-item}{Posten} -\ProvideDictTranslation{invoice2-vat}{MwSt.} +\ProvideDictTranslation{invoice2-vat}{USt} \ProvideDictTranslation{invoice2-unit-price}{St\"uckpreis} \ProvideDictTranslation{invoice2-price}{Preis} \ProvideDictTranslation{invoice2-net-total}{Nettobetrag} -\ProvideDictTranslation{invoice2-vat-total}{MwSt.} +\ProvideDictTranslation{invoice2-vat-total}{USt} \ProvideDictTranslation{invoice2-gross-total}{Gesamtbetrag} %</dictGerman> % \end{macrocode} +% +% \subsection{Swiss German Dictionary} +% +% \begin{macrocode} +%<*dictSwissGerman> +\ProvideDictionaryFor{Swiss German}{invoice2} +\ProvideDictTranslation{invoice2-thousands-sep}{'} +\ProvideDictTranslation{invoice2-decimal-point}{.} +%</dictSwissGerman> +% \end{macrocode} % \end{implementation} % % \PrintChanges % \PrintIndex -%
\ No newline at end of file +% diff --git a/Master/texmf-dist/source/latex/invoice2/invoice2.ins b/Master/texmf-dist/source/latex/invoice2/invoice2.ins index d5026b6cca6..c4cd0bf567e 100644 --- a/Master/texmf-dist/source/latex/invoice2/invoice2.ins +++ b/Master/texmf-dist/source/latex/invoice2/invoice2.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -File invoice2.ins Copyright (C) 2017 Simon Dierl +File invoice2.ins Copyright (C) 2017-2018 Simon Dierl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. \preamble -Copyright (C) 2017 Simon Dierl +Copyright (C) 2017-2018 Simon Dierl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,5 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. \generate{\file{invoice2.sty} {\from{invoice2.dtx} {package}}} \generate{\file{invoice2-english.trsl} {\from{invoice2.dtx} {dictEnglish}}} \generate{\file{invoice2-german.trsl} {\from{invoice2.dtx} {dictGerman}}} +\generate{\file{invoice2-swissgerman.trsl} + {\from{invoice2.dtx} {dictSwissGerman}}} \endbatchfile |