3

I am making a sheet of ISBN barcodes like this:

\documentclass{article}

\usepackage{GS1}
\usepackage{textmerg}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.dat}
  0201134489
  978-0201529838
  978-3-319-23796-1
  978-0321173850
  9781847199867
  978-0201362992
\end{filecontents*}

\usepackage[newdimens]{labels}
\LabelCols=3
\LabelRows=5

\LabelGridtrue % show grid for labels

\begin{document}

\Fields{\isbn}

\Merge{\jobname.dat}{%
  \addresslabel{
    \EANBarcode{ISBN \isbn}
  }%
}%

\end{document}

Unfortunately, the barcodes are all zeros instead of ISBN numbers:

Barcodes with just zeros

How can I fix this?

0

As Marijn pointed out, the solution is as simple as \expandafter\EANBarcode\expandafter{\isbn} instead of \EANBarcode{ISBN \isbn}. I tried this before posting but forgot to remove the "ISBN" filler from the GS1 documentation, so got an error and thought it hadn't fixed the problem. Here is the full working example for completeness:

\documentclass{article}

\usepackage{GS1}
\usepackage{textmerg}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.dat}
  0201134489
  978-0201529838
  978-3-319-23796-1
  978-0321173850
  9781847199867
  978-0201362992
\end{filecontents*}

\usepackage[newdimens]{labels}
\LabelCols=3
\LabelRows=5

\LabelGridtrue % show grid for labels

\begin{document}

\Fields{\isbn}

\Merge{\jobname.dat}{%
  \addresslabel{
    \expandafter\EANBarcode\expandafter{\isbn}
  }%
}%

\end{document}

ISBN barcodes rendered correctly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.