0

I'm trying use datatool to iterate over a CSV file in order to create an invoice.

This is what I have:

\documentclass[12pt]{letter}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}

\usepackage[a4paper]{geometry}
\usepackage[british]{babel}

\usepackage{datatool}

\usepackage{invoice}

\DTLloaddb{jan}{jan.csv}

\begin{document}

\begin{letter} TEST

    \opening{}

    \begin{invoice}{\euro}{21}
        \ProjectTitle{Rekening January}%
        \DTLforeach*{jan}%
        {%
            \Date=date,%
            \Price=price,%
            \Quantity=quantity%
        }%
        {%
            \Fee{\Date}{\Price}{\Quantity}%
        }%
    \end{invoice}

\end{letter}

\end{document}

When I compile, I get two "undefined control sequence" about the lines

}%
    \end{invoice}

What I'm doing wrong?

  • 1
    Well you don't show your csv so one can't test your code. But don't use \euro (or some other fragile command) in the first argument of invoice. It is fed to a \message and will explode. Use better "EUR" or something like this. – Ulrike Fischer Dec 29 '18 at 15:51
  • Thank you so much! that \euro was indeed the problem! With just euro it works as I wanted. The code was taken from the internet: may I ask why the original author placed so many % here and there? I removed them and the file did not compile anymore. What is the meaning/function of those empty comments (%)? – matteo_gambarutti Dec 29 '18 at 16:01
  • The % suppress the space you would insert by the end-of-line. Datatool doesn't like them. – Ulrike Fischer Dec 29 '18 at 16:03
0

Don't use \euro (or some other fragile command) in the first argument of invoice. It is fed (quite unnecessarly) to a \message and will explode. Use better "EUR" or something like this.

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.