From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/fnumprint/README | 36 ++++ macros/latex/contrib/fnumprint/fnumprint.dtx | 291 +++++++++++++++++++++++++++ macros/latex/contrib/fnumprint/fnumprint.ins | 23 +++ macros/latex/contrib/fnumprint/fnumprint.pdf | Bin 0 -> 253967 bytes 4 files changed, 350 insertions(+) create mode 100644 macros/latex/contrib/fnumprint/README create mode 100644 macros/latex/contrib/fnumprint/fnumprint.dtx create mode 100644 macros/latex/contrib/fnumprint/fnumprint.ins create mode 100644 macros/latex/contrib/fnumprint/fnumprint.pdf (limited to 'macros/latex/contrib/fnumprint') diff --git a/macros/latex/contrib/fnumprint/README b/macros/latex/contrib/fnumprint/README new file mode 100644 index 0000000000..fc6022882b --- /dev/null +++ b/macros/latex/contrib/fnumprint/README @@ -0,0 +1,36 @@ +LaTeX package 'fnumprint' +~~~~~~~~~~~~~~~~~~~~~~~~~ +Copyright (C) 2012-2013 by Robin Schneider + +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. + +CTAN: http://www.ctan.org/pkg/fnumprint +Code repository: https://github.com/ypid/latex-packages/tree/master/fnumprint + + + DESCRIPTION +The fnumprint package defines two macros which decide to typeset a number +either as Arabic number or as word name for the number. If the number is +between zero and twelve (including zero and twelve) then the word name will be +used. This package uses the zahl2string package to convert a number in the +word name in German. The conversion of a number (0--12) to the English word +name is implemented by this package. If the number is outside of the range then +it will be typesetted with the numprint package. + + + GENERATING THE FILES +You can generate the fnumprint.sty file with: pdflatex fnumprint.ins + +The documentation can be generated with: +pdflatex fnumprint.dtx +makeindex -s gglo.ist -o fnumprint.gls fnumprint.glo +makeindex -s gind fnumprint +pdflatex fnumprint.dtx +thumbpdf fnumprint +pdflatex fnumprint.dtx diff --git a/macros/latex/contrib/fnumprint/fnumprint.dtx b/macros/latex/contrib/fnumprint/fnumprint.dtx new file mode 100644 index 0000000000..88eccd6e45 --- /dev/null +++ b/macros/latex/contrib/fnumprint/fnumprint.dtx @@ -0,0 +1,291 @@ +% \iffalse meta-comment +% +% Copyright (C) 2012-2013 by Robin Schneider +% +% 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. +% +% The Current Maintainer of this work is Robin Schneider. +% +% This work consists of the files fnumprint.dtx and fnumprint.ins +% and the derived filebase fnumprint.sty. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{fnumprint.dtx} +% +%%% See file 'fnumprint.dtx' for copyright and licence. +%\NeedsTeXFormat{LaTeX2e}[1998/12/01] +%\ProvidesPackage{fnumprint} +%<*package> + [2012/08/27 v1.1a Printing fancy numbers] +% +% +%<*driver> +\documentclass[english]{ltxdoc} +\newcommand{\PackageURL}{https://github.com/ypid/latex-packages/tree/master/fnumprint} +\newcommand{\PackageCTANURL}{http://www.ctan.org/pkg/fnumprint} +\newcommand{\PackageAuthor}{Robin Schneider} +\newcommand{\PackageAuthorEmail}{ypid23@aol.de} +\newcommand{\PackageName}{\PrintPackage{fnumprint}} +\newcommand{\PrintPackage}[1]{\textsf{#1}} +\usepackage{fnumprint} +\usepackage{ + babel, + csquotes, + xcolor, + url, + hypdoc, +} +\GetFileInfo{fnumprint.dtx} +\hypersetup{ + pdftitle={A manual for \PackageName}, + pdfauthor={\PackageAuthor{} <\PackageAuthorEmail>}, + pdfsubject={\fileinfo}, + baseurl={\PackageURL}, + pdfkeywords={This document corresponds to \PackageName~\fileversion, + dated \filedate} +} + +\title{The \PackageName{} package\thanks{This document +corresponds to \PackageName~\fileversion, dated \filedate.}} +\author{\PackageAuthor \\ + \texttt{\href{mailto:\PackageAuthorEmail?subject=LaTeX package fnumprint% + \&body=Dear Robin Schneider,}% + {\PackageAuthorEmail}% + }% +} + +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{fnumprint.dtx} + \PrintChanges + \PrintIndex +\end{document} +% +% \fi +% +% \CheckSum{101} +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \changes{v0.1}{2011/06/12}{Initial version} %% ^^A date guessed +% \changes{v1.0}{2012/08/22}{Wrote this documentation and the \LaTeX{}-package +% and added support for English} +% \changes{v1.1}{2012/08/27}{Added optional parameter \enquote{ein}} +% \changes{v1.1a}{2012/08/27}{Added support for real numbers} +% +% \DoNotIndex{\RequirePackage, \DeclareOption, \ProcessOptions} +% \DoNotIndex{\PackageWarning, \MessageBreak} +% \DoNotIndex{\DeclareRobustCommand, \newcommand, \renewcommand} +% \DoNotIndex{\newenvironment} +% \DoNotIndex{\if, \else, \fi, \ifcase, \or, \ifthenelse, \AND, \value, \relax} +% \DoNotIndex{\equal, \@currname, \newcounter, \setcounter, \(, \), \NOT, \OR} +% \DoNotIndex{\endinput} +% +% \maketitle +% +% \phantomsection +% \addcontentsline{toc}{section}{\abstractname} +% \begin{abstract} +% The \PrintPackage{fnumprint} package can decide to typeset a +% number either as number or as word name (only in English or German). \\ +% Information site on CTAN: \url{\PackageCTANURL} \\ +% Fork me on GitHub: \url{\PackageURL} \end{abstract} +% +% \tableofcontents +% +% \section{Introduction} +% The \PackageName{} package defines two macros which decide to +% typeset a number either as Arabic number or as word name for the number. If +% the number is between zero and twelve (including zero and twelve) then the +% word name will be used. This package uses the \PrintPackage{zahl2string} +% package to convert a number in the word name in German. The conversion of a +% number (0--12) to the English word name is implemented by this package. If +% the number is outside of the range then it will be typesetted with the +% \PrintPackage{numprint} package. +% +% \section{Usage} +% Just load the package placing +% \begin{quote} +% |\usepackage{fnumprint}| +% \end{quote} +% in the preamble of your \LaTeXe{} source file. In this case the last by +% \PackageName{} supported language given as class option will be +% used. You can overwrite this with a package option like +% this: +% \begin{quote} +% |\usepackage[english]{fnumprint}| +% \end{quote} +% +% \DescribeMacro{\fnumprintc} +% The macro |\fnumprintc| \oarg{eins} \marg{\LaTeX{} counter name} takes a +% name of a LaTeX counter as not optional parameter and typesets it's +% value. The optional parameter is only active if the German language was +% selected. In this case it can be used to typeset \enquote{ein} instead of +% \enquote{eins}. This is for example necessary if you would like to typeset +% \enquote{ein Jahr}. +% +% \DescribeMacro{\fnumprint} +% The macro |\fnumprint| \oarg{eins} \marg{number} is like the |\fnumprintc| +% macro but it takes a number or a macro that expands to a number. A \TeX{} +% counter can also be used with this macro. +% +% \section{Examples} +% \begin{tabular}{ll} +% \textbf{macro} & \textbf{expanded macro} \\ +% |\fnumprint{-1}| & \fnumprint{-1} \\ +% |\fnumprint{0}| & \fnumprint{0} \\ +% |\fnumprint{1}| & \fnumprint{1} \\ +% |\fnumprint{3.14}| & \fnumprint{3.14} \\ +% |\fnumprint{10}| & \fnumprint{10} \\ +% |\fnumprint{12}| & \fnumprint{12} \\ +% |\fnumprint{13}| & \fnumprint{13} \\ +% |\fnumprint{\the\month}| & \fnumprint{\the\month} \\ +% |\fnumprint{\the\day}| & \fnumprint{\the\day} \\ +% |\fnumprintc{page}| & \fnumprintc{page} \\ +% \end{tabular} +% +% \section{ToDo} +% Here are some things that could be useful. +% \begin{itemize} +% \item Provide more features implemented by the \PrintPackage{zahl2string} +% package and create macros which implement these features for the +% English language. +% \end{itemize} +% +% \StopEventually{} +% +% \section{Implementation} +% \iffalse +%<*package> +% \fi +% This package depends on these packages. +% \begin{macrocode} +\RequirePackage{xifthen} +\RequirePackage[autolanguage]{numprint} +% \end{macrocode} +% \subsection{Language checking} +% I used the counter |fnumprint@language| to save the (last) selected language. +% Meaning from the counter values: +% +% \begin{tabular}{rl} +% \textbf{value} & \textbf{meaning} \\ +% 0 & no supported language selected \\ +% 1 & German selected \\ +% 2 & English selected \\ +% \end{tabular} +% \begin{macrocode} +\newcounter{fnumprint@language} +\setcounter{fnumprint@language}{0} +\DeclareOption{german}{\setcounter{fnumprint@language}{1}} +\DeclareOption{ngerman}{\setcounter{fnumprint@language}{1}} +\DeclareOption{english}{\setcounter{fnumprint@language}{2}} +\DeclareOption{USenglish}{\setcounter{fnumprint@language}{2}} +\DeclareOption{american}{\setcounter{fnumprint@language}{2}} +\DeclareOption{UKenglish}{\setcounter{fnumprint@language}{2}} +\DeclareOption{british}{\setcounter{fnumprint@language}{2}} +\DeclareOption{canadian}{\setcounter{fnumprint@language}{2}} +\DeclareOption{australian}{\setcounter{fnumprint@language}{2}} +\DeclareOption{newzealand}{\setcounter{fnumprint@language}{2}} +\ProcessOptions\relax +% \end{macrocode} +% If none of the supported languages was selected a package warning will appear. +% \begin{macrocode} +\ifcase\value{fnumprint@language} + \PackageWarning{\@currname}{No supported language selected + \MessageBreak + This package supports only English and German + \MessageBreak + There will be no word names printed} +% \end{macrocode} +% The zahl2string package will only be loaded if it is necessary. +% \begin{macrocode} +\or + \RequirePackage{zahl2string} +% \end{macrocode} +% \begin{macro}{\ns@en@neunzehn} +% This internal marco expands to the English word name for a number. +% It only goes from 0 to 19. It will only be defined if it is necessary. +% \begin{macrocode} +\or + \newcommand{\ns@en@neunzehn}[1]{% + \ifcase#1 zero\or one\or two\or three\or four\or five\or six\or% + seven\or eight\or nine\or ten\or eleven\or twelve\or thirteen\or% + fourteen\or fifteen\or sixteen\or seventeen\or% + eighteen\or nineteen\fi% + } +\fi +% \end{macrocode} +% \end{macro} +% \subsection{Macro definition} +% \begin{macro}{\fnumprint} +% Here is the |\fnumprint| macro definition. +% It takes one not optional parameter. +% The parameter must be a number or a macro which expands to a number. +% It can also take a optional parameter which replaces the German word +% \enquote{eins} with \enquote{ein}. +% \begin{macrocode} +\DeclareRobustCommand{\fnumprint}[2][]{% + \ifthenelse{\NOT \(\isin{,}{#2} \OR \isin{.}{#2} \) + \AND -1 < #2 \AND #2 < 13}{% + \ifthenelse{\value{fnumprint@language} = 1}{% + \ifthenelse{\equal{#1}{ein} \AND #2 = 1}{ein}{\numstr{#2}}% + }{% + \ifthenelse{\value{fnumprint@language} = 2}{% + \ns@en@neunzehn{#2}% + }{\numprint{#2}}% + }% + }{\numprint{#2}}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\fnumprintc} +% Here is the |\fnumprintc| macro definition. +% It takes one not optional parameter. +% The parameter must be the name of a \LaTeX{} counter. +% It can also take a optional parameter which replaces the German word +% \enquote{eins} with \enquote{ein}. +% \begin{macrocode} +\DeclareRobustCommand{\fnumprintc}[2][]{% + \ifthenelse{-1 < \value{#2} \AND \value{#2} < 13}{% + \ifthenelse{\value{fnumprint@language} = 1}{% + \ifthenelse{\equal{#1}{ein} \AND \value{#2} = 1}{ein}{\numstring{#2}}}{% + \ifthenelse{\value{fnumprint@language} = 2}{% + \ns@en@neunzehn{\value{#2}}% + }{\cntprint{#2}}% + }% + }{\cntprint{#2}}% +} +\endinput +% \end{macrocode} +% \end{macro} +% +% \iffalse +% +% \fi +% +% \Finale +\endinput diff --git a/macros/latex/contrib/fnumprint/fnumprint.ins b/macros/latex/contrib/fnumprint/fnumprint.ins new file mode 100644 index 0000000000..5ab72d861a --- /dev/null +++ b/macros/latex/contrib/fnumprint/fnumprint.ins @@ -0,0 +1,23 @@ +%% See file 'fnumprint.dtx' for copyright and licence. +\input docstrip.tex + +\keepsilent +\usedir{tex/latex/fnumprint} +\usepreamble\mypreamble +\askforoverwritefalse +\generate{\nopreamble\file{fnumprint.sty}{\from{fnumprint.dtx}{package}}} + +\Msg{***********************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* \space\space fnumprint.sty} +\Msg{*} +\Msg{* To produce the documentation run the files} +\Msg{* `fnumprint.dtx' through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing} +\Msg{***********************************************************} + +\endbatchfile diff --git a/macros/latex/contrib/fnumprint/fnumprint.pdf b/macros/latex/contrib/fnumprint/fnumprint.pdf new file mode 100644 index 0000000000..36e7c13928 Binary files /dev/null and b/macros/latex/contrib/fnumprint/fnumprint.pdf differ -- cgit v1.2.3