0

I am trying to create a Code 128 barcode in a LaTeX document, and want to create it based on one of the fields I am using in the textmerg package,

\code{\MailId}

but am receiving

The input token "\MailId" is not included in Code 128 table, will ignored.

And, true to its word, I get an empty barcode. I can't figure out if I need to “escape” it somehow? Just a line or two before, I use this same field to grab an image by that name, so I know (believe?) it isn’t null.

andselisk
  • 2,675

2 Answers2

0

No matter how much you search, you always find the answer just after posting a question:

\expandafter\code\expandafter{\MailId}

ISBN barcodes using labels and textmerg

  • 2
    If this is the same user as the one asking the question, you may want to merge your accounts. –  Oct 08 '19 at 03:54
0

You can use barracuda, a Lua-Based package:

% !TeX program = LuaLaTeX
\begin{filecontents*}{\jobname.dat}
gigi@mail.com
luca@mailbox.com
geronimo@mailbox.com
\end{filecontents*}

\documentclass{article}
\usepackage{barracuda}
\usepackage{textmerg}
\begin{document}
\Fields{\MailId}
\Merge{\jobname.dat}{\barracuda{code128}{\MailId}}
\end{document}

Remember to compile with lualatex or any other LaTeX format with any of Lua-Based typesetting TeX engine. barracuda does not have dependences and can be used directly with no specific format. Is also possible to save barcode graphics in SVG.

robitex
  • 161
  • 1
  • 5