summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/generic/upca/README15
-rw-r--r--Master/texmf-dist/doc/generic/upca/test-upca.tex11
-rw-r--r--Master/texmf-dist/tex/generic/upca/upca.tex166
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds1
-rw-r--r--Master/tlpkg/tlpsrc/collection-genericextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/upca.tlpsrc0
7 files changed, 195 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/generic/upca/README b/Master/texmf-dist/doc/generic/upca/README
new file mode 100644
index 00000000000..732eb92cd67
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/upca/README
@@ -0,0 +1,15 @@
+In this directory you can find macro for printing UPC-A barcodes. All necessary macros are defined in file upca.tex. File test-upca.tex contains test of macros and demonstration of usage in plain.
+
+
+Macro works in plain and LaTeX and other standard macro packages.
+
+Files:
+upca.tex - definition of macros
+test-upca.tex .... test and demonstration of usage
+
+
+Jiri Mrkus (Ji\v{r}\'{i} Mrkus)
+Faculty of Informatics
+Masaryk University
+Czech Republic
+e-mail: mrkus@mail.muni.cz
diff --git a/Master/texmf-dist/doc/generic/upca/test-upca.tex b/Master/texmf-dist/doc/generic/upca/test-upca.tex
new file mode 100644
index 00000000000..4041b9a821d
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/upca/test-upca.tex
@@ -0,0 +1,11 @@
+\input upca % inputing macros to the document
+
+\module=0.5mm % setting module width (width of single bar or space) of the code; default 0.33mm
+
+\height=50mm % setting height of the code; default 25.9mm
+
+\upca{03600029145} % produces UPC-A barcode, the check digit will be calculated
+
+\upca{036000291454} % produces the same code, the check digit is not controled
+
+\end \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/upca/upca.tex b/Master/texmf-dist/tex/generic/upca/upca.tex
new file mode 100644
index 00000000000..cae5a0d7e01
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/upca/upca.tex
@@ -0,0 +1,166 @@
+%Author: Ji\v{r}\'{i} Mrkus
+%License: LaTeX Project Public License
+\newcount\stringlength
+\stringlength=0
+\newcount\check
+\check=0
+\newcount\badchar
+\badchar=0
+\newcount\oddcount
+\oddcount=0
+\newcount\evencount
+\evencount=0
+\newcount\helplen
+\helplen=0
+\newcount\moda
+\newcount\modb
+
+\newdimen\module
+\newdimen\height
+\newdimen\fivemodule
+\newdimen\fntsize
+\newdimen\unita
+\newdimen\unitb
+\newdimen\unitc
+\newdimen\helpind
+
+\fntsize=12pt
+\module=0.33mm
+\height=25.9mm
+
+
+
+\def\upca#1 {\kern 1.5mm\edef\currfont{\the\font}%
+ \helpind=\parindent%
+ \parindent=0pt%
+ \unita=\module%
+ \multiply\unita by1065%
+ \divide\unita by1000%
+ \unitb=\unita%
+ \unitc=\unita%
+ \multiply\unita by4%
+ \multiply\unitb by11%
+ \multiply\unitc by2%
+ \fntsize=\module%
+ \multiply\fntsize by950%
+ \divide\fntsize by100%
+ \font\upcafont=ocrb10 at \fntsize%
+ \upcafont%
+ \fivemodule=\module%
+ \multiply\fivemodule by5%
+ \stringlength=0 \badchar=0%
+ \control[#1] \ifnum\badchar=0 \ifnum\check=1 \controlchar[#1]%
+ \hbox{\upcacode[#1{\checkchar}]}\else%
+ \hbox{\upcacode[#1]}\fi\else\fi%
+ \parindent=\helpind \currfont \kern 1.5mm}
+
+
+
+\def\upcacode[#1]{\stringlength=1%
+ \advance\height by\fivemodule%
+ \ooalign{\split[00000]\split[101] \upcahash[#1]\split[00000]\cr%
+ \hbox{\kern-\unitc \lower \unita\hbox{\upcatext[#1]}}}}
+
+
+%Macro which prints text under the code
+\def\upcatext[#1#2]{#1\kern\unitb \sndtext[#2]}
+\def\sndtext[#1#2#3#4#5#6]{#1#2#3#4#5\kern\unita \rdtext[#6]}
+\def\rdtext[#1#2#3#4#5#6]{#1#2#3#4#5\kern\unitb #6}
+
+%This macro converts number to sequence of 0 and 1
+\def\upcahash[#1#2]{%
+ \if#10 \ifnum\stringlength=1 \split[0001101]\else%
+ \ifnum\stringlength<7%
+ \raise\fivemodule\hbox{\split[0001101]}\else%
+ \ifnum\stringlength=12 \split[1110010]\else%
+ \raise\fivemodule\hbox{\split[1110010]}\fi\fi\fi\else%
+ \if#11 \ifnum\stringlength=1 \split[0011001]\else%
+ \ifnum\stringlength<7%
+ \raise\fivemodule\mbox{\split[0011001]}\else%
+ \ifnum\stringlength=12 \split[1100110]\else%
+ \raise\fivemodule\hbox{\split[1100110]}\fi\fi\fi\else%
+ \if#12 \ifnum\stringlength=1 \split[0010011]\else%
+ \ifnum\stringlength<7%
+ \raise\fivemodule\hbox{\split[0010011]}\else%
+ \ifnum\stringlength=12 \split[1101100]\else%
+ \raise\fivemodule\hbox{\split[1101100]}\fi\fi\fi\else%
+ \if#13 \ifnum\stringlength=1 \split[0111101]\else%
+ \ifnum\stringlength<7%
+ \raise\fivemodule\hbox{\split[0111101]}\else%
+ \ifnum\stringlength=12 \split[1000010]\else%
+ \raise\fivemodule\hbox{\split[1000010]}\fi\fi\fi\else%
+ \if#14 \ifnum\stringlength=1 \split[0100011]\else%
+ \ifnum\stringlength<7%
+ \raise\fivemodule\hbox{\split[0100011]}\else%
+ \ifnum\stringlength=12 \split[1011100]\else%
+ \raise\fivemodule\hbox{\split[1011100]}\fi\fi\fi\else%
+ \if#15 \ifnum\stringlength=1 \split[0110001]\else%
+ \ifnum\stringlength<7%
+ \raise\fivemodule\hbox{\split[0110001]}\else%
+ \ifnum\stringlength=12 \split[1001110]\else%
+ \raise\fivemodule\hbox{\split[1001110]}\fi\fi\fi\else%
+ \if#16 \ifnum\stringlength=1 \split[0101111]\else%
+ \ifnum\stringlength<7%
+ \raise\fivemodule\hbox{\split[0101111]}\else%
+ \ifnum\stringlength=12 \split[1010000]\else%
+ \raise\fivemodule\hbox{\split[1010000]}\fi\fi\fi\else%
+ \if#17 \ifnum\stringlength=1 \split[0111011]\else%
+ \ifnum\stringlength<7%
+ \raise\fivemodule\hbox{\split[0111011]}\else%
+ \ifnum\stringlength=12 \split[1000100]\else%
+ \raise\fivemodule\hbox{\split[1000100]}\fi\fi\fi\else%
+ \if#18 \ifnum\stringlength=1 \split[0110111]\else%
+ \ifnum\stringlength<7%
+ \raise\fivemodule\hbox{\split[0110111]}\else%
+ \ifnum\stringlength=12 \split[1001000]\else%
+ \raise\fivemodule\hbox{\split[1001000]}\fi\fi\fi\else%
+ \if#19 \ifnum\stringlength=1 \split[0001011]\else%
+ \ifnum\stringlength<7%
+ \raise\fivemodule\hbox{\split[0001011]}\else%
+ \ifnum\stringlength=12 \split[1110010]\else%
+ \raise\fivemodule\hbox{\split[1110100]}\fi\fi\fi \else \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
+ \ifnum\stringlength=11 \advance\height by\fivemodule\else\fi%
+ \ifnum\stringlength=6%
+ \advance\height by\fivemodule%
+ \split[01010]%
+ \advance\height by-\fivemodule \else \fi%
+ \ifnum\stringlength=1 \advance\height by-\fivemodule \else\fi%
+ \advance\stringlength by1%
+ \if:#2: \split[101]%
+ \advance\height by-\fivemodule%
+ \else\upcahash[#2]\fi}
+
+%Macro takes as parameter sequence of 0 and 1, every character passes on draw macro
+\def\split[#1#2]{\draw[#1] \if:#2: \else \split[#2] \fi}
+
+%This macro takes as parameter one character (0 or 1) and draws a bar or space
+\def\draw[#1]{\if#11\vrule height \height width \module \else \if#10\hskip \module \fi \fi}
+
+%Returns true if character in parameter is a digit, false otherwise
+\newif\ifnext
+\def\ifdigit[#1]{\ifnum`#1>47 \ifnum`#1<58 \nexttrue\else\nextfalse\fi\else\nextfalse\fi\ifnext}
+
+%This macro computes length of string in parameter - result is in helplen register
+\def\strlen[#1#2]{\if:#2: \advance\helplen by1 \else \advance\helplen by1\strlen[#2]\fi}
+
+%Macro which computes modulo of two numbers in moda and modb registers - result in moda
+\def\modulo{%
+ \ifnum\moda>\modb \advance\moda by-\modb \modulo%
+ \else \fi\ifnum\moda=\modb \moda=0 \else \fi}
+
+%Macro which controls if parameter has length 11 or 12 characters and contains only digits
+\def\control[#1#2]{\ifdigit[#1]\advance\stringlength by1%
+ \if:#2: \ifnum\stringlength=11 \check=1 \else%
+ \ifnum\stringlength=12 \check=0%
+ \else \message{String must have 11 or 12 characters}\badchar=1\fi\fi\else\control[#2]\fi%
+ \else \message{Invalid characters: code can contain only digits}\badchar=1\fi}
+
+%Macro which computes the check digit
+\def\controlchar[#1#2]{\helplen=0 \if:#2: \else \strlen[#2]\fi \moda=\helplen \modb=2 \modulo%
+ \ifnum\moda=0 \advance\oddcount by`#1 \advance\oddcount by-48 \else%
+ \advance\evencount by`#1 \advance\evencount by-48 \fi%
+ \ifnum\helplen>0 \controlchar[#2]\else%
+ \multiply\oddcount by3 \advance\oddcount by\evencount \moda=\oddcount \modb=10 \modulo%
+ \ifnum\moda=0 \check=0 \else \check=10 \advance\check by-\moda\fi \def\checkchar{\the\check}\fi}
+
+\endinput \ No newline at end of file
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 1213b6c0ca8..55d5b94f561 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -369,7 +369,7 @@ my @TLP_working = qw(
umthesis umtypewriter
unamthesis underlin underscore undertilde undolabl
uni-wtal-ger unicode-math unisugar units unitsdef universa
- uothesis uowthesis upmethodology upquote
+ uothesis uowthesis upca upmethodology upquote
uri url urlbst urwchancal ushort ut-thesis uwthesis
vancouver variations varindex varisize
varsfromjobname varwidth vaucanson-g
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 65c4d3119d9..c1a2c4f34c6 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -1224,6 +1224,7 @@ $standardtex='\.(.bx|cfg|sty|clo|ldf|cls|def|fd|cmap|4ht)$';
'underscore', '^..[^s].*\.sty', # not miscdoc.sty
'undolabl', '\.sty|[^c]\.cfg', # omit ltxdoc.cfg, would be system-wide
'universa', '\.fd|uni\.sty', # not unidoc.sty
+ 'upca', '^upca\.tex',
'url', '^[^m].*\.sty', # not miscdoc.sty
'variations', '^variations\.tex|' . $standardtex, # not docvariations.tex
'varisize', '\.tex',
diff --git a/Master/tlpkg/tlpsrc/collection-genericextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-genericextra.tlpsrc
index dce9a8953fe..ceae3dc690e 100644
--- a/Master/tlpkg/tlpsrc/collection-genericextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-genericextra.tlpsrc
@@ -32,6 +32,7 @@ depend shade
depend systeme
depend tabto-generic
depend texapi
+depend upca
depend xlop
depend yax
#
diff --git a/Master/tlpkg/tlpsrc/upca.tlpsrc b/Master/tlpkg/tlpsrc/upca.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/upca.tlpsrc