I am trying to compile latex code that imports CSV into a longtable (ltxtable). The code has been compiled successfully in windows while it makes error in Mac OS X.



%% Read CSV conents

%% Write CSV into LaTex file (ltxtable)
\begin{longtable}{>{\bfseries}l X}
\abbr& \desc%

%% Include the LaTex file (ltxtable) 



Runaway argument?
\@nil \let \@dtl@line =\@dtl@trmstr \ifx \@dtl@line \@longempty \else \ETC.
! File ended while scanning use of \@dtl@trim.

The CSV file has two columns like:

%% Abbreviations List   
FHSS,Frequency Hopping Spread Spectrum
CRLB,"Cram\'{e}r-Rao Lower Bound"
  • 1
    It is possible that the two computers have different versions of datatool or some other relevant package. You can test this by putting \listfiles in the preamble and comparing the end of the .log for each computer (the command prints the versions of each loaded package). Barring that, unless you get lucky, someone is going to ask for a complete, but minimal example file that demonstrates the problem. Search for 'MWE' if you aren't sure what I'm referring to. – jon Sep 26 '12 at 19:51
  • Thanks jon, I do not have acces to the Windows machine to compare package versions. I will include the MWE now. I figured out that if I change the CSV into a short simple file it works, but not on the actual one. So I go to investigate the problem by working on the CSV file. – Aydin Sep 26 '12 at 20:18
  • I am getting the same error message when processing a CSV that has a LaTeX macro in the last column. Seems \DTLforeach gets confused if the column entry doesn't quite fit what is expected; maybe the subsequent newline is gobbled? In my case I worked around this by adding a bogus final column to the CSV, so the line ends with a column separator. – Arend Jan 22 '13 at 23:25

This may be OS-dependent and related to LaTeX baffled by BOM - Unicode's byte order mark.

Removing the "header" %% Abbreviations List seems to solve the problem.

  • Thanks alot Werner, it solved the problem. But it was working on the previous machine with that header! – Aydin Sep 26 '12 at 20:30
  • I have no problem with the comments (Mac OS X). I suspect something wrong with the Byte Order Mark (BOM) mark that Notepad on Windows is always writing at the beginning (and that's invisible when looking at the file). Removing the first line on the Mac OS X side probably removed also the BOM. – egreg Sep 26 '12 at 20:32
  • 1
    @egreg: Could be. I created (from a copy-and-paste) abbreviations.csv on ScribTeX and it reproduced the error. Removing the comment also removed the error. – Werner Sep 26 '12 at 20:37
  • I got a similar error with a comment line starting with % in a csv file when used by datatool. On removing the % the problem disappeared. – Faheem Mitha Jan 6 '14 at 22:17

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.