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.

3
  • 1
    The ; is made active by babel with the french option. If you set \shorthandoff{;}, your code should compile.
    – Jake
    Commented Dec 20, 2012 at 7:27
  • Wow, problem solved! That's a quick answer!
    – David
    Commented Dec 20, 2012 at 7:30
  • What are those shorthand codes exactly?
    – David
    Commented Dec 20, 2012 at 7:31

1 Answer 1

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{;}.

4
  • 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'
    Commented Dec 20, 2012 at 8:20
  • Perfect answer.
    – David
    Commented Dec 20, 2012 at 9:18
  • tohecz : interesting comment ;-)
    – David
    Commented Dec 20, 2012 at 9: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
    Commented Dec 21, 2012 at 8:05

You must log in to answer this question.

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