# acmart + [french]babel = confusing warning about caption

When processing

\documentclass{acmart}
\usepackage[french,american]{babel}
\begin{document}
Some text.
\end{document}


pdflatex spits out the following warning:

Package frenchb.ldf Warning: Please load the "caption" package
(frenchb.ldf)                AFTER babel/frenchb; reported on input line 909.


First, this is not a warning. A warning would say what could go wrong. Nothing of the kind is seen here. What we see is a polite order. Second, this order is not easily implementable: caption is loaded in acmart, and \RequirePackage[french,american]{babel} before \documentclass won't compile. Third, there is no package frenchb.ldf in the above code; there is the package babel.

Of course, all these issues might seem to be too trivial to experts to even bother replying. But "silly users" might get really confused. I guess, the three packages (babel, caption, acmart) should jive better with each other. Since the maintainters of all the three packages are likely to read here, I kindly ask them whether a good solution to this problem could be made available. Cf. bug report for acmart.

• An unclear message would be Sorry, Pandora. (You sneaky devil.) or Pretend that you’re Hercule Poirot: Examine all clues, but your warning is pretty clear. If or if not you like the warning is another topic ... – samcarter_is_at_topanswers.xyz Aug 11 '17 at 17:32
• Reading the docu of the packages you use should be the most natural thing to do! – samcarter_is_at_topanswers.xyz Aug 11 '17 at 17:37
• Sorry but stop to be silly. You make the impression that it is too difficult for you to imagine that a class acmart like loads the caption package. Even if you don't want to look in the docu: a simple glance in the log would tell you this. Beside this: specialized classes like this are often not meant to be extended by more packages. They have been written with a clear, restricted goal in mind and if "use with french" is not in this goal, you shouldn't use them with french. – Ulrike Fischer Aug 11 '17 at 18:53
• @LeonMeier No, I have not read all the documentation of all the packages. I'm not David Carlisle, after all. But I've checked the doku of a package before asking simple questions about it. And, knowing that classes can and do load packages, I don't see why the message appears incomprehensible to you. And if you asked something like "How to load a package before a class loads other packages to prevent a warning on caption+babel", it would be completely reasonable and would have shown a certain level of research. – yo' Aug 11 '17 at 19:37
• I wouldn't load the full french with such a class unless the docu explicitly say one should. I would use the base option of babel instead. – Ulrike Fischer Aug 11 '17 at 19:40

You can avoid the warning, if you use scrlfile to load babel after one of the packages, that is loaded before babel, e.g., fontenc:

\RequirePackage{scrlfile}
\AfterPackage!{fontenc}{\RequirePackage[french,american]{babel}}
\documentclass{acmart}
\begin{document}
Some text.
\end{document}


Here I use \AfterPackage! because it executes the \RequirePackage in the argument after finishing the load context of fontenc.

The warning is innocuous (albeit annoying). To be on the safe side, add the proper incantations for the French language so switching to it will not influence the layout in any way.

\documentclass{acmart}
\usepackage[french,american]{babel}
\frenchsetup{StandardLayout,CustomiseFigTabCaptions=false}

\begin{document}
Some text.

\begin{figure}[htp]
Whatever

\caption{A caption}
\end{figure}

\selectlanguage{french}

\begin{figure}[htp]
Whatever

\caption{A caption}
\end{figure}

\end{document}


You can also silence the warning:

\documentclass{acmart}

%% silence the annoying warning
\usepackage{silence}
%%

\usepackage[french,american]{babel}
\frenchsetup{StandardLayout,CustomiseFigTabCaptions=false}

\begin{document}
Some text.

\begin{figure}[htp]
Whatever

\caption{A caption}
\end{figure}

\selectlanguage{french}

\begin{figure}[htp]
Whatever

\caption{A caption}
\end{figure}

\end{document}


In my opinion, the class might do something better in order to avoid the annoying warning, but that's not really so easy.

• @Leon Meier You can either replace \frenchsetup by \frenchbsetup or update to the latest version of babel-french (3.3b). – Daniel Flipo Aug 15 '17 at 17:15
• @egreg \frenchsetup{StandardLayout,CustomiseFigTabCaptions=false} is useless as long as French is not the main language (american here). The warning can also be suppressed by \frenchsetup{SuppressWarning}. – Daniel Flipo Aug 15 '17 at 18:26
• @DanielFlipo Nice to know about how to suppress the warning. – egreg Aug 15 '17 at 19:28
• I confirm that the warning about captions is irrelevant for the acmart class. This warning is meant for users who load caption.sty by themselves. BTW, the command \frenchbsetup{SuppressWarning} I mentioned before, is inefficient here, sorry, it occurs too late :-) I'll try to improve the situation for the next release of babel-french. – Daniel Flipo Aug 16 '17 at 7:49
• I don't see the warning about OT1 encoding with your test file: the acmart class seems to use LinuxLibertine (in T1 encoding), so it is fine for French. If you choose other fonts, you have to use fonts in T1 fontencoding if you expect proper hyphenation of French words with accentuated letters. – Daniel Flipo Aug 16 '17 at 7:51