# Incompatibility between babel-french and tasks

There seems to be an incompatibility between these two packages.

Look at these two MWE:

# The right one

\documentclass{article}
%\usepackage[french]{babel}
\begin{document}

\end{document}


# The wrong one

\documentclass{article}
\usepackage[french]{babel}
\begin{document}

\end{document}


• This post is to report this incompatibility

• Does someone have an nice idea on how to solve this issue?

I wouldn't call this "solving", but you can use etoolbox's \AtBeginEnvironment hook to deactivate the ! inside the tasks environment:

\documentclass{article}
\usepackage[french]{babel}

\usepackage{etoolbox}
\AtBeginEnvironment{tasks}{\catcode\!12}

\begin{document}

\end{document}


If you want to keep the active ! then you can use a more brute-force approach and change the character used to denote a full-line task. For instance with +:

\documentclass{article}
\usepackage[french]{babel}

\ExplSyntaxOn
{
\peek_meaning_remove:NTF + % <-- Character to activate a full-line task
{
}
{
\peek_meaning_remove:NTF *
{
}
}
}
\ExplSyntaxOff

\begin{document}

\end{document}


After some digging:

jfbu suggested using \expandafter\task\string! or defining a \taskexclam to be \task <the character !>.

These don't work because tasks uses \task as a dummy control sequence to split the collected contents of the environment. So internally this:

\begin{tasks}(3)


is transformed into the list:

{ aaa \expandafter }
{ \string! fff }
{ eee }


which makes the \expandafter trick useless and the \string! will simply write a !. The \taskexclam is also executed too late, so it has no effect.

An approach that obeys tasks' rules and preserves the meaning of ! in french is copying the character definition of ! before loading babel then using the new name:

\documentclass{article}

\let\exclam=!

\usepackage[french]{babel}

\begin{document}

\end{document}

• unfortunately tasks seems to be gathering its contents because \expandafter\task\string! fails... – user4686 Oct 13 '18 at 15:43
• and for same reason it seems impossible to use \taskexclam in place of \task! with \taskexclam defined to expand to \task <catcode twelve !>. So task package makes it hard to work around that problem if not using your approach which however has the problem that ! in items will not be correctly typeset for French. – user4686 Oct 13 '18 at 15:48
• @jfbu Good point... Indeed, tasks uses environ's \NewEnviron to collect the contents of the environment. It then uses \peek_meaning_remove:NTF to check for the !. One would have to trick this test to get it working with the active !... – Phelype Oleinik Oct 13 '18 at 15:57
• maybe OP should send a Feature Request to tasks for either allow active ! or allow to specify another character for that job... or allow some \taskfullwidth in place of \task!. – user4686 Oct 13 '18 at 16:06
• @jfbu Searching a bit further in the code of tasks I found out that \taskexclam and \expandafter\task\string! don't work because the package uses \task not as a command, like \item but as a separator for \seq_set_split:Nnn, so \taskexclam gets executed only at the proper typesetting stage, and belongs to the previous item, and \expandafter\task\string! puts the \expandafter in a separate item than \string!. Using \let\exclam=! before loading babel and using \task\exclam` seems like a better approach, though. – Phelype Oleinik Oct 13 '18 at 17:19