From 46ccde4fe92f8ee22404d38a7e94288ab86c15ad Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 4 May 2012 23:45:45 +0000 Subject: new latex package codicefiscaleitaliano (3may12) git-svn-id: svn://tug.org/texlive/trunk@26191 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/codicefiscaleitaliano/README | 65 +++ .../codicefiscaleitaliano.pdf | Bin 0 -> 208187 bytes .../codicefiscaleitaliano.dtx | 440 +++++++++++++++++++++ .../codicefiscaleitaliano.sty | 87 ++++ Master/tlpkg/bin/tlpkg-ctan-check | 2 +- Master/tlpkg/libexec/ctan2tds | 2 +- Master/tlpkg/tlpsrc/codicefiscaleitaliano.tlpsrc | 0 Master/tlpkg/tlpsrc/collection-langitalian.tlpsrc | 1 + 8 files changed, 595 insertions(+), 2 deletions(-) create mode 100755 Master/texmf-dist/doc/latex/codicefiscaleitaliano/README create mode 100755 Master/texmf-dist/doc/latex/codicefiscaleitaliano/codicefiscaleitaliano.pdf create mode 100755 Master/texmf-dist/source/latex/codicefiscaleitaliano/codicefiscaleitaliano.dtx create mode 100644 Master/texmf-dist/tex/latex/codicefiscaleitaliano/codicefiscaleitaliano.sty create mode 100644 Master/tlpkg/tlpsrc/codicefiscaleitaliano.tlpsrc (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/codicefiscaleitaliano/README b/Master/texmf-dist/doc/latex/codicefiscaleitaliano/README new file mode 100755 index 00000000000..25e677c32d9 --- /dev/null +++ b/Master/texmf-dist/doc/latex/codicefiscaleitaliano/README @@ -0,0 +1,65 @@ +Codicefiscaleitaliano bundle; version 1.1 2012/05/03 + +This small package is intended to check the consistency of the Italian +fiscal code string; a misspelled string is evidently inconsistent, but +a legal document with a wrong fiscal code string becomes invalid; +therefore it is important to check this string consistency. + +This control can be achieved with this little package that can perform +all the computations needed for this control. + +This work is subject to the LaTeX Project Public Licence, vernon 1.3 or +later. Any distribution of the TeX system contain the latest available +copy of the license. + +This work is author maintained. + +This work consists in the self extracting file codicefiscaleitaliano.dtx, +and this README file, and of the derived files codicefiscaleitaliano.pdf +and codicefiscaleitaliano.sty. + +If it is not yet included in the TeX system distribution you are using, +run codicefiscaleitaliano.dtx with pdflatex: then move: + +codicefiscaleitaliano.dtx to .../source/latex/codicefiscaleitaliano/ +codicefiscaleitaliano.pdf to .../doc/latex/codicefiscaleitaliano/ +codicefiscaleitaliano.sty to .../tex/latex/codicefiscaleitaliano/ + +The dots stand for your PERSONAL texmf tree root; if you are on a Windows +platform change the slashes into backslashes. If these folders are not +already in your PERSONAL texmf tree, create them. + + + +Pacchetto codicefiscaleitaliano; versione 1.1 2012/05/03 + +Questo pacchetto serve per controllare la consistenza del codice fiscale; +anche il più piccolo refuso che alteri il codice fiscale renderebbe non +valido qualsiasi documento legale che lo contenesse. Poter controllar e che +il codice sia consistente è quindi molto importante. + +Il controllo può essere eseguito mediante questo pacchetto che è in grado +di eseguire tutti i calcoli richiesti da questa verifica. + +Questo lavoro è soggetto alla Licenza Pubblica del Progetto LaTeX (LPPL) +versione 1.3 o successive. Ogni distribuzione del sistema TeX contiene +l'ultima versione disponibile di questa licenza. + +Questo lavoro consiste nei file README e codicefiscaleitaliano.dtx +autoestraente, e nei file derivati codicefiscaleitaliano.pdf e +codicefiscaleitaliano.sty. + +Se non è ancora incluso nella versione del sistema TeX che state usando, +eseguite il programma pdflatex sul file codicefiscaleitaliano.dtx; +otterrete i file derivati che vanno spostati nelle seguenti cartelle (se +non esistono ancora, createle): + +codicefiscaleitaliano.dtx --> .../source/latex/codicefiscaleitaliano/ +codicefiscaleitaliano.pdf --> .../doc/latex/codicefiscaleitaliano/ +codicefiscaleitaliano.sty --> .../tex/latex/codicefiscaleitaliano/ + +I puntini stanno per la radice del vostro albero texmf PERSONALE; se siete +su una macchina Windows, cambiate le barre diritte in barre rovesce. + +Claudio Beccari +claudio dot beccari at gmail dot com diff --git a/Master/texmf-dist/doc/latex/codicefiscaleitaliano/codicefiscaleitaliano.pdf b/Master/texmf-dist/doc/latex/codicefiscaleitaliano/codicefiscaleitaliano.pdf new file mode 100755 index 00000000000..838233dd376 Binary files /dev/null and b/Master/texmf-dist/doc/latex/codicefiscaleitaliano/codicefiscaleitaliano.pdf differ diff --git a/Master/texmf-dist/source/latex/codicefiscaleitaliano/codicefiscaleitaliano.dtx b/Master/texmf-dist/source/latex/codicefiscaleitaliano/codicefiscaleitaliano.dtx new file mode 100755 index 00000000000..1caaec36b09 --- /dev/null +++ b/Master/texmf-dist/source/latex/codicefiscaleitaliano/codicefiscaleitaliano.dtx @@ -0,0 +1,440 @@ +% \iffalse +%<*internal> +\begingroup +\input docstrip.tex +\keepsilent +\preamble + ______________________________________________________ + The codicefiscaleitaliano package for LaTeX and XeLaTeX + Copyright (C) 2012 Claudio Beccari + All rights reserved + + License information appended + +\endpreamble +\postamble + +Copyright 2012 Claudio Beccari + +Distributable under the LaTeX Project Public License, +version 1.3c or higher (your choice). The latest version of +this license is at: http://www.latex-project.org/lppl.txt + +This work is "author-maintained" + +This work consists of this file codicefiscaleitaliano.dtx, a README file +and the derived files codicefiscaleitaliano.sty and codicefiscaleitaliano.pdf. + +\endpostamble +\askforoverwritefalse + +\generate{\file{codicefiscaleitaliano.sty}{\from{codicefiscaleitaliano.dtx}{package}}} + +\def\tmpa{plain} +\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi +\endgroup +% +% +%% +%% File `codicefiscaleitaliano.dtx'. +%% Copyright (C) 2012 Claudio Beccari all rights reserved. +%% +% What follows is the usual trick that is not typeset in the documentation +% pdf file that is produced by pdfLaTeX. It is used to define the date, the version +% and the short description that characterizes both this file and the package; +% the point is that |\ProvidesFile| is being read only by the driver, while +% |\ProvidePackage| goes to the stripped package file; it must be done before +% starting the documentation otherwise |\GetFileInfo| can't get the necessary +% information. +% \fi +% +% \iffalse +%<+package>\NeedsTeXFormat{LaTeX2e}[2011/06/20] +%<*driver> +\ProvidesFile{codicefiscaleitaliano.dtx}% +% +%<+package>\ProvidesPackage{codicefiscaleitaliano}% +%<*package> + [2012/05/03 v.1.1 Controlla il codice fiscale italiano] +% +%<*driver> +\documentclass{ltxdoc} +\hfuzz 10pt +\usepackage{multicol} +\usepackage[utf8]{inputenc} +\usepackage[italian,english]{babel} +\usepackage{array,booktabs} +\usepackage{codicefiscaleitaliano} +\GetFileInfo{codicefiscaleitaliano.dtx} +\title{The extension package \textsf{codicefiscaleitaliano}\thanks{Version number +\fileversion; last revised \filedate.}} +\author{Claudio Beccari} +\date{} +\begin{document} + \maketitle +\begin{multicols}{2} + \tableofcontents + \end{multicols} + \DocInput{codicefiscaleitaliano.dtx} +\end{document} +% +% \fi +% +% \CheckSum{149} +% \begin{abstract} +% This small package is meant to help users to check the Italian Fiscal Code spelling; +% it produces an ``info'' message in the log file if the code is selfconsitent; otherwise, +% without actually correcting the code, it issues an error message the informs the user +% of the incorrecteness of the current fiscal code and urges him to provide for a revision, +% but it does not forbid to continue typesetting the document. +% +% This package should be helpful for everybody who typesets legal or financial documents +% for the Italian Administration Offices; therefore the user either knows Italian or his +% mother language is Italian; therefore most of the user guide part will be typeset in +% Italian. +% \end{abstract} +% +% \selectlanguage{italian} +% \section{Introduzione} +% +% Chiunque abbia bisogno di scrivere il codice fiscale di una persona fisica trova +% grande giovamento se può disporre di un software che gli controlli l'ortografia +% del codice; basta il più banale refuso che il codice perde ogni validità. +% +% Questo pacchetto verifica solo la lettera di controllo, che dipende, secondo un +% apposito algoritmo, dai precedenti 15 caratteri che formano il codice: è una +% specie di prova del nove che permette non di trovare l'errore, ma di verificare +% l'inconsistenza dei caratteri che formano la stringa. +% +% Come è noto, il codice fiscale delle perone fisiche è formato da sedici caratteri +% secondo lo schema seguente: +% \begin{center} +% CCCNNNAAMGGLLLLK +% \end{center} +% dove: +%\begin{description} +%\item[CCC] sono tre lettere estratte dal cognome della persona; +%\item[NNN] sono tre lettere estratte dal nome della persona; +%\item[AA] sono le ultime due cifre dell'anno di nascita della persona; +%\item[M] è una lettera che identifica il mese di nascita della persona; +%\item[GG] sono le cifre del giorno di nascita della persona, eventualmente +% aggiunte al numero 40, nel caso delle persone di sesso femminile; +%\item[LLLL] è il codice indicativo del comune di nascita della persona, +% se è nata in Italia, oppure il codice identificativa della nazione estera +% dove essa è nata; +%\item[K] è la lettera di controllo. +% \end{description} +% Per evitare situazioni di \emph{omocodia}, cioè di persone identificate dallo +% stesso codice, le sette cifre che compaiono normalmente nel codice possono +% venire sostituite da apposite lettere, ma solo l'Amministrazione Centrale dello +% Stato può farlo perché solo l'amministrazione conosce quali codici siano già +% stati attribuiti, a chi e quando. +% All'utente finale non resta altra possibilità che controllare mediante la lettera +% di controllo la coerenza dell'intero codice, ma non di generare codici solo +% a partire dalle generalità di una persona; o meglio, non sarebbe molto complicato +% farlo, ma si potrebbe solo generare il codice di default, non un codice che +% garantisca di evitare l'omocodia. +% +% \section{Uso del pacchetto} +% +% Il pacchetto si carica nel solito modo, mediante |\usepackage|; non ci sono +% opzioni da esprimere. Lo si usa semplicemente inserendo nel testo da comporre +% il comando +%\begin{flushleft} +%|\codicefiscaleitaliano{|\meta{codice fiscale da controllare}|}| +%\end{flushleft} +%Il \meta{codice fiscale da controllare} va scritto in lettere maiuscole. +% +% Eseguito il controllo il pacchetto si limita di scrivere un messaggio nel file +% log per ricordare quale codice si è controllato, se l'esito del controllo è +% positivo. Se il codice fosse inconsistente, invece, il pacchetto scrive un +% vistoso messaggio di errore indicando il codice inconsistente; non impedisce +% di continuare a comporre il documento, ma inviita l'utente a ricordarsi di +% verificare e correggere l'errore. Ovviamente il pacchetto non ``corregge'' +% la lettera di controllo, perché l'errore potrebbe essere in uno o più degli +% altri 15 caratteri, per cui correggere la lettera di controllo potrebbe +% consistere nell'aggiungere errore ad errore, producendo un codice con almeno +% due errori, del tutto invalido ai fini legali; probabilmente potrebbe dare luogo +% a qualche altro reato, a seconda del documento che si sta scrivendo. +% +% Esempio: |\codicefiscaleitaliano{NGLMRA08M64L500N}|\codicefiscaleitaliano{NGLMRA08M64L500N} +% +% Siccome il codice è valido, non appaiono messaggi sullo schermo; se fosse stato +% invalido, sarebbe apparso un vistoso messaggio d'errore sullo schermo. +% +% Finché non si controlla un altro codice, il codice corrente è ancora disponibile +% nella macro |\CFisc| che può essere usata per scrivere il codice senza doverlo +% ribattere. Infatti ottengo: \CFisc. +% +%\selectlanguage{english} +% \section{Disclaimer} +% Although I did my best so as to assure a correct control of the fiscal code +% string I cannot be absolutely sure that this control does not produce false +% positive or false negative results. +% +% Since this work is subject to the \LaTeX\ Project Public Licence, it is the +% case to redirect the user to the full text of this license; here I reproduce +% only this section: +% +% \section{No Warranty} +% +% There is no warranty for the Work. Except when otherwise stated in +% writing, the Copyright Holder provides the Work `as is', without +% warranty of any kind, either expressed or implied, including, but not +% limited to, the implied warranties of merchantability and fitness for +% a particular purpose. The entire risk as to the quality and performance +% of the Work is with you. Should the Work prove defective, you +% assume the cost of all necessary servicing, repair, or correction. +% +% In no event unless agreed to in writing will the Copyright Holder, or +% any author named in the components of the Work, or any other party who +% may distribute and/or modify the Work as permitted above, be liable to +% you for damages, including any general, special, incidental or +% consequential damages arising out of any use of the Work or out of +% inability to use the Work (including, but not limited to, loss of +% data, data being rendered inaccurate, or losses sustained by anyone as +% a result of any failure of the Work to operate with any other +% programs), even if the Copyright Holder or said author or said other +% party has been advised of the possibility of such damages. +% +% +% \StopEventually{} +% +% \section{The documented code} +% Here begins the code documentation; I warn the reader that this code +% contains some ``dirty tricks'', at least according to my opinion; therefore +% the reading might result quite difficult. I try to be clear also +% for myself, because I would like to understand it when I read this code +% some time from now. +% +% In the preamble of this documented \TeX\ file we requested a +% recent \LaTeX\ kernel; actually this code contains very little \LaTeX\ code, +% but it requires a sufficiently recent typesetting engine, therefore a +% sufficiently recent \LaTeX\ kernel; most of the code contained here after +% is primitive \TeX\ code. +% +% The control algorithm requires that each fiscal code string character be +% examined and according to its position in the code (even or odd position +% order) be assigned a specific value according to a table established by +% the legislation, see table~\ref{tab:valori}. +% +%\begin{table}\centering +%\caption{Values to be assigned to the single characters in the fiscal code +% string according to their position} +%\label{tab:valori} +%\medskip +%\begin{tabular}{ccc} +%\toprule +%\multicolumn1{m{4.5em}}{\centering Character}& +% \multicolumn1{m{4.5em}}{\centering Even posisiton}& +% \multicolumn1{m{4.5em}}{\centering Odd position}\\ +%\midrule +%0 & 0 & 1 \\ +%1 & 1 & 0 \\ +%2 & 2 & 5 \\ +%3 & 3 & 7 \\ +%4 & 4 & 9 \\ +%5 & 5 & 13 \\ +%6 & 6 & 15 \\ +%7 & 7 & 17 \\ +%8 & 8 & 19 \\ +%9 & 9 & 21 \\ +%\midrule +%A & 0 & 1 \\ +%B & 1 & 0 \\ +%C & 2 & 5 \\ +%D & 3 & 7 \\ +%E & 4 & 9 \\ +%F & 5 & 13 \\ +%G & 6 & 15 \\ +%H & 7 & 17 \\ +%I & 8 & 19 \\ +%J & 9 & 21 \\ +%K & 10 & 2 \\ +%L & 11 & 4 \\ +%M & 12 & 18 \\ +%N & 13 & 20 \\ +%O & 14 & 11 \\ +%P & 15 & 3 \\ +%Q & 16 & 6 \\ +%R & 17 & 8 \\ +%S & 18 & 12 \\ +%T & 19 & 14 \\ +%U & 20 & 16 \\ +%V & 21 & 10 \\ +%W & 22 & 22 \\ +%X & 23 & 25 \\ +%Y & 24 & 24 \\ +%Z & 25 & 23 \\ +%\bottomrule +%\end{tabular} +%\end{table} +% +% Once assigned the above numeric value to each one of the first fifteen +% characters of the code, it is necessary to sum them up and compute this +% sum's modulo~26 value; this value is in the interval from zero to~25, and +% it is used to look up in the second column of table~\ref{tab:valori} which +% letter corresponds to such a number; this is the computed control letter, +% and the sixteenth character of the fiscal code string must match such +% computed control letter. +% +% We have to produce macros to detach from the fiscal code string one +% character at a time form left to right; we have to determine its even +% or odd position, assign it a value and sum up all such values. +% +% First we define a delimited argument macro that detaches the leftmost +% character and retrieves its \textsc{ascii} address, while reassigning +% the remaining characters to the possibly shortened fiscal code string; +% at the end of the process the fiscal code string should vanish. +% +% Notice that with the input string right delimited by an exclamation mark, +% only the first token (the first character) is assigned to argument |#1|, +% and the remaining string to the second argument |#2|. Notice also the +% |\Letter| is a \TeX\ counter and the notation |`#1| retrieves the \textsc{ascci} +% address corresponding to argument |#1|. It would be wrong to write +% |`\#1| because the |\Letter| counter would be assigned the \textsc{ascii} +% address of |#|. +% \iffalse +%<*package> +% \fi +% \begin{macrocode} +\def\getCFletter#1#2!{\Letter=`#1\def\CFisc{#2}} +% \end{macrocode} +% +% Now we generate a macro that assigns counter|\valore| a specific value +% for odd positioned characters, according to the third column of +% table~\ref{tab:valori}. We first check if the \textsc{ascii} address of +% the character precedes that of character `A'; in this is true we are dealing +% with a digit, otherwise with a letter. Since the third column of +% table~\ref{tab:valori} does not contain ordered values we need a look up +% table: even better, we need a numeric expression that yields a value between +% zero and 25 depending on the \textsc{ascii} address of the examined +% character: such an address is contained in counter |\Letter| therefore we +% have to subtract the \textsc{ascii} address of zero or of `A' depending if +% the character is a digit or a letter; that is the purpose of the |\numexpr| +% numerical expressions performed with the \mbox{$\varepsilon$-\TeX} syntax: +% \begin{macrocode} +\def\getOddValore{% +\ifnum\Letter<\A + \valore=\expandafter\ifcase\numexpr\Letter-\zero\relax + 1\or0\or5\or7\or9\or13\or15\or17\or19% + \or21\fi +\else + \valore=\expandafter\ifcase\numexpr\Letter-\A\relax + 1\or0\or5\or7\or9\or13\or15\or17\or19% + \or21\or2\or4\or18\or20\or11\or3\or6\or8% + \or12\or14\or16\or10\or22\or25\or24\or23\fi +\fi} +% \end{macrocode} +% +% The corresponding macro for even positioned characters is much simpler, +% because the values to be assigned the counter |\valore| are simply ordered. +% \begin{macrocode} +\def\getEvenValore{% +\ifnum\Letter<\A + \valore=\numexpr\Letter-\zero\relax +\else + \valore=\numexpr\Letter-\A\relax +\fi} +% \end{macrocode} +% +% Now comes the real testing macro. First the fiscal code string to be checked +% is passed to the control sequence |\CFisc|; then a group is opened so that +% any assignment performed within this group remains local and everything is +% undone upon closing the group. Several counters are assigned a name; the +% choice of using counter numbers above 255 is a habit of mine since when I +% first discovered this \makebox{$\varepsilon$-\TeX} feature is permanently +% included within the modern distributions of the \TeX\ system; apparently this +% dates back to the year 2005, so that it may be assumed that now every \TeX\ +% distribution in use complies with this upgrade. In any case since we used +% numerical expression by means of |\numexpr|, this upgrade must be operating, +% otherwise we'd had already some errors. Of course this package might control +% by itself if the \makebox{$\varepsilon$-\TeX} features are active, but we +% hope they are since they have been available for so may years. +% +% +% \begin{macrocode} +\newcommand\codicefiscaleitaliano[1]{\edef\CFisc{#1}% +\begingroup +\countdef\cifra=256 \cifra=\z@ +\countdef\A=258\A=`\A +\countdef\zero=260 \zero=`\0 +\countdef\Letter=262 +\countdef\valore=264 +\countdef\somma=266 \somma=\z@ +% \end{macrocode} +% +% Then we start a ``while"\dots`do'\dots cycle by resorting to the \LaTeX\ +% kernel macro |\@wiledo|; we use the counter |\cifra| to count and point to +% the position of a character and we cycle trough all the 16 fiscal code +% characters; on the first run when |\cifra| equals zero, the immediate +% stepping up by~1 assures that the pointer has always the correct value and +% parity; the last cycle is entered with |\cifra| holding the value +% 15, so the cycle is executed, but it is immediately stepped up to 16; this +% implies that even the sixteenth character is extracted from the fiscal code +% string (leaving it void) and its even position value is computed in the same +% way as all other even positioned characters. But this value is added to the +% total sum within the cycle. Since this should not be done, upon exiting the +% cycle, we must subtract the last character value from the sum, in order to +% execute the modular arithmetics on the sum of the first fifteen character +% values, while at the same time retaining the value associated to the +% sixteenth character of the fiscal code string to be checked. +% \begin{macrocode} +\@whilenum\cifra<16\do{\advance\cifra\@ne +\expandafter\getCFletter\CFisc!\relax +\ifodd\cifra +\getOddValore% +\else +\getEvenValore% +\fi +\advance\somma\valore +}\advance\somma-\valore +% \end{macrocode} +% +% Now we proceed with the actual verification. The input string control letter +% code is stored in counter |\valore|; we now determine the modular value of +% the computed sum over the values of the first 15 characters; we use the counter +% |\Letter|, that we don't need anymore, as a buffer for the integer quotient +% of the division by 26; we have to use the primitive \TeX\ integer division +% because the one executed by the \makebox{$\varepsilon$-\TeX} extensions +% \emph{rounds} the result to the nearest integer, instead of \emph{truncating} +% it to the nearest lower integer. This done we calculate the integer remainder +% of the division with a |\numexpr| clause; the result is the value the control +% letter should have to be consistent with the first 15 characters of the fiscal +% code string; if these two values do agree, then the fiscal code string is +% consistent otherwise it is a faulty string, may be with a typo, or just +% incorrectly read from the plastic card issued by the Ministry of Finance +% Agency of Incomes, or by any other document. Suitable messages are therefore +% issued. +% \begin{macrocode} +\Letter\somma +\divide\Letter by 26\relax +\somma=\numexpr\somma - 26*\Letter\relax +\ifnum\valore=\somma +\PackageInfo{codicefiscaleitaliano}{\MessageBreak +Codice fiscale OK} +\else +\PackageError{codicefiscaleitaliano}{\MessageBreak +********************\MessageBreak +Codice fiscale #1 errato\MessageBreak +********************}{% +Premi S oppure Q oppure ; il file +verra' elaborato lo stesso ma il codice +fiscale deve venire ricontrollato!} +\fi +\endgroup} + +\endinput +% \end{macrocode} +% Please, be careful if the fiscal code string is found consistent; it might +% contain two typos whose effects compensate each other. In any case do not +% blame me; I did my best to implement the checking algorithm according to +% the fiscal code legislation; do not blame \TeX\ and company either, because +% they do their computations the best they can. If it is possible that two +%or more errors compensate their effects, this is due to the way the fiscal +% code has been defined. +% \iffalse +% +% \fi +% \Finale +% \endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/codicefiscaleitaliano/codicefiscaleitaliano.sty b/Master/texmf-dist/tex/latex/codicefiscaleitaliano/codicefiscaleitaliano.sty new file mode 100644 index 00000000000..756f756b555 --- /dev/null +++ b/Master/texmf-dist/tex/latex/codicefiscaleitaliano/codicefiscaleitaliano.sty @@ -0,0 +1,87 @@ +%% +%% This is file `codicefiscaleitaliano.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% codicefiscaleitaliano.dtx (with options: `package') +%% ______________________________________________________ +%% The codicefiscaleitaliano package for LaTeX and XeLaTeX +%% Copyright (C) 2012 Claudio Beccari +%% All rights reserved +%% +%% License information appended +%% +%% +%% File `codicefiscaleitaliano.dtx'. +%% Copyright (C) 2012 Claudio Beccari all rights reserved. +%% +\NeedsTeXFormat{LaTeX2e}[2011/06/20] +\ProvidesPackage{codicefiscaleitaliano}% + [2012/05/03 v.1.1 Controlla il codice fiscale italiano] +\def\getCFletter#1#2!{\Letter=`#1\def\CFisc{#2}} +\def\getOddValore{% +\ifnum\Letter<\A +\valore=\expandafter\ifcase\numexpr\Letter-\zero\relax +1\or0\or5\or7\or9\or13\or15\or17\or19% +\or21\fi +\else +\valore=\expandafter\ifcase\numexpr\Letter-\A\relax +1\or0\or5\or7\or9\or13\or15\or17\or19% +\or21\or2\or4\or18\or20\or11\or3\or6\or8% +\or12\or14\or16\or10\or22\or25\or24\or23\fi +\fi} +\def\getEvenValore{% +\ifnum\Letter<\A +\valore=\numexpr\Letter-\zero\relax +\else +\valore=\numexpr\Letter-\A\relax +\fi} +\newcommand\codicefiscaleitaliano[1]{\edef\CFisc{#1}% +\begingroup +\countdef\cifra=256 \cifra=\z@ +\countdef\A=258\A=`\A +\countdef\zero=260 \zero=`\0 +\countdef\Letter=262 +\countdef\valore=264 +\countdef\somma=266 \somma=\z@ +\@whilenum\cifra<16\do{\advance\cifra\@ne +\expandafter\getCFletter\CFisc!\relax +\ifodd\cifra +\getOddValore% +\else +\getEvenValore% +\fi +\advance\somma\valore +}\advance\somma-\valore +\Letter\somma +\divide\Letter by 26\relax +\somma=\numexpr\somma - 26*\Letter\relax +\ifnum\valore=\somma +\PackageInfo{codicefiscaleitaliano}{\MessageBreak +Codice fiscale OK} +\else +\PackageError{codicefiscaleitaliano}{\MessageBreak +********************\MessageBreak +Codice fiscale #1 errato\MessageBreak +********************}{% +Premi S oppure Q oppure ; il file +verra' elaborato lo stesso ma il codice +fiscale deve venire ricontrollato!} +\fi +\endgroup} + +%% +%% Copyright 2012 Claudio Beccari +%% +%% Distributable under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is "author-maintained" +%% +%% This work consists of this file codicefiscaleitaliano.dtx, a README file +%% and the derived files codicefiscaleitaliano.sty and codicefiscaleitaliano.pdf. +%% +%% +%% End of file `codicefiscaleitaliano.sty'. diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index ba57d74c73b..e2140508692 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -96,7 +96,7 @@ my @TLP_working = qw( clock clrscode cm-super cm-unicode cmap cmarrows cmbright cmcyr cmdstring cmll cmpica cmpj cmsd cmtiup - codedoc codepage + codedoc codepage codicefiscaleitaliano collcell collectbox collref colordoc colorinfo colorsep colortab colortbl colorwav colourchange combelow combine combinedgraphics comfortaa comma commath comment diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 193db1999de..2d6d49fa5c4 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1814,6 +1814,7 @@ $standardsource='\.(bat|c|drv|dtx|fea|fdd|ins|sfd)$|configure.*|install-sh'; 'ccfonts', 'ccfonts.ins', 'chronology', 'chronology.dtx', 'cmbright', 'NULL', + 'codicefiscaleitaliano', 'codicefiscaleitaliano.dtx', 'cprotect', "$package.dtx", 'curve2e', 'curve2e.dtx', 'dotseqn', 'dotseqn.dtx', @@ -1842,7 +1843,6 @@ $standardsource='\.(bat|c|drv|dtx|fea|fdd|ins|sfd)$|configure.*|install-sh'; 'seuthesis', 'NULL', # don't want to run iconv, etc. 'stmaryrd', 'stmaryrd.dtx', 'tablists', 'tablists.dtx', - 'testcf', 'TestCF.dtx', 'thesis', 'install.01|install.ndx', 'termlist', 'termlist.dtx', 'teubner', 'teubner.dtx', diff --git a/Master/tlpkg/tlpsrc/codicefiscaleitaliano.tlpsrc b/Master/tlpkg/tlpsrc/codicefiscaleitaliano.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Master/tlpkg/tlpsrc/collection-langitalian.tlpsrc b/Master/tlpkg/tlpsrc/collection-langitalian.tlpsrc index 8507545b19f..7f07dc91997 100644 --- a/Master/tlpkg/tlpsrc/collection-langitalian.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-langitalian.tlpsrc @@ -2,6 +2,7 @@ category Collection shortdesc Italian longdesc Support for typesetting Italian. depend collection-basic +depend codicefiscaleitaliano depend fixltxhyph depend hyphen-italian depend frontespizio -- cgit v1.2.3