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?

3
  • 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. Commented Dec 29, 2018 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-g
    Commented Dec 29, 2018 at 16:01
  • The % suppress the space you would insert by the end-of-line. Datatool doesn't like them. Commented Dec 29, 2018 at 16:03

1 Answer 1

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .