Difference between revisions of "Barcodes"
Jump to navigation
Jump to search
m (add category) |
(better formatting) |
||
Line 6: | Line 6: | ||
* Download `zint` from https://www.zint.org.uk (Windows, Linux) or install it with [https://brew.sh Homebrew] or [https://www.macports.org/install.php MacPorts] (MacOS). | * Download `zint` from https://www.zint.org.uk (Windows, Linux) or install it with [https://brew.sh Homebrew] or [https://www.macports.org/install.php MacPorts] (MacOS). | ||
− | * MkIV: The `zint` executable must be in your `PATH`. | + | * '''MkIV''': The `zint` executable must be in your `PATH`. |
− | * LMTX: | + | * '''LMTX''': LuaMetaTeX uses the library. On Windows, that’s `libzint.dll`, on Linux and MacOS `libzint.so` (on MacOS the actual file name is `libzint.dylib`, but LuaMetaTeX expects `.so`). |
+ | ** Find that file, it should be in `/usr/local/lib` (Linux, Homebrew) or `/opt/local/lib` (MacPorts). | ||
+ | ** Create the path `$TEXROOT/tex/texmf-$ARCH/bin/lib/luametatex/zint`. | ||
+ | ** Copy or symlink the library into it (on MacOS remember naming it `libzint.so`). | ||
+ | ** Run `mtxrun --generate` to update the file database. | ||
<texcode> | <texcode> | ||
Line 25: | Line 29: | ||
== barcode.lua == | == barcode.lua == | ||
− | In 2012, user topskip published a small LuaTeX library on [https://tex.stackexchange.com/questions/50707/how-to-generate-ean-barcodes-with-tikz-or-metapost#50751 Stack Exchange]. It can only create EAN codes. | + | In 2012, user 'topskip' published a small LuaTeX library on [https://tex.stackexchange.com/questions/50707/how-to-generate-ean-barcodes-with-tikz-or-metapost#50751 Stack Exchange]. It can only create EAN codes. |
<texcode> | <texcode> |
Revision as of 19:11, 7 September 2021
< Graphics
How to create barcodes from within ConTeXt (MkIV/LMTX)?
Zint module
- Download
zint
from https://www.zint.org.uk (Windows, Linux) or install it with Homebrew or MacPorts (MacOS). - MkIV: The
zint
executable must be in yourPATH
. - LMTX: LuaMetaTeX uses the library. On Windows, that’s
libzint.dll
, on Linux and MacOSlibzint.so
(on MacOS the actual file name islibzint.dylib
, but LuaMetaTeX expects.so
).- Find that file, it should be in
/usr/local/lib
(Linux, Homebrew) or/opt/local/lib
(MacPorts). - Create the path
$TEXROOT/tex/texmf-$ARCH/bin/lib/luametatex/zint
. - Copy or symlink the library into it (on MacOS remember naming it
libzint.so
). - Run
mtxrun --generate
to update the file database.
- Find that file, it should be in
\usemodule[zint] \barcode[alternative=isbn, text=9783865419026, width=4cm] \barcode[alternative=qr code, text={https://wiki.contextgarden.net}, width=3cm]
Zint can produce about 40 different code types (“alternatives“). Try the name (but lowercase with spaces) or look into the source
Barcodes module
The old module uses PStricks and is deprecated. (Source)
barcode.lua
In 2012, user 'topskip' published a small LuaTeX library on Stack Exchange. It can only create EAN codes.
\loadluafile[barcode] \define[1]\luabarcode{\directlua{generate_barcode_lua("#1")}} \luabarcode{9783865419026}