5

I have a document where we have quotes in several languages, including French, thus we load several languages via babel. However, even if French is not the active language, it still affects the caption setup if the caption package is loaded.

MWE:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[french,english]{babel}
\usepackage{caption}
\begin{document}
\begin{figure}
\centering
fsdf
\caption{d}
\end{figure}
\end{document}

Output, notice the -- instead of the expected colon separator.

enter image description here

Who is to blame here? babel or caption? (so I can send a bug report)

(BTW: same result on TeXLIve 2017 frozen and TeXLive 2018)

5
  • 1
    babel. But it seems intended: "In French, captions in figures and tables should never be printed as ‘Figure 1: ’ which is the default in standard LaTeX2e classes (a space should always preceed a colon in French), anyway ‘Figure 1 – ’ is preferred." – gusbrs May 14 '18 at 10:43
  • 3
    The documentation of babel-french says, at the end of section 1.2.3, “When French is not the main language, the colon is preserved for all languages including French”. Bug. – egreg May 14 '18 at 10:43
  • It can be redefined with \renewcommand*{\CaptionSeparator}{...} according to babel-french. – gusbrs May 14 '18 at 10:44
  • 1
    Oh, well, it's mixed responsibility with caption: if I remove \usepackage{caption}, the colon appears. – egreg May 14 '18 at 10:46
  • @egreg is correct, of course. I paid no attention to the default language in my comments. – gusbrs May 14 '18 at 10:46
8

The culprit is caption; in caption3.sty we find

\caption@ifundefined\FB@makecaption{}{%
  \caption@CheckCommand\@makecaption{%
    % frenchb.ldf [2005/02/06 v1.6g French support from the babel system]
    % frenchb.ldf [2007/10/05 v2.0e French support from the babel system]
    \long\def\@makecaption#1#2{%
      \vskip\abovecaptionskip
      \sbox\@tempboxa{#1\CaptionSeparator #2}%
      \ifdim \wd\@tempboxa >\hsize
        #1\CaptionSeparator #2\par
      \else
        \global \@minipagefalse
        \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
      \fi
      \vskip\belowcaptionskip}}
  \ifx\@makecaption\STD@makecaption
    \DeclareCaptionLabelSeparator{default}{\CaptionSeparator}
    \def\caption@frenchb{% supress frenchb warning
      \let\STD@makecaption\@makecaption
      \let\FB@makecaption\@makecaption}
  \else
    \ifx\@makecaption\@undefined\else
      \caption@InfoNoLine{%
        The definition of \protect\@makecaption\space
        has been changed,\MessageBreak
        frenchb will NOT customize it}%
    \fi
  \fi
}

which effectively reverses the claim made in the documentation for babel-french (section 1.2.3) that

When French is not the main language, the colon is preserved for all languages including French [...].

Indeed, if I try changing \CaptionSeparator without loading caption, the colon is used nonetheless. On the other hand, the change is honored when caption is loaded even if french is not the main language.

Temporary solution:

\renewcommand{\CaptionSeparator}{: }
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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