6

A user of my menukeys package reported, that there’s an issue with the activ characters in french, i.e. !, ;, ? and :. I found out that it’s not a bug in menukeys but catoptions seems to interferre with babel here.

\documentclass{article}

\usepackage[french]{babel}
\RequirePackage{catoptions}

\begin{document}
\begin{itemize}
    \item Test:
    \item Test;
    \item Test?
    \item Test!
\end{itemize}
\end{document}

The above code gives

without catoptions

without catoptions, but

with catoptions

with catoptions.

As you can see the ! and the : seem to lose their activeness. So the question is: How to restore the activeness of ! and :?

7
  • The doc of catoptions says "In fact, the package is meant to be loaded on top of other packages, so as to exploit its catcode preserving scheme". Does changing the package loading order help? Commented Nov 22, 2013 at 15:45
  • 1
    @MartinSchröder Loading catoptions before babel is even worse! For some reasons frenchle is loaded, and many unscrutable errors are raised.
    – egreg
    Commented Nov 22, 2013 at 15:47
  • @MartinSchröder: That’s what I tried first but as egreg said that makes every thing worse that better :-(
    – Tobi
    Commented Nov 22, 2013 at 15:49
  • @Tobi A workaround is to say \AtBeginDocument{\shorthandon{:}\shorthandon{!}} in the preamble, but I don't know whether this has side effects with menukeys.
    – egreg
    Commented Nov 22, 2013 at 15:55
  • 1
    @Tobi The package aims to be "catcode independent", but it outsmarts itself. It does \AtBeginDocument{\cptrestorecatcodes}, but this command doesn't take into account characters possibly activated by Babel. It's a clear bug.
    – egreg
    Commented Nov 22, 2013 at 16:11

2 Answers 2

6

The microtype package with the babel and kerning options fixes this:

\documentclass{article}

\usepackage[french]{babel}
\usepackage[babel, kerning]{microtype}
\RequirePackage{catoptions}

\begin{document}
\begin{itemize}
    \item Test:
    \item Test;
    \item Test?
    \item Test!
\end{itemize}
\end{document}

It also fixes issues with packages such as cleveref and the like. I'm not exactly sure why; maybe someone more knowledgeable can comment.

3
  • I think microtype replaces babel's active character scheme with its font kerning adjustment (as specified in microtype.cfg). That is, microtype hooks into babels language switching mechanism to turn on extra kerning for these characters whenever the language is french. The characters are then never active.
    – Dan
    Commented Nov 22, 2013 at 22:33
  • Well, after all, one can prefer not to use microtype. Hence this answer, though useful, is more a workaround than a definitive solution, isn't it? Commented Nov 23, 2013 at 18:19
  • 1
    The definitive solution would be a bug fix in catoptions but we hav to wait for Ahmed. If you don’t like to use microtype, than the \shorthandon workaround mentioned by egreg should help.
    – Tobi
    Commented Nov 26, 2013 at 14:08
4

One of the aims of catoptions package is to provide normal (i.e., TeX's default) catcodes for programmers. The ‘prevailing’ catcodes (i.e., those in force before catoptions is loaded) are then restored for typesetting at \AtBeginDocument via

\AtBeginDocument{\cptrestorecatcodes}

But babel enforces active catcodes before or after \cptrestorecatcodes is executed, depending on which of the packages (babel or catoptions) is loaded first.

The solution that works without defeating the original intention of catotpions package is the following:

\AtEndOfPackage{\BeforeStartOfDocument{\cptrestorecatcodes}}

I will update catoptions package accordingly.

You must log in to answer this question.

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