3

I'm using datatool package in a LaTeX document. I use it to write labels. I have addresses in a CSV file.

The problem is that I'm unable to write more than 25 labels. It seem like if datatool can't load more that 25 lines from CSV.

Any idea?

This is the .cvs file:

nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov
nome,via,,cap,localita,prov

and this is the code:

\documentclass{letteracdp}
\usepackage[italian]{babel}
%\usepackage{envlab}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{datatool}
\usepackage[usenames]{color}
\usepackage [normalem]{ulem}
\usepackage[utf8x]{inputenc}
\usepackage{textcomp}
\usepackage{tabularx}
\DTLloaddb{indirizzi}{/home/kde/Dropbox/associazione/documenti/ind_sas.csv}
%
\pagestyle{fancy}
\makelabels
%
\begin{document}
\DTLforeach*{indirizzi}{%
\nome=nome,\cognome=cognome,\via=via,\civico=civico,\cap=cap,\localita=localita,\prov=prov,}{
%
\begin{letter}{\emph{\textbf{\nome \space }\\\via\space \\\textbf{\cap},\space \localita\space  \prov}}
%
\end{letter}
}
\end{document}
11
  • 1
    Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post.
    – N.N.
    Commented Aug 25, 2011 at 9:08
  • I'm certain that datatools can read more than 25 entries. Something else is wrong with your code. Commented Aug 25, 2011 at 9:19
  • Could you post a minimal example document and the first 26 lines of your data file?
    – Jake
    Commented Aug 25, 2011 at 11:04
  • yes I can. Can I upload file? Or do I have to make it via private messages?
    – RenatoP
    Commented Aug 25, 2011 at 21:55
  • @user7143: You should edit your question to include the code.
    – Jake
    Commented Aug 26, 2011 at 3:29

1 Answer 1

4

The CSV file is wrong, as it misses the header; moreover you are declaring more fields than are contained in the records. Adding the line

nome,via,civico,cap,localita,prov

as the first in the CSV file and correcting the command into

\DTLforeach*{indirizzi}{%
\nome=nome,\via=via,\civico=civico,\cap=cap,\localita=localita,\prov=prov}{%
\begin{letter}{\emph{\textbf{\nome \space }}\\
  \via\space\civico \\
  \textbf{\cap},\space \localita\space  \prov}
\opening{Dear \nome}
Some text
\closing{Best regards}
\end{letter}
}

the file can be processed regularly. I tried with 49 lines, surely more can be managed.

0

You must log in to answer this question.

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