[tex-live] Commath package + french babel

Robin Fairbairns Robin.Fairbairns at cl.cam.ac.uk
Mon Jun 6 17:54:56 CEST 2011


Gaspard Jankowiak <gasp.janko at gmail.com> wrote:

> I hope this is the right place to 'file' this issue, otherwise please
> tell me where to do that properly.
> 
> Whenever I use the 'commath' and the 'babel' (with [french] option)
> packages, pdflatex seems to enter an infinite loop whenever a colon
> ':' appears in math mode.
> 
> - This happens no matter how I order the 'usepackage' commands.
> - It does not happen with xelatex
> - It is fixed by commenting out the 'Fix alignment of := in mathmode'
>   section in the commath.sty file.
> 
> This might be linked to the way double punctuation is modified by
> babel in french mode (unbreakable thin space ?), but I really don't
> know enough about TeX/LaTex to understand what's going on.
> 
> Any ideas ?

this is a fairly common problem.  babel/frenchb makes various punctuation
characters active in order to insert little spaces between text and
punctuation.

so commath or babel is redefining the other's definition of "active :"
(according to which way round you load them).  looking at the babel
documentation, it looks as if you might be able to solve the problem by
adding the command

  \frenchbsetup{AutoSpacePunctuation=false}

but then, of course, you have to type those little spaces yourself.

> ----------------------------------
> The culprit section in commath.sty:
> 
> % Fix alignment of := in mathmode
> \mathchardef\ordinarycolon\mathcode`\:
> \mathcode`\:=\string"8000
> \begingroup \catcode`\:=\active
>    \gdef:{\mathrel{\mathop\ordinarycolon}}
> \endgroup

the alternative is, as you say, to comment that section out of a local
copy of commath.sty

> Sample .tex which fails to compile with pdflatex. Uncomment the
> xltxtra package to get a successful compilation with xelatex.
> 
> \documentclass{article}
> 
> %\usepackage{xltxtra}
> \usepackage{commath}
> \usepackage[french]{babel}
> 
> \begin{document}
> $:$
> \end{document}

quite why the xelatex patch works, i don't understand.  (i don't use
xetex, and am not really acquainted with its subtleties.)

robin


More information about the tex-live mailing list