3

I have some trouble with the LaTeX babel package. As you may know, depending on the language, say french or english, it is a normal fact that itemize lists are not displayed in the same style (French style is more compact and uses dashes instead of bullets). For instance,

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\begin{document}
Blah. Blah blah!
\begin{itemize}
\item Item;
\item Other item.
\end{itemize}
To be continued\dots
\end{document}

yields

English-style typesetting

while replacing english by french, we would get

French-style typesetting

Fine. But now, suppose that I have loaded both languages for babel, with english loaded last, and that I want to get French typography thanks to the \selectlanguage command, i.e. that I write the following code:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[french,english]{babel}
\begin{document}
\selectlanguage{french}
Blah. Blah blah!
\begin{itemize}
\item Item;
\item Other item.
\end{itemize}
To be continued\dots
\end{document}

Then, I expect to get the same result as just before. But this is not the case actually: though things work fine as regards spacing before exclamation marks and semicolons or after points, the itemize style remains like in English!

Itemize problem

What is the explanation for that fact? (Is it a bug in the babel package?...). And of course, has anyone a nice solution (*) to avoid this nasty behaviour?

(*) Of course, I could make a hack inside my itemize environment to force the French itemize style (resp. the English itemize style after \selectlanguage{english}); but my goal is to get everything okay with the single \selectlanguage{...} command... (Also, I would like to get a solution which is directly portable with any languages).

P.S.: Actually my goal is to write a package allowing for several languages, with slightly different behaviours depending on the language wished by the user. So, I have to load all the possible languages when writing \RequirePackage[...]{babel}, and then use \selectlanguage... But then I have the problem explained above, and this much annoys me! :-(

  • 1
    I think the behaviour you observe is the correct one; it will be more distracting to have different itemize conventions in one document than having a "foreign" itemize convention on pieces of text in another language. – jknappen Apr 1 '16 at 9:36
  • @jknappen: Indeed, this is the explanation given by frenchb.dtx (thanks to jfbu for having pointed out that documentation to me). But actually my motivation was to write a package so that I would select one sole language for all the document, but that language being given as an option of my package. Therefore, I would have to load babel with both options french and english first, and then only to choose the document main language. But babel package does not allow for that: it must be loaded (with selecting the main language) once for all... :-( – Rémi Peyre Apr 1 '16 at 15:12
  • 1
    For this purpose, the answer is simple: Delay the loading of the babel package until you know all the options of your package. Than load the babel package with the options determined from the evaluation of your package's options. – jknappen Apr 1 '16 at 15:51
  • @jknappen: You are right indeed! I mistakenly believed that it was mandatory to put the \RequirePackage commands before processing the package options, because I was relying on a tutorial (tuteurs.ens.fr/logiciels/latex/nouveau_package.html#s3_1) which at some point suggested that it was the case... (Anyway, it is good to know that \selectlanguage{french} command does not set on all the features of the French language! ;-)). – Rémi Peyre Apr 1 '16 at 22:11
4

According to the documentation:

Starting with version 2.2a, frenchb alters the layout of lists, footnotes, and the indentation of first paragraphs of sections) only if French is the “main language” [...] otherwise frenchb doesn’t change anything regarding lists, footnotes, and indentation of paragraphs.

And it also says that if French is the main language, then the layout of lists is modified in all languages.

Global package options (to be set with \frenchbsetup) are provided:

  1. StandardLayout=true forces frenchb, in case French is the main language, not to modify layout of lists.

  2. GlobalLayoutFrench=false has the effect, in case French is the main language, to apply modification to lists only in parts of the document using French.

\frenchbsetup is (as very often the case in LaTeX style with the "premable" idea which is arguably not such a good idea and makes it very difficult to mix distinct documents; also because there is no "undo this loading of package foo" available) a preamble-only command.

I do not see in the documentation commands to toggle customization of lists mid-way in the document, probably some inner commands are available but I did not check. Thus, it seems you should select french as main language (last loaded option for babel), and possibly 2. above depending how you want lists to look in parts of the document in other languages.

  • Wonderful answer; many thanks jbfu! 8-D – Rémi Peyre Apr 1 '16 at 13:22

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.