3

I'm experimenting some issues with the csvloop using the package csvsimple. I need help determining if it's a bug with the package, or something I can fix myself.

The word "long" is showing up in my compiled document when it shouldn't, just because it is written somewhere in the excel document. It should not be written at all!

Here is the code:

\documentclass{article}
%Packages

\usepackage[none]{hyphenat} 
\usepackage[margin=1in,includefoot]{geometry}   
\usepackage{csvsimple}

\begin{document}

\csvloop{file={tryingwithlong.csv}, head to column names, full filter=\ifcsvstrcmp{\csvcolii}{unidentified}{\csvfilterreject}{\csvfilteraccept}, command=\shotgun,
        before reading={\ },
        late after line={{,}\ }, late after last line=\ .} \\ 

\end{document}

this is the excel file this is the compiled pdf

4

Something of this kind has already appeared in csvsimple command csvreader changes national letter å to a, but this is worse!

The head to column names globally (re)defines macros (without notice) from the column names, in this case \fghj, \shotgun and \long.

Unfortunately, \long is a TeX primitive and redefining it will lead to every possible disaster.

Don't use head to column names unless you're 100% sure the names won't conflict with anything already defined. You can refer to the columns with \csvcoli, \csvcolii and so on.

  • interesting feature – David Carlisle May 30 '17 at 14:49
  • @DavidCarlisle Quite. More fun if a column is named box or fi. – egreg May 30 '17 at 14:54
  • end is even more fun. – Alan Munn May 30 '17 at 15:31

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.