summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/codicefiscaleitaliano/codicefiscaleitaliano.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-05-04 23:45:45 +0000
committerKarl Berry <karl@freefriends.org>2012-05-04 23:45:45 +0000
commit46ccde4fe92f8ee22404d38a7e94288ab86c15ad (patch)
treec8c3b45d93351857a8d0ffb7bb0529eaea5fd99a /Master/texmf-dist/tex/latex/codicefiscaleitaliano/codicefiscaleitaliano.sty
parentea6e9d54915fc972bbc7a3de56cb5d2341e0d569 (diff)
new latex package codicefiscaleitaliano (3may12)
git-svn-id: svn://tug.org/texlive/trunk@26191 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/codicefiscaleitaliano/codicefiscaleitaliano.sty')
-rw-r--r--Master/texmf-dist/tex/latex/codicefiscaleitaliano/codicefiscaleitaliano.sty87
1 files changed, 87 insertions, 0 deletions
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 <invio>; 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'.