| 1 |
%% |
| 2 |
%% This is file `bcfaq.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% barcodes.dtx (with options: `bcfaq') |
| 8 |
%% As this is a generated file, you may perhaps not want to edit it. |
| 9 |
%% This file belongs to the barcode package. |
| 10 |
%% It may be of no great use without the rest of the barcode package. |
| 11 |
%% \CharacterTable |
| 12 |
%% {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 |
| 13 |
%% 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 |
| 14 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 15 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 16 |
%% Dollar \$ Percent \% Ampersand \& |
| 17 |
%% Acute accent \' Left paren \( Right paren \) |
| 18 |
%% Asterisk \* Plus \+ Comma \, |
| 19 |
%% Minus \- Point \. Solidus \/ |
| 20 |
%% Colon \: Semicolon \; Less than \< |
| 21 |
%% Equals \= Greater than \> Question mark \? |
| 22 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 23 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 24 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 25 |
%% Right brace \} Tilde \~} |
| 26 |
%% |
| 27 |
\documentclass[a4paper]{article} |
| 28 |
\bibliographystyle{alpha} |
| 29 |
|
| 30 |
|
| 31 |
\font\itf=wlitf scaled 1200 |
| 32 |
|
| 33 |
\def\bcbox#1{\lower3pt\hbox{\itf +#1-}} |
| 34 |
|
| 35 |
\newbox\bsavebox |
| 36 |
\newdimen\bcboxdepth |
| 37 |
\bcboxdepth=4pt |
| 38 |
\def\bdbox#1{\setbox\bsavebox\hbox{\itf +#1-} |
| 39 |
\vbox{\hsize=\wd\bsavebox\offinterlineskip% |
| 40 |
\copy\bsavebox% |
| 41 |
\vskip-\ht\bsavebox\vskip\bcboxdepth% |
| 42 |
\box\bsavebox\vskip-\bcboxdepth}} |
| 43 |
\def\bebox#1{\setbox\bsavebox\hbox{\itf +#1-} |
| 44 |
\vbox{\hsize=\wd\bsavebox\offinterlineskip% |
| 45 |
\copy\bsavebox% |
| 46 |
\copy\bsavebox% |
| 47 |
\vskip-\ht\bsavebox\vskip\bcboxdepth% |
| 48 |
\box\bsavebox\vskip-\bcboxdepth}} |
| 49 |
|
| 50 |
\def\tbs{{\tt\char92}} |
| 51 |
\begin{document} |
| 52 |
\title{Barcodes-FAQ} |
| 53 |
\author{Peter Willadt} |
| 54 |
\date{2003-05-24} |
| 55 |
\maketitle |
| 56 |
\begin{abstract} |
| 57 |
|
| 58 |
This file deals with questions about barcode fonts created for |
| 59 |
\TeX{}. Its purpose is not to replace the regular documents, but to add |
| 60 |
informations that may be of no interest for the casual reader. |
| 61 |
|
| 62 |
\end{abstract} |
| 63 |
|
| 64 |
\section{Changelog} |
| 65 |
|
| 66 |
\subsection{Changes of the barcode package in general} |
| 67 |
\begin{tabular}{ll} |
| 68 |
\em Date & \em Change\\ |
| 69 |
2003-05-24 & new release with some corrections to codean.pl\\ |
| 70 |
& Thanks to Jacek Ruzycka (uv\[email protected])\\ |
| 71 |
1999-05-29 & added license note to README\\ |
| 72 |
1999-05-29 & added install.bat\\ |
| 73 |
1998-11-28 & included wlcr39, wlcf39, and wlc93\\ |
| 74 |
1998-04-21 & fixed wlitf bug\\ |
| 75 |
1998-04-10 & switched partially to docstrip archive\\ |
| 76 |
& added support for code 11\\ |
| 77 |
1998-01-24 & added code 128 in MF format, changed codean.pl\\ |
| 78 |
1997-11-08 & changed metrics of {\sc itf} start/stop chars\\ |
| 79 |
1997-10-09 & released first version of the barcode package |
| 80 |
\end{tabular} |
| 81 |
|
| 82 |
\subsection{Changes within this document} |
| 83 |
|
| 84 |
\begin{tabular}{ll} |
| 85 |
\em Date & \em Change\\ |
| 86 |
1999-05-29 & added short info about install.bat\\ |
| 87 |
1998-11-28 & added docs about code 93\\ |
| 88 |
1998-04-10 & added docs about code 11\\ |
| 89 |
1998-01-24 & added information about code 128\\ |
| 90 |
1997-12-08 & added contributions to {\sc ean} coding by Kalvis M. Jansons\\ |
| 91 |
& changed section on plessey\\ |
| 92 |
1997-11-09 & added several items, rearranged sections\\ |
| 93 |
1997-11-08 & started writing first version |
| 94 |
\end{tabular} |
| 95 |
|
| 96 |
\section{Introduction} |
| 97 |
|
| 98 |
The barcode package itself can be found on {\tt ctan} in the |
| 99 |
subdirectory\\ {\tt fonts/barcodes/willadt}. It contains---among |
| 100 |
others---several fonts in {\sc vpl} format, so your {\sc dvi} driver |
| 101 |
should be able to handle virtual fonts. If it doesn't, you may perhaps |
| 102 |
use {\em dvicopy} to resolve the references to virtual fonts, or you |
| 103 |
may perhaps upgrade to a more modern \TeX{} package. |
| 104 |
|
| 105 |
\section{What about docs?} |
| 106 |
|
| 107 |
\subsection{Docs about barcodes} |
| 108 |
|
| 109 |
With the barcode package, there comes documentation about {\sc ean} |
| 110 |
fonts. In the README file, there are short examples of the use of |
| 111 |
the other fonts, too. Also the files {\tt examples.tex} shows the look |
| 112 |
and basic usage of the barcodes. |
| 113 |
|
| 114 |
In {\sl TUGboat}, barcoding has been covered in several |
| 115 |
articles \cite{bc:ean,bc:sauter,bc:vulis}. The barcode package itself |
| 116 |
is covered in an article that has appeared in the december issue, |
| 117 |
1997, of {\sl TUGboat}. As TUGboat is making the elder articles available |
| 118 |
online, I recommend looking for it. |
| 119 |
|
| 120 |
\subsection{Some information about code 128} |
| 121 |
|
| 122 |
Code 128 is able to print all 128 ascii chars. There are a little more |
| 123 |
than a hundred glyphs that are interpreted in three different |
| 124 |
ways. Some of the glyphs are used as shift chars to determine which |
| 125 |
interpretation to use. A checksum is mandatory. To use it, you must |
| 126 |
install {\tt wlc128.mf}. |
| 127 |
|
| 128 |
The preprocessing---switching among the different character sets, |
| 129 |
coding efficiently, calculating the checksum---is handled by the |
| 130 |
newer versions of codean.pl. This is perhaps not as pleasing as to do |
| 131 |
it with \TeX{} alone, but, alas, it works. |
| 132 |
|
| 133 |
The way to run the preprocessor is described in {\tt eandoc.tex}. To |
| 134 |
use code 128, you have to write a line starting with {\tt\tbs cxxviii\{} |
| 135 |
followed by the characters you want to code and followed by a closing |
| 136 |
brace. Non-printing seven-bit ascii characters may be specified in hex |
| 137 |
in C or \TeX{} style, like {\tt\tbs x3f} or \verb|^^3f|. Anything up to |
| 138 |
the rightmost closing brace in this line will be coded---there is no |
| 139 |
brace matching. But you will get a warning message if your text |
| 140 |
includes a right brace. So you may want to code braces in hex form to |
| 141 |
avoid this message. Please note that {\tt codean.pl} does almost no |
| 142 |
checking for errors, so if you intend to produce garbage, there are |
| 143 |
lots of ways. If you need code 128 escape characters, they may be |
| 144 |
included as hex characters with codes starting at 0x80. |
| 145 |
|
| 146 |
\begin{tabular}{lllll} |
| 147 |
\em Input Code & \em C128 number &\multicolumn{3}{c}{\em meaning}\\ |
| 148 |
\em(hex) & \em(dec.) & \em Set A & \em Set B & \em Set C\\ |
| 149 |
0x80 & 96 & FNC3 & FNC3 & 96\\ |
| 150 |
0x81 & 97 & FNC2 & FNC2 & 97\\ |
| 151 |
0x82 & 98 & SHIFT & SHIFT & 98\\ |
| 152 |
0x83 & 99 & CODE C& CODE C& 99\\ |
| 153 |
0x84 & 100 & CODE B& FNC4 & CODE B\\ |
| 154 |
0x85 & 101 & FNC4 & CODE A& CODE A\\ |
| 155 |
0x86 & 102 & FNC1 & FNC1 & FNC1\\ |
| 156 |
0x87 & 103 & START A& START A& START A\\ |
| 157 |
0x88 & 104 & START B& START B& START B\\ |
| 158 |
0x89 & 105 & START C& START C& START C\\ |
| 159 |
0x8a & 106 & STOP & STOP & STOP |
| 160 |
\end{tabular} |
| 161 |
|
| 162 |
But please keep in mind that {\tt codean.pl} does almost anything for you, |
| 163 |
you should not have the need to insert start/stop codes and the |
| 164 |
like. Only if you use EAN128, you will need {\tt FNC1}. Just to make |
| 165 |
it clear: For your barcode to include {\tt FNC1} you have to write |
| 166 |
\verb|^^86| before preprocessing. |
| 167 |
|
| 168 |
{\tt codean.pl} will insert a sequence of hex digits; the original |
| 169 |
text will be appended to the line as a comment. |
| 170 |
Also, your \TeX{} file has to define some macros. They look like |
| 171 |
this: |
| 172 |
|
| 173 |
\begin{verbatim} |
| 174 |
\font\fntcxx=wlc128 scaled \magstep3 |
| 175 |
\def\CXXVIII{\bgroup\fntcxx\let\next\hexchar\next} |
| 176 |
\def\cxxviii{\message{OOPS, use codean.pl}} |
| 177 |
\def\hexchar#1#2{\if#1@ |
| 178 |
\global\let\next\egroup |
| 179 |
\else\char"#1#2\fi\next} |
| 180 |
\end{verbatim} |
| 181 |
|
| 182 |
If you do not like end recursion, you might use other ones. If |
| 183 |
you dislike the hex format produced by {\tt codean.pl}, you are free to |
| 184 |
change it---as long as you don't redistribute. |
| 185 |
|
| 186 |
\subsection{A little bit about code 11} |
| 187 |
|
| 188 |
Code 11 is a numeric-only barcode. It is almost as space-efficient as |
| 189 |
{\sc itf}, and it comes with a checksum. The checksum should be |
| 190 |
swallowed by the reading device. The checksum is a weighted mod-11 |
| 191 |
checksum. There are apparently two kinds of checksum in use: such with |
| 192 |
one checkdigit and such with two checkdigits. |
| 193 |
|
| 194 |
To use code 11, you should include {\tt barcode.sty}. \TeX{} will |
| 195 |
calculate the checksum on its own. If you need two check digits, you |
| 196 |
should say\\ |
| 197 |
{\tt\tbs codexichecksumktrue}.\\ |
| 198 |
How many check digits you |
| 199 |
actually need should be made clear in the documentation to your |
| 200 |
reading device\footnote{You may also want to check the documentation |
| 201 |
to find out if your reading device supports code 11 at all; code 11 is |
| 202 |
not that common.}. You may code the digits 0--9, and the minus |
| 203 |
sign. The start and stop sign is mapped to the @ character. Here is a |
| 204 |
full example. {Please note: If you do not use \LaTeX{}, you may |
| 205 |
have to supply a definition for {\tt\tbs makeatletter} |
| 206 |
and {\tt\tbs makeatother}}: |
| 207 |
|
| 208 |
\begin{verbatim} |
| 209 |
\input barcodes.sty |
| 210 |
%% with two check digits |
| 211 |
\codexichecksumktrue |
| 212 |
\codxi{12-1234} |
| 213 |
|
| 214 |
%% with only one check digit. |
| 215 |
\codexichecksumkfalse |
| 216 |
\codxi{12-1234} |
| 217 |
\bye |
| 218 |
\end{verbatim} |
| 219 |
|
| 220 |
\subsection{Which Code 39 should I use, there are different versions?} |
| 221 |
|
| 222 |
Well, you may \verb|\input code39| in your \TeX\ document to get the |
| 223 |
macro version. It is absolutely flexible in repect of barcode size and |
| 224 |
so on, but it is made of \TeX\ macros and there are probably |
| 225 |
situations where you may prefer a {\em real} font. So there is {\tt |
| 226 |
wlc39.mf} as a real font, {\tt wlcr39.mf} as a font running sideways, |
| 227 |
and{\tt wlcf39.vpl} as a full ascii code 39 in vpl format. The |
| 228 |
ltter two fonts are experimental, that means, they are not that much |
| 229 |
tested as the others. |
| 230 |
|
| 231 |
I recommend using either the \TeX\ macro or {\tt wlc39.mf}. The others |
| 232 |
are too special for normal use, rotation by the graohics driver is |
| 233 |
mor robust than building towers of letters, and full ascii code~39 is |
| 234 |
less than optimal. |
| 235 |
|
| 236 |
\subsection{About code 93} |
| 237 |
|
| 238 |
Code 93 is a little bit more compact than code 39 (as it uses also the |
| 239 |
gap between the characters), but in other aspects it is quite |
| 240 |
similiar. A checksum with two digits is mandatory. As with code 11, |
| 241 |
checksumming works by weighing the characters different depending on |
| 242 |
their position within the barcode. |
| 243 |
|
| 244 |
The version of code 93 that is included within the package resorts to |
| 245 |
uppercase ascii, digits, and to some other signs. Start and stop sign |
| 246 |
are mapped to {\tt<} and {\tt>}, respectively. |
| 247 |
|
| 248 |
Full ascii works similiar to full ascii with code 39 (that means with |
| 249 |
escape characters), but fortunately the escape characters are |
| 250 |
different from ordinary characters, so that you can hardly be |
| 251 |
misunderstood. Unfortunately the escape characters are named (\$), |
| 252 |
(\%), (/), and (+), so I decided to map them to opening and closing |
| 253 |
parentheses and brackets, respectively. This may not seem very clever |
| 254 |
when it comes to full ascii, but these characters may also appear as |
| 255 |
checksum characters, so we need them when doing uppercase ascii, |
| 256 |
too. For full ascii, it would be clever to redo the font in a |
| 257 |
completely different way and to map start sign, stop sign and the four |
| 258 |
escape characters to positions above 128, so that any 7 bit ascii |
| 259 |
character can be input directly. |
| 260 |
|
| 261 |
Code 93 is supported by codean.pl in the same way as ean or code 128 |
| 262 |
are. You have to write {\tt\tbs xciii\{YOUR DATA 123\}}, run the file |
| 263 |
through {\tt codean.pl}, then you'll get\\ |
| 264 |
{\tt\tbs XCIII\{YOUR DATA 123NN\}\%Code93(YOUR DATA 123)} |
| 265 |
|
| 266 |
The NN make up the two check characters. Normally, they are different, |
| 267 |
but in this example they are equal, by incident. |
| 268 |
|
| 269 |
\subsection{Docs about VPL Files} |
| 270 |
|
| 271 |
VPL files are documented in the files {\tt VPtoVF.WEB} and {\tt |
| 272 |
VFtoVP.WEB}. Both files can be found on {\sc ctan} under {\tt |
| 273 |
SYSTEMS/KNUTH}. {\em WEAVE} may be used to produce \TeX{} files. The |
| 274 |
documentation about the VPL/VF file formats is covered within the |
| 275 |
first few sections. |
| 276 |
|
| 277 |
\section{I want other metrics etc.} |
| 278 |
|
| 279 |
\subsection{My barcodes should have depth} |
| 280 |
|
| 281 |
You have got several possibilities to obtain depth. The most simple |
| 282 |
approach may be to set the barcodes with the regular barcode fonts into an |
| 283 |
{\tt\tbs hbox} and then to {\tt\tbs lower} this hbox. |
| 284 |
|
| 285 |
Let's look at an example: |
| 286 |
|
| 287 |
\begin{verbatim} |
| 288 |
\font\itf=wlitf scaled 1200 |
| 289 |
\def\bcbox#1{\lower3pt\hbox{\itf +#1-}} |
| 290 |
Example: |
| 291 |
{\sc itf} barcode looks like \quad\bcbox{1009}\quad |
| 292 |
for 1009, e.g. |
| 293 |
\end{verbatim} |
| 294 |
|
| 295 |
This code yields the following result: |
| 296 |
|
| 297 |
{\sc itf} barcode looks like \quad\bcbox{1009}\quad for 1009, e.g. |
| 298 |
|
| 299 |
Another approach is to edit the font sources. In case of {\sc vpl} |
| 300 |
files, this is quite painful. Rules in {\sc vpl} files do not have |
| 301 |
depth, so you have to change the characters mapping in a way that you |
| 302 |
add a {\em movedown} before you draw, and a {\em moveup} afterwards. |
| 303 |
You may see the changes for an arbitrary character from {\tt |
| 304 |
WLITF.VPL}: |
| 305 |
|
| 306 |
\begin{verbatim} |
| 307 |
(CHARACTER D48 |
| 308 |
(COMMENT from WLITF.VPL} |
| 309 |
(CHARWD D 14) (CHARHT R 10) |
| 310 |
(CHARDP R 0) (CHARIC R 0.0) |
| 311 |
(MAP |
| 312 |
(SETRULE R 14 R 1)(MOVERIGHT R 1) |
| 313 |
(SETRULE R 14 R 1)(MOVERIGHT R 1) |
| 314 |
(SETRULE R 14 R 2)(MOVERIGHT R 2) |
| 315 |
(SETRULE R 14 R 2)(MOVERIGHT R 2) |
| 316 |
(SETRULE R 14 R 1)(MOVERIGHT R 1) |
| 317 |
) |
| 318 |
) |
| 319 |
\end{verbatim} |
| 320 |
|
| 321 |
This character may be lowered by four units by editing in a way that the |
| 322 |
following lines result. Please note that there were not only the {\em |
| 323 |
moveup} and {\em movedown} commands added, but also the height an |
| 324 |
depth have been changed. |
| 325 |
|
| 326 |
\begin{verbatim} |
| 327 |
(CHARACTER D48 |
| 328 |
(COMMENT Lowered to give some depth) |
| 329 |
(CHARWD D 14) (CHARHT R 10) |
| 330 |
(CHARDP R 4) (CHARIC R 0.0) |
| 331 |
(MAP |
| 332 |
(MOVEDOWN R 4) |
| 333 |
(SETRULE R 14 R 1)(MOVERIGHT R 1) |
| 334 |
(SETRULE R 14 R 1)(MOVERIGHT R 1) |
| 335 |
(SETRULE R 14 R 2)(MOVERIGHT R 2) |
| 336 |
(SETRULE R 14 R 2)(MOVERIGHT R 2) |
| 337 |
(SETRULE R 14 R 1)(MOVERIGHT R 1) |
| 338 |
(MOVEUP R 4) |
| 339 |
) |
| 340 |
) |
| 341 |
\end{verbatim} |
| 342 |
|
| 343 |
\subsection{My barcodes are too tall} |
| 344 |
|
| 345 |
For the sake of the person who has to scan the barcodes, barcodes just |
| 346 |
can't be tall enough. If the complete code is as tall as wide, the |
| 347 |
reading device can be twisted against the code at an angle of 45 |
| 348 |
degrees. If they are half as high, the angle reduces to 26 degrees. |
| 349 |
|
| 350 |
If you really want short codes, you have to edit the sources. In the |
| 351 |
{\sc vpl} file, you have to change the {\em charht} and the first parameter |
| 352 |
to the {\em setrule} command at well. You also should change the {\em |
| 353 |
designsize} parameter. |
| 354 |
|
| 355 |
For the EAN font, search for {\tt bheight\#} and change {\tt22.85 |
| 356 |
mm\#} to the height you need. To get an EAN font without the digits |
| 357 |
(bars only), you also have to edit the character definitions by |
| 358 |
leaving out the last lines (saying {\tt nuller;}, e.g. and you have to |
| 359 |
change the formula for calculating {\tt totheight} to not include the |
| 360 |
height of the digits any more, also you should remove any references |
| 361 |
to {\tt klotz}. |
| 362 |
|
| 363 |
\subsection{My barcodes are not tall enough} |
| 364 |
|
| 365 |
You may also change the sources, like described in the previous |
| 366 |
subsection. But there is another solution that is perhaps more |
| 367 |
practical. The idea is simple that double black is still black and |
| 368 |
that you may overlay several printouts of the same barcode. Here is |
| 369 |
the example code (it may be made taller by adding more copies of the |
| 370 |
barcode box, of course). There is an extra dimension {\em bcboxdepth} |
| 371 |
added to yield depth for the barcodes. |
| 372 |
|
| 373 |
\begin{verbatim} |
| 374 |
\newbox\bsavebox |
| 375 |
\newdimen\bcboxdepth |
| 376 |
\bcboxdepth=4pt |
| 377 |
\def\bdbox#1{\setbox\bsavebox\hbox{\itf +#1-} |
| 378 |
\vbox{\hsize=\wd\bsavebox\copy\bsavebox% |
| 379 |
\vskip-\ht\bsavebox\vskip\bcboxdepth% |
| 380 |
\box\bsavebox\vskip-\bcboxdepth}} |
| 381 |
\def\bebox#1{\setbox\bsavebox\hbox{\itf +#1-} |
| 382 |
\vbox{\hsize=\wd\bsavebox\copy\bsavebox% |
| 383 |
\vskip0pt\copy\bsavebox% |
| 384 |
\vskip-\ht\bsavebox\vskip\bcboxdepth% |
| 385 |
\box\bsavebox\vskip-\bcboxdepth}} |
| 386 |
Example: |
| 387 |
Tall {\sc itf} barcode looks like \quad\bdbox{1009}\quad |
| 388 |
or (still taller) \quad\bebox{1009}\quad for 1009, e.g. |
| 389 |
\end{verbatim} |
| 390 |
|
| 391 |
And here is the result, you may compare it with the output of the |
| 392 |
previous example: |
| 393 |
|
| 394 |
Tall {\sc itf} barcode looks like \quad\bdbox{1009}\quad or (still |
| 395 |
taller) \quad\bebox{1009}\quad for 1009, e.g. |
| 396 |
|
| 397 |
\subsection{My barcodes are too wide/too narrow} |
| 398 |
|
| 399 |
Perhaps you should change the barcode size (by changing |
| 400 |
{\tt\tbs magnification}) and then read the subsections above about too |
| 401 |
tall bars and bars that are not tall enough. |
| 402 |
|
| 403 |
\subsection{My barcodes should run vertically} |
| 404 |
|
| 405 |
Vertically oriented barcode is a good idea for cans, bottles and |
| 406 |
similiar things. |
| 407 |
|
| 408 |
It just depends on your {\sc dvi} driver. Perhaps there is a |
| 409 |
possibility to handle rotation via {\tt\tbs special}, as with {\em |
| 410 |
dvips} and the {\em rotate} macros. For experimantal purposes I have |
| 411 |
included a code 39 version running down instead right ({\tt |
| 412 |
wlcr39.mf}). You may perhaps use it with {\tt\tbs shortstack} or |
| 413 |
similiar. Here is some code I used (successfully) with plain \TeX: |
| 414 |
|
| 415 |
\begin{verbatim} |
| 416 |
\font\testfont=wlcr39 scaled 1200 |
| 417 |
\def\bcbax{\let\next\bcbox\vbox\bgroup |
| 418 |
\offinterlineskip\testfont\setbox0\hbox{@}\hsize=\wd0 |
| 419 |
\noindent{}@\hfil\break\next} |
| 420 |
\def\fertig{@\hfil\break\egroup} |
| 421 |
\def\bcbox#1{\if @#1\let\next\fertig\else#1\hfil\break\fi\next} |
| 422 |
|
| 423 |
Look buddy, this is \bcbax1406632@ code 39 |
| 424 |
stacked and running downwards. |
| 425 |
\end{verbatim} |
| 426 |
|
| 427 |
\subsection{I heard something about full ascii code 39} |
| 428 |
|
| 429 |
Well, umh, now that you ask\dots The truth is: You may perhaps be able to |
| 430 |
configure your reading device to accept full ascii code~39. Then you may |
| 431 |
code any 7~bit character you may think of. The bad news is that most of |
| 432 |
the symbols have to be coded by two |
| 433 |
characters -- and as code 39 has already low density, you should not |
| 434 |
expect to get much use of it. Perhaps you might want to try code 128 |
| 435 |
instead---it features full 7-bit ascii without any compromise. |
| 436 |
|
| 437 |
Another anti-feature is that switching to reading full-ascii code~39 |
| 438 |
may lead to some bad reads of `normal' code~39. In full ascii, the lower |
| 439 |
case letters, e.g., are made by prepending the uppercase letters with a |
| 440 |
plus sign, so {\tt+A} is read as {\tt a}. So, if you have got regular |
| 441 |
code~39 that contains such character sequences, and you have switched |
| 442 |
your reading device to full ascii, you may get bad results. |
| 443 |
|
| 444 |
But, now that you want it: With the barcode package there comes a font |
| 445 |
{\tt wlcf39.vpl}. You may install it like the other vpl files. It has got |
| 446 |
132 characters and has already taken all the coding for full ascii, so |
| 447 |
when you typ {\tt e,\$4+A}, it will silently be mapped to what you |
| 448 |
would have typed as {\tt+E/L/D/KA}, if you would use the plain code~39 |
| 449 |
format\footnote{Please take note: 6 characters are blown up to 9, |
| 450 |
think again about using another code}. In my version of full ascii |
| 451 |
code~39, the start/stop sign is mapped to @@ (or \verb|\char128|). So |
| 452 |
you actually had to add @@ to the front and the end of the example |
| 453 |
string. If you can not exclude that the character sequence @@ appears |
| 454 |
within the text you want to code, you have to avoid ligature |
| 455 |
processing. You may do that like this: |
| 456 |
|
| 457 |
\begin{verbatim} |
| 458 |
\font\fullas=wlcf39 scaled 1728 |
| 459 |
\def\alphanolig{\char64\kern0pt} |
| 460 |
\def\printacode#1{{\fullas@@{\catcode`\@=\active% |
| 461 |
\let @=\alphanolig#1}@@}} |
| 462 |
\end{verbatim} |
| 463 |
|
| 464 |
You also have to escape or circumscribe special characters to make |
| 465 |
them really printable, of course, so that when you wanted a backspace, |
| 466 |
a tab, a space, a dollar sign, a percent sign, and a bell character to |
| 467 |
be coded, you would type something like |
| 468 |
|
| 469 |
\begin{verbatim} |
| 470 |
{\fullas @@\char8\char9\char32\$\%\char7} |
| 471 |
\end{verbatim} |
| 472 |
|
| 473 |
\section{Troubleshooting} |
| 474 |
|
| 475 |
\subsection{My barcodes can't be decoded} |
| 476 |
|
| 477 |
At the very, very first, check if you really have added start and stop |
| 478 |
codes. If you haven't, you're lost. Then check if you have enabled |
| 479 |
decoding of your special barcodes within your reading device. With |
| 480 |
modern scanners, you can disable almost any coding scheme. |
| 481 |
|
| 482 |
At first, try to make them larger. If that does't help, make them |
| 483 |
larger, again. If that will not help, obtain fonts in \TeX{} or |
| 484 |
Metafont format and make them brighter. Or, perhaps better, obtain a |
| 485 |
better printer. |
| 486 |
|
| 487 |
You also should check the contrast between bars and background, |
| 488 |
especially when using a dot matrix printer or coloured background |
| 489 |
or---still worse---red bars. |
| 490 |
|
| 491 |
\subsection{My decoder reads extra digits, sometimes} |
| 492 |
|
| 493 |
I guess you use {\sc itf} barcode with a number of digits that is |
| 494 |
sometimes even and sometimes odd. As {\sc itf} always codes two digits |
| 495 |
at once, you should take care just to code an even number of digits at |
| 496 |
any time. If an excess zero at the beginning of your number is not |
| 497 |
acceptable, you might try another kind of barcode instead of {\sc |
| 498 |
itf}. |
| 499 |
|
| 500 |
\subsection{Can't run pdf\TeX\ with barcode fonts} |
| 501 |
|
| 502 |
Get a later version of pdf\TeX, and you're done. |
| 503 |
|
| 504 |
\section{Missing items} |
| 505 |
|
| 506 |
\subsection{I am missing two-of-five} |
| 507 |
|
| 508 |
I got specs for two-of-five (three bars). If you want it, let me know; |
| 509 |
I might implement it. For other kinds of two-of-five, I haven't got |
| 510 |
complete specs. |
| 511 |
|
| 512 |
\subsection{I am missing plessey} |
| 513 |
|
| 514 |
I got the specs but I haven't yet got the time to implement them. With |
| 515 |
plessey, there also rise several questions due to the fact that |
| 516 |
plessey has never been officialy standardized. The only thing that is |
| 517 |
absolutely sure about plessey is how binary ones and zeros are |
| 518 |
encoded. There are codes that are more wide-spread. Several modern |
| 519 |
barcode readers can't cope with plessey code. |
| 520 |
|
| 521 |
\subsection{I am missing \dots{} some other barcode} |
| 522 |
|
| 523 |
I have checked out several two-dimensional barcodes. But for most of |
| 524 |
them, support by \TeX{} seems to be rather pointless. Perhaps Metafont |
| 525 |
could be called any time you have to code something to draw the |
| 526 |
symbols, but you might as well use a custom drawing program that comes |
| 527 |
from the barcode vendor. Also, most two-dimensional barcodes (and |
| 528 |
other barcodes not mentioned here) are proprietary. Last not least the |
| 529 |
reading devices I have access to can deal only with a finite range of |
| 530 |
barcodes. |
| 531 |
|
| 532 |
I am sorry, but I haven't got the specs for further barcodes |
| 533 |
not mentioned here. If you could be so kind as to send them to me, I |
| 534 |
might perhaps implement them. |
| 535 |
|
| 536 |
\section{Contributions} |
| 537 |
|
| 538 |
\subsection{EAN without preprocessing} |
| 539 |
|
| 540 |
The following code is due to Kalvis M. Jansons. |
| 541 |
|
| 542 |
It handles printing of {\sc ean} without having to run a |
| 543 |
preprocessor. Not only are the {\sc ean} bars drawn, also the checksum |
| 544 |
checksum is checked. It can be easily |
| 545 |
adapted to non-\LaTeX{} use by omitting anything before \verb|\font| |
| 546 |
|
| 547 |
\begin{verse} |
| 548 |
Kalvis M. Jansons |
| 549 |
|
| 550 |
eMail: \verb|<[email protected]>| |
| 551 |
|
| 552 |
\end{verse} |
| 553 |
|
| 554 |
An easy way to use the barcode fonts in \LaTeX{}: |
| 555 |
|
| 556 |
\begin{verbatim} |
| 557 |
\documentclass[a4paper]{article} |
| 558 |
|
| 559 |
\pagestyle{empty} |
| 560 |
|
| 561 |
\setlength{\oddsidemargin}{0pt} |
| 562 |
\setlength{\textwidth}{\paperwidth} |
| 563 |
\addtolength{\textwidth}{-2in} |
| 564 |
\setlength{\marginparwidth}{0pt} |
| 565 |
|
| 566 |
\setlength{\textheight}{\paperheight} |
| 567 |
\addtolength{\textheight}{-2.5in} |
| 568 |
\setlength{\topmargin}{0pt} |
| 569 |
|
| 570 |
\font\eanfont=WLEAN scaled 2000 |
| 571 |
\def\ean#1{\vbox{\vskip20pt\eanfont#1\vskip20pt}} |
| 572 |
\newcount\num |
| 573 |
\def\a#1{\num=#1 \advance\num by `A \char\num} |
| 574 |
\def\b#1{\num=#1 \advance\num by `a \char\num} |
| 575 |
\def\c#1{\num=#1 \advance\num by `K \char\num} |
| 576 |
\def\C#1#2#3#4#5#6{\c#1\c#2\c#3\c#4\c#5\c#6} |
| 577 |
|
| 578 |
\def\A#1#2#3#4#5#6#7{\ifcase #7 |
| 579 |
{\a#1\a#2\a#3\a#4\a#5\a#6}% |
| 580 |
\or {\a#1\a#2\b#3\a#4\b#5\b#6}% |
| 581 |
\or {\a#1\a#2\b#3\b#4\a#5\b#6}% |
| 582 |
\or {\a#1\a#2\b#3\b#4\b#5\a#6}% |
| 583 |
\or {\a#1\b#2\a#3\a#4\b#5\b#6}% |
| 584 |
\or {\a#1\b#2\b#3\a#4\a#5\b#6}% |
| 585 |
\or {\a#1\b#2\b#3\b#4\a#5\a#6}% |
| 586 |
\or {\a#1\b#2\a#3\b#4\a#5\b#6}% |
| 587 |
\or {\a#1\b#2\a#3\b#4\b#5\a#6}% |
| 588 |
\or {\a#1\b#2\b#3\a#4\b#5\a#6}% |
| 589 |
\fi} |
| 590 |
|
| 591 |
\newcount\cha |
| 592 |
\newcount\chb |
| 593 |
\makeatletter |
| 594 |
\long\def\for{\@for} |
| 595 |
\makeatother |
| 596 |
\gdef\mysix#1#2#3#4#5#6{,#1#2,#3#4,#5#6} |
| 597 |
\gdef\mywork#1#2{\advance\cha by #1 \advance\chb by #2} |
| 598 |
\gdef\barch#1.#2.#3.{ |
| 599 |
\xdef\mylist{0#1\mysix#2\mysix#3} |
| 600 |
\cha=0 |
| 601 |
\chb=0 |
| 602 |
\for \x:=\mylist\do{\expandafter\mywork\x} |
| 603 |
\multiply\cha by 3 |
| 604 |
\advance\chb by \cha |
| 605 |
\cha=\chb |
| 606 |
\divide\cha by 10 |
| 607 |
\multiply\cha by -10 |
| 608 |
\advance\chb by \cha} |
| 609 |
\def\bar#1.#2.#3.{\barch#1.#2.#3. |
| 610 |
\ifnum\chb>0 #1#2#3 has a bad check sum!\\[20pt] |
| 611 |
\else \ean{#1 +\A#2#1-\C#3+}\fi} |
| 612 |
\begin{document} |
| 613 |
|
| 614 |
Examples |
| 615 |
|
| 616 |
\bar3.034325.106199. |
| 617 |
|
| 618 |
\bar4.074400.410000. |
| 619 |
|
| 620 |
\bar5.449000.055521. |
| 621 |
|
| 622 |
\bar5.010027.522336. |
| 623 |
|
| 624 |
\bar8.410005.421052. |
| 625 |
|
| 626 |
\bar9.780192.828941. |
| 627 |
|
| 628 |
\end{document} |
| 629 |
\end{verbatim} |
| 630 |
|
| 631 |
\section{Installation} |
| 632 |
|
| 633 |
Installation is described within the README file, in short. |
| 634 |
Here I assume that you have a TDS compliant \TeX{} installation |
| 635 |
already running. |
| 636 |
|
| 637 |
Installation consists of several steps: |
| 638 |
|
| 639 |
\begin{enumerate} |
| 640 |
\item unpack barcodes.dtx by running barcodes.ins through \TeX (I |
| 641 |
guess you have already done that, lest you would not be able to read |
| 642 |
this text), like {\tt tex barcodes.ins} |
| 643 |
\item run {\tt vptovf} on all the vpl files, e.g. type something like |
| 644 |
{\tt vptovf wlitf.vpl wlitf.vf wlitf.tfm} |
| 645 |
\item if your \TeX\ system does not support automatic generation of |
| 646 |
{\tt tfm} files, run mf on all the .mf files. |
| 647 |
\item move all the files to appropriate locations |
| 648 |
\item install codean.pl for use with Perl |
| 649 |
\item run the documentation through \LaTeX{} |
| 650 |
\item clean up |
| 651 |
\end{enumerate} |
| 652 |
|
| 653 |
Items 1,2,4,6, and part of 7 can be automatically executed on ms-dos or |
| 654 |
ms windows systems by running {\tt install.bat}. If you do not supply |
| 655 |
any parameters, {\tt install} will install to {\tt C:\char92TeXMF}. If |
| 656 |
you do supply a parameter, it should be the path to your TEXMF tree |
| 657 |
(no trailing backslash, please). |
| 658 |
|
| 659 |
Here are the appropriate locations mentioned above -- all of them |
| 660 |
in the TEXMF tree: |
| 661 |
|
| 662 |
\begin{tabular}{ll} |
| 663 |
\em move & \em to\\ |
| 664 |
\tt *.mf & \tt fonts/source/public/misc\\ |
| 665 |
\tt *.tfm & \tt fonts/tfm/public/misc\\ |
| 666 |
\tt *.vf & \tt fonts/vf/public\\ |
| 667 |
\tt code39.tex &\tt tex/generic/misc\\ |
| 668 |
\tt barcodes.sty &\tt tex/latex/misc\\ |
| 669 |
\end{tabular} |
| 670 |
|
| 671 |
Of course other locations might also work, but to me it seems fine |
| 672 |
this way. |
| 673 |
|
| 674 |
Running plain \TeX{} on {\tt examples.tex} is the ultimate test: This |
| 675 |
will only work when all the installation is well done. |
| 676 |
|
| 677 |
The installation of Perl programs is beyond the scope of this |
| 678 |
documentation. If you do not need code 128, you can go without |
| 679 |
{\tt codean.pl}, especially if you use the macros described above. |
| 680 |
|
| 681 |
\bibliography{bcfaq} |
| 682 |
|
| 683 |
\end{document} |
| 684 |
\endinput |
| 685 |
%% |
| 686 |
%% End of file `bcfaq.tex'. |