diff options
author | Norbert Preining <preining@logic.at> | 2008-08-21 08:00:51 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-08-21 08:00:51 +0000 |
commit | 9dc486e360205123e08e809c7e15e48b1340083a (patch) | |
tree | 47420c96091e88d394c37d8d1b21bc7ad2c01d0e /Master/texmf-dist/doc/latex/makebarcode/makebarcode.tex | |
parent | 1ecadea1a7f6a97e97bca17569f0e3552ca3b774 (diff) |
fix makebarcode from CTAN
git-svn-id: svn://tug.org/texlive/trunk@10389 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/makebarcode/makebarcode.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/makebarcode/makebarcode.tex | 318 |
1 files changed, 318 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/makebarcode/makebarcode.tex b/Master/texmf-dist/doc/latex/makebarcode/makebarcode.tex new file mode 100644 index 00000000000..98a0faf12ae --- /dev/null +++ b/Master/texmf-dist/doc/latex/makebarcode/makebarcode.tex @@ -0,0 +1,318 @@ +%% $Id: zwpagelayout.tex 214 2008-06-26 23:08:07Z zw $ +\input utf8-t1 % encTeX required +\documentclass[11pt]{article} +\usepackage{zwgetfdate} +\usepackage[footskip=30pt,topmargin=2cm,leftmargin=2cm,rightmargin=4cm,botmargin]{zwpagelayout} +\usepackage[T1]{fontenc} +\usepackage{lmodern,array,dcolumn,rotating} +\usepackage[help,H=3mm,S.6]{makebarcode} +\usepackage[protrusion=false,expansion=true,stretch=8,shrink=24,step=4]{microtype} +\makeatletter +\renewcommand*\l@section{\@dottedtocline{1}{\z@}{1.5em}} +\makeatother +\extrarowheight 2pt +\mubytein 0 % important due to bug in url.sty +\usepackage[pdftitle=Bar\ Codes, pdfauthor=Zdenek\ Wagner, + pdfkeywords={bar code, 2/5, Code39, ITF-6, ITF-14, ITF-16}, + bookmarks,bookmarksopen,bookmarksopenlevel=2]{hyperref} +\mubytein 1 \mubyteout 1 \mubytelog 1 + +\marginparwidth\UserRightMargin +\advance\marginparwidth -1cm +\advance\marginparwidth-\marginparsep + +\def\mg#1{\ifvmode\leavevmode\fi\marginpar{\texttt{#1}}\ignorespaces} +\def\cmg#1{\mg{\char`\\#1}} +\def\omg#1{\ifvmode\leavevmode\fi\marginpar{\raggedright\hspace{0pt}\opt{#1}}\ignorespaces} +\def\opt#1{\texorpdfstring{\textmd{\textsc{#1}}}{#1}} +\let\pkg\textsc +\DeclareRobustCommand\cmd[1]{\texttt{\char`\\#1}} +\def\ie.{i.\,e.\@} +\def\eg.{e.\,g.\@} +\def\true{\bool{true}} +\def\false{\bool{false}} +\def\bool#1{\texorpdfstring{\textit{#1}}{#1}} +\def\is{\unskip\nobreak\space =\penalty200 \space\ignorespaces} + +\def\bcd#{\barcode[code=Code39,X=.5mm,ratio=2.25,H=1cm]} + +\let\zwcomma\, +\def\,{\texorpdfstring{\zwcomma}{}} + +\begin{document} + +\clubpenalty 10000 +\widowpenalty 10000 +\raggedbottom + +\title{Bar Codes} +\author{Zdeněk Wagner\\\url{http://icebearsoft.euweb.cz}} +\date{Package date: \DateOfPackage{makebarcode}} +\maketitle + +\begin{abstract}\noindent +The package contains macros for printing various 2/5 bar codes and Code 39 +bar codes. The macros do not use fonts but create the bar codes directly +by vrules. It is therefore possible to vary width to height ratio, ration +of thin and thick bars. The package is therefore convenient for printing +ITF bar codes as well as bar codes for identification labels for HP +storage media. +\end{abstract} + +\tableofcontents + +\section{Introduction} +The development of the package started due to practical need. Bar code labels for HP storage media +are quite expensive. However, the bar codes may easily be produced by \TeX. The documentation +clearly specifies that the bar code is of the Code39 type~[\ref{hpstorage}, \ref{hplabel}]. +It may seem that the task is easy. + +The common denominator of the 2/5 codes and Code39 is that they are formed of thin and thick bars. +The ratio of thin and thick bars may vary as well as the width-to-height ratio. It may therefore be +impossible to use bar code fonts for a particular application. On the other hand a bar code may +simply be created by rules. This approach was inspired by the \texttt{ean13.tex} file developed by +Petr Olšák~[\ref{olsak}]. + +Since the HP documentation does not specify dimensions, it was clear that some experimentation will +be necessary. The macro should thus be general with dimensions controlled by parameters. It is not +much work to make the macro really general with bar codes defined in tables. The same macro can +thus produce several types of barcodes. Moreover, the 2/5 bar codes are simpler and serve therefore +better to debugging and testing the macro during development. + +The structure of the package allows for implementation of other types of the bar codes. Some of +them will be implemented in the next version. + +The bar codes may contain a checksum digit. The macro in this package is able neither to generate +them nor to check them. It is up to the user to specify the full code. + +\section{Usage}\label{usage} +The package is loaded simply by: + +\vb +\verb;\usepackage[;$\langle$options$\rangle$\verb;]{makebarcode}; + +\vb\noindent +The bar code may then be printed by command + +\vb +\verb;\barcode[;$\langle$options$\rangle$\verb;]{;$\langle$code$\rangle$\verb;}; + +\vb +Options that ar not given in the \cmd{barcode} command are taken form those specified for the whole +package or the default values are used. Typically you will specify the most frequently options in +the \cmd{usepackage} command. Notice that the options in the square brackets of both commands are +optional. In the extreme case you may wish to print the bar codes of type Code39, module width +0.5\,mm, ratio of thin and thick bars 2.25 and height 1\,cm. You therefore load the package using + +\vb +\verb;\usepackage[code=Code39,X=.5mm,ratio=2.25,H=1cm]{makebarcode}; + +\vb\noindent +and produce the bar codes simply by + +\vb +\verb;\barcode{MAKEBARCODE.STY};\par +\verb;\barcode{ZDENEK WAGNER}; + +\vb\noindent +These commands will produce the following bar codes: + +\vb +\begin{center} +\bcd{MAKEBARCODE.STY} + +\bcd{ZDENEK WAGNER} +\end{center} + +\section{General Options} +The general options are available both for the \cmd{usepackage} command and for the \cmd{barcode} +macro. They cannot be used with high-level macros \cmd{ITFbarcode} and \cmd{HPlabel}. + +Almost all options have default values and may also be used without specification of a value. This will +reset the option to the default value. It may be useful if you wish to reset the default in the +\cmd{barcode} macro. + +\omg{help} +The \opt{help} option can only be used with the \cmd{usepackage} command. It prints the list of the +supported bar codes to the log file. + +\omg{bcorr} +Some applications require correction of the bar and blank width. The \opt{bcorr} option defines +dimension that is subtracted from each bar and added to each blank. The default value is 0\,mm. + +\section{Low-Level Options}\label{low} +\omg{code} +The \opt{code} option select the type of the bar code. The list of valid values will be given +in later sections. This is the only option that has no default value. + +\omg{X} +Option \opt{X} specifies the module width, \ie. the width of a thin line. Its default value is the +smallest allowed width 0.19\,mm. + +\omg{H} +The \opt{H} option is the width of the bar code. The default value is calculated dynamically as +40~times the module width. + +\omg{ratio} +The \opt{ratio} option defines the ratio of thin and thick bars. The default value is~3. Remember +that some applications require a particular value. + +\omg{K} +The \opt{K} option specifies the width of a bar used in the start/stop characters of the 2/5 Matrix +bar code as a multiple of the width of the thick bar. It must hold $1.5 \leq \mathrm{K} \leq 4$. The +default value is~2. + +\omg{MtoXratio} +The characters in most bar codes start and end with a bar so that they must be separated with w +blank space. The width of the space must be wide at least as the module width but may be larger. +The width of such a space is defined as a ration to the module width by the \opt{MtoXratio} option. +Its default value is~1. It will rarely be changed. + +\section{Family of 2/5 Bar Codes} +The package implements the whole family of 2/5 bar codes. Their list is given in table~\ref{25}. +Remember that the 2/5 Interleaved bar code requires even number of digits. If odd number of digits +is given, zero is prepended. + +\begin{table}[hbt] +\caption{Samples of 2/5 barcodes, encoded sequence is 0123456789, module width 0,19\,mm, ratio~3, +height~3\,mm}\label{25} +\medskip +\begin{center} +\begin{tabular}{|r|l|}\hline +\bfseries Code name & \bfseries Bar code\\\hline +2/5-Industrial & \barcode[code=2/5-Industrial]{0123456789} \\ +2/5-Inverted& \barcode[code=2/5-Inverted]{0123456789}\\ +2/5-IATA& \barcode[code=2/5-IATA]{0123456789}\\ +2/5-Matrix& \barcode[code=2/5-Matrix]{0123456789}\\ +2/5-Datalogic& \barcode[code=2/5-Datalogic]{0123456789}\\ +2/5-Interleaved& \barcode[code=2/5-Interleaved]{0123456789}\\ +\hline +\end{tabular} +\end{center} +\end{table} + +\section{Code39} +The package currently supports only the basic version of the Code39 bar code. The sample is given in +section~\ref{usage}. The full ASCII bar code will be implemented in a later version of the package. + +\section{Labels for HP Storage Media} +\cmg{HPlabel} +The labels for HP storage media are produced by the \cmd{HPlabel} command. Its parametr is the +requested code. The code must contain exactly 8~characters. The syntax is fixed but not verified by +the macro. It is only checked whether the number of charactes is correct. It is required that the +\pkg{rotating} package is loaded manually. Options described in section~\ref{low} cannot be used as +an optional argument and are ignored if given in the \cmd{usepackage} command because all +dimensions are fixed. + +The author of the package gives no warranty that the code produced by this macro will be usable. HP +requires high printing quality saying that laser printers are not good enough for such purpose. +However, bars on the labels bought from HP were grey, not black. As already written the dimensions +are not given in the documentation. The dimensions used here were determined by careful measuring a +bought label. A label printed on an HP laser printer with resolution 600\,dpi was tested on a real +hardware and it worked. + +An example of such a bar code is given in figure~\ref{hp}. The frame +is not a part of the \cmd{HPlabel} macro output but is displayed here in order to show the real +size of the label. + +\begin{figure}[hbt] +\begin{center} +\fboxsep 0mm +\fbox{\HPlabel{CLNU01L1}} +\end{center} +\caption{Example of a label for an HP cleaning casette, code CLNU01L1}\label{hp} +\end{figure} + +\section{ITF-6, ITF-14, And ITF-16 Bar Codes}\label{itf} +\cmg{ITFbarcode} +The ITF bar codes are basically 2/5 Interleaved codes with 6, 14 or 16 digits. The last digit is a +checksum calculated by the same algorithm as for EAN13 bar codes. The macro verifies the number of +digits supplied, not the checksum. The bar code must be printed in a +frame. Sometimes only horizontal lines are sufficient. Human readable information is printed below +the bar code. The author has seen several types of formatting the human readable information on real bar +codes. The one that seemed most reasonable was therefore chosen. + +The bar code is always composed in a \cmd{vbox}. It might be necessary to use \cmd{leavevmode} in +front of the \cmd{ITFbarcode} macro. + +Dimensions of the ITF bar codes are fixed. Options defines in section~\ref{low} are thus ignored, +only the \opt{bcorr} option is allowed. Properties of the ITF bar codes are selected by a special +set of options that can be given either as an optional argument to the \cmd{ITFbarcode} macro or in +the \cmd{usepackage} command. + +\omg{frame} +The \opt{frame} option is boolean, \ie. allowed values are \true\ and \false. The default value is +\true. It requires prining the bar code inside a frame. An example is shown in +figure~\ref{itf.frame}. + +\begin{figure}[hbt] +\begin{center} +\leavevmode\ITFbarcode{15412345678908} +\end{center} +\caption{ITF-14 bar code with a frame}\label{itf.frame} +\end{figure} + +\omg{lines} +The \opt{lines} option is complementary to the \opt{frame} options. Its default value is therefore +\false. It requires printing the bar code within lines as shown in figure~\ref{itf.lines}. + +\begin{figure}[hbt] +\begin{center} +\leavevmode\ITFbarcode[lines]{15412345678908} +\end{center} +\caption{ITF-14 bar code with lines}\label{itf.lines} +\end{figure} + +\omg{S.6}\omg{S.7}\omg{S.8}\omg{S.9}\omg{S1}\omg{S1.1}\omg{S1.2} +Size of the ITF bar code can be selected from the list of predefined options. The names of these +options are derived from the values of the scaling factors. By choosing the size options the +low-level options \opt{X} and \opt{H} are set to proper values. Option \opt{ratio} is always~2.5 +and \opt{MtoXratio} is~1. Option \opt{code} is \texttt{2/5-Interleaved}. The framed form requires a +blank area in front of and after the bar code (inside the frame). All dimensions are given in +table~\ref{itfdim}. If no size option is given, \opt{S1} is the default. Human readable information +is always typeset with the OCR-B font at 12\,pt. + +\begin{table}[hbt] +\caption{Dimensions of the ITF bar codes (in milimeters)}\label{itfdim} +\medskip +\begin{center} +\newcolumntype{N}{D{.}{.}{3}} +\newcolumntype{M}{D{.}{.}{1}} +\newcommand*\R[1]{\multicolumn{1}{r}{\bfseries #1}} +\newcommand*\RR[1]{\multicolumn{1}{r|}{\bfseries #1}} +\begin{tabular}{|lNNMM|}\hline +\bfseries Option & \R{Scale} & \R{Module} & \R{Blank area} & \RR{Height}\\ \hline +S1.2& 1.2 & 1.219 & 13.1 & 38.2 \\ +S1.1& 1.1 & 1.118 & 12.0 & 35.0 \\ +S1 & 1.0 & 1.016 & 10.9 & 31.8 \\ +S.9 & 0.9 & 0.914 & 9.8 & 28.7 \\ +S.8 & 0.8 & 0.813 & 8.7 & 25.4 \\ +S.7 & 0.7 & 0.711 & 7.1 & 22.3 \\ +S.6 & 0.625& 0.635 & 6.4 & 19.8 \\ +\hline +\end{tabular} +\end{center} +\end{table} + + +\section{License} +The package can be used and distributed according to the LaTeX Project Public License version~1.3 +or later the +text of which can be found at the \texttt{License.txt} file in the \texttt{doc} directory or at +\url{http://www.latex-project.org/lppl.txt} + +\section{References} +\begin{enumerate}\itemsep 0mm \parsep 0mm +\item Storage Media from HP. \url{http://www.hp.com/go/storagemedia}\label{hpstorage} +\item HP Bar Code Label Packs. +\url{http://h18006.www1.hp.com/storage/tapestorage/storagemedia/bar\_code\_label.html}\label{hplabel} +\item Petr Olšák: The EAN barcodes by \TeX. TUGboat 15 (December 1994), No. 4, pp.~459--464. +\url{http://www.tug.org/TUGboat/Articles/tb15-4/tb45olsa.pdf}\label{olsak} + +\item Adriana Benadiková, Stefan Mada and Stanislav +Weinlich: \textit{Čárové kódy, automatická iden\-ti\-fi\-kace (Barcodes, the Automatic +Identification)}. +Grada 1994, 272 pp., ISBN \hbox{80-85623-66-8}. +\end{enumerate} + +\end{document} |