5

I am having trouble compiling a latex document using an external CSV file with datatool and using the french language from the babel package.

The content of my latex file is:

\documentclass[letterpaper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[francais]{babel}
\usepackage{longtable}
\usepackage{datatool}

\begin{document}

\DTLsetseparator{;}
\DTLloaddb{tableBesoins}{babel_datatool_conflict.csv}
\begin{longtable}{| p{0.9in} | p{0.6in} | p{1.6in} | p{1.2in} | p{1.6in} | }
   \caption{Besoins\label{tbl:besoins}}\\
   Besoin & Priorité & Préoccupations & Solution actuelle & Solution proposée%
   \DTLforeach{tableBesoins}{%
   \besoin=Besoin,\priority=Priorite,\preoccupation=Preoccupations,%
   \currentsolution=Solution actuelle,\newsolution=Solution proposee}{%
   \\
   \besoin & \priority & \preoccupation & \currentsolution & \newsolution}
\end{longtable}

\end{document}

The content of babel_datatool_conflict.csv file is there:

http://pastebin.com/6nv6v9SH

The error I am getting is:

(/usr/share/texmf-texlive/tex/generic/babel/frenchb.cfg)))
(/usr/share/texmf-texlive/tex/latex/carlisle/scalefnt.sty)
(./babel_datatool_conflict.aux)
(/usr/share/texmf-texlive/tex/latex/ucs/ucsencs.def)
! Use of \@dtl@lopoff doesn't match its definition.
\@dtl@lin@ ->;
              "Besoin";"Priorite";"Preoccupations";"Solution actuelle";"Solu...
l.13 ...tableBesoins}{babel_datatool_conflict.csv}

! Missing $ inserted.
<inserted text> 
                $
l.13 ...tableBesoins}{babel_datatool_conflict.csv}

! Undefined control sequence.

I've uploaded the full error here:

http://pastebin.com/uZEANpd4

I've tried to change [francais] to [french] or [frenchb], to use [utf8] instead of [utf8x], changed the order of the packages. It just won't compile unless I comment out the usepackage babel line.

David Carlisle
  • 757,742
David
  • 213

1 Answers1

9

When using the babel package with the french option, semicolons (and colons, exclamation marks and question marks) are made active so the spacing around these punctuation symbols can be corrected for the French style of putting space before and after the symbol:

"Normal" spacing:

French spacing:

If you use the semicolon as the field separator in your data file, you'll have to make semicolons inactive temporarily by saying \shorthandoff{;} before your \DTLloaddb command, and afterwards make them active again using \shorthandon{;}.

Jake
  • 232,450
  • 2
    Btw, when you recieve a review for a scientific article, you always recognize that a French person wrote it, by having the spaces everywhere ;) – yo' Dec 20 '12 at 08:20
  • Perfect answer. – David Dec 20 '12 at 09:18
  • tohecz : interesting comment ;-) – David Dec 20 '12 at 09:18
  • I wonder why bracketing the offending part with \begin{otherlanguage}{english} and \end{otherlanguage} doesn't work (english given as a babel option). Shouldn't it have the same effect? – AlexG Dec 21 '12 at 08:05