I'm trying to use \psbarcode
in a manner that it will take a premade variable to render the barcode. MWE that fails is below,
\documentclass{minimal}
\usepackage{auto-pst-pdf}
\usepackage{pst-barcode}
\newcommand*{\tozip}[1]{0123456789}
\begin{document}
\begin{pspicture}\psbarcode{\tozip}{}{postnet}\end{pspicture}
\end{document}
If I replace \tozip
with actual numbers it works... Anyone have an idea that will work with my \newcommand
?
I guess my example was a bit too minimal... I'm actually using scrlttr2
and KOMA variables. This MWE above works once the edits are made (thx!) but the actual example does not. Any ideas about this related example?
\documentclass[letterpaper]{scrlttr2}
\usepackage[english]{babel}
\usepackage{auto-pst-pdf}
\usepackage{pst-barcode}
\newkomavar[to_zip]{tozip}
\setkomavar{tozip}[ToZip]{02115}
\begin{document}
\begin{letter}{%
\begin{pspicture}
\expandafter\psbarcode\expandafter{\usekomavar{tozip}}{}{postnet}
\end{pspicture}
}
\opening{Dear Users,}
Than you in advance for helping fix this problem!
\end{letter}
\end{document}