0
\documentclass[12pt]{leter}
\usepackage[paperwidth=2.25in, paperheight=4in, margin=1mm, textwidth=1.85in]{geometry} % Define paper stock size here
\special{papersize=2in,3.75in}
\usepackage{etoolbox}

\pagenumbering{gobble}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage[code=Code39,X=.275mm,ratio=2.25,H=.5cm]{makebarcode}
\newcommand\finline[3][]{\begin{myfont}[#1]{#2}#3\end{myfont}}
\usepackage{times}

\begin{document}
\newcommand{\PrintOne}[2]
{
  \isblank{#2}{#1}{#2}
}

\pdfpagewidth 2.5in



\vspace{2mm}
{\Large \textbf{bin}}
\hfill
{\Large \textbf{number}}

\vspace{2mm}
\hline
\vspace{2mm}

\centerline{\barcode{number}}

\\

{\Large \centerline{\testbf{ABC-Store}} \par}

\\

{\tiny \centerline {\textbf{DIGITAL OFFICE SOLUTIONS}} \par}}
\vspace{2mm}
\hline
\PrintOne{description}{itemnotes}

\\

\small{description}

\\
Please email -------@----------.com 24 hours a day or Call 204-555-1212 between 8:00am 4:00pm to reorder. Please reference the Bio-Static serial number from the yellow label on your copier.  
\\
\newpage


\end{document}

What it does is print a 2.25x4 label with a bar code, and then I want it to print one of the two variables in the \PrintOne function. for some reason all it does it crash with an error from the calling program. If I take out the \usepackage{etoolbox} and the \PrintOne everything prints. But it prints too much, I only want one of the \PrintOne to print.

  • 1
    leter class? Do you mean letter? Sorry, this document seems to be a mess. There's a stray \hline without tabular environment which breaks the code already –  Jun 03 '15 at 15:15
  • 1
    why are you using geometry but the setting page size with dvips special? – David Carlisle Jun 03 '15 at 15:17
  • If I fix leter to letter the document stops with an error on \hline (which is only valid in tables) but that error seems to be unrelated to the problem you describe. Please fix the example so that it does not have unrelated errors to give people a chance to see the intended problem. – David Carlisle Jun 03 '15 at 15:20
  • \ifblank, not \isblank –  Jun 03 '15 at 15:21
  • By the way, here is a question from you with answers, but you never accepted one of them: http://tex.stackexchange.com/questions/224272/how-do-i-print-out-dates-in-yyyy-mmm-dd-format –  Jun 03 '15 at 15:28

1 Answers1

2

Please no comments on the spacing here (that's not my issue here)

The main errors were

  • leter instead of letter
  • \hline without tabular environment
  • \isblank instead of \ifblank
  • \testbf instead of \textbf
  • Stray } at some places

It compiles now, but I have no idea what the result should be.


\documentclass[12pt]{letter}
\usepackage[paperwidth=2.25in, paperheight=4in, margin=1mm, textwidth=1.85in]{geometry} % Define paper stock size here
%\special{papersize=2in,3.75in}
\usepackage{etoolbox}

\pagenumbering{gobble}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage[code=Code39,X=.275mm,ratio=2.25,H=.5cm]{makebarcode}
\newcommand\finline[3][]{\begin{myfont}[#1]{#2}#3\end{myfont}}
\usepackage{times}

\newcommand{\PrintOne}[2]
{
  \ifblank{#2}{#1}{#2}
}

\begin{document}

\pdfpagewidth 2.5in



\vspace{2mm}
{\Large \textbf{bin}}
\hfill
{\Large \textbf{number}}

\vspace{2mm}
%\hline
\vspace{2mm}

\centerline{\barcode{42}}


{\Large \centerline{\textbf{ABC-Store}} \par}


{\tiny \centerline {\textbf{DIGITAL OFFICE SOLUTIONS}} \par}
\vspace{2mm}
%\hline
\PrintOne{description}{itemnotes}


\small{description}


Please email -------@----------.com 24 hours a day or Call 204-555-1212 between 8:00am 4:00pm to reorder. Please reference the Bio-Static serial number from the yellow label on your copier.  


\end{document}

enter image description here

  • 2
    There are spurious spaces -- I leave them to the OP as an exercise ;-) –  Jun 03 '15 at 15:38
  • Got the barcode label to work!!!! YEA!!!!!!! Question how to I get the \tabular to work? \begin{tabularx}{19cm}{C{5mm} L{2.1cm} L{8.5cm} C{1cm} C{7mm} R{1.5cm} R{1.5cm} } \textbf{#} & \textbf{Number} & \textbf{Notes} & \textbf{Qt'y} & \textbf{Unit} & \textbf{Price} & \textbf{Amount} \ [0.5em] <%foreach number%> <%runningnumber%> & <%number%> & <%description%> & <%qty%> & <%unit%> & <%sellprice%> & <%linetotal%> \ <%end number%> \end{tabularx} Where <%description%> is I would like it to print \PrintOne of the variables itemnotes, and description. – Gregory West Jun 03 '15 at 17:24
  • @GregoryWest: Yes, the answer is always 42 ;-) –  Jun 03 '15 at 17:24
  • @GregoryWest: Your editing your question away from your original post. There was no table in your OP –  Jun 03 '15 at 18:11
  • Both examples are being passed data from the calling program. interestingly enough almost the exact same data-set in both cases. The working example was made simpler because of a glitch with cut/paste. but the two sets of code are almost the same. One prints invoices, one prints barcode labels. – Gregory West Jun 03 '15 at 18:50
  • @Gregory: You should reconsider/reprogram the calling program. There are a lot of issues –  Jun 04 '15 at 10:38
  • Unfortunatly the calling program is not mine. I am trying to fix a report. – Gregory West Jun 04 '15 at 13:03
  • i copied your code into the report, instead of getting "itemnotes" after the line with "Digital Office Solutions" I am getting "itemnotesdescriptionitemnotes" Why would that be happening? Could there be something very off with the version of Latex I am using? – Gregory West Jun 22 '15 at 18:54
  • Unless you don't have a stone age LaTeX (say TeXLive 2009 etc.) I would say: No. My code would compile with TL 2013/2014/2015, I would say ... edit: Just checked with TL 2015: Same result as in the posted screen shot –  Jun 22 '15 at 18:57