Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

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

1 Answer 1

up vote 8 down vote accepted

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

share|improve this answer
    
Btw, when you recieve a review for a scientific article, you always recognize that a French person wrote it, by having the spaces everywhere ;) –  tohecz Dec 20 '12 at 8:20
    
Perfect answer. –  David Dec 20 '12 at 9:18
    
tohecz : interesting comment ;-) –  David Dec 20 '12 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 Dec 21 '12 at 8:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.