5

I have babel v3.34 a simple example with beamer which I have added a sans serif font family with \babelfont{sf}[Language=Default]{DejaVu Serif} produce such warnings

Package babel Warning: The following fonts are not babel standard families:

  • \rmfamily / lmr [lmroman10-regular]:+tlig; at 10.95pt
  • \ttfamily / lmtt [lmmono10-regular]: at 10.95pt
    There is nothing intrinsically wrong with it, but 'babel' will no set Script and Language. Consider defining a new family with \babelfont.
\documentclass{beamer}
\usepackage[english]{babel}
\babelfont{sf}[Language=Default]{Deja Vu Serif}

\begin{document}
\begin{frame}{}
Test 
\end{frame}

\end{document}

Why I need to add a roman font family and a teletype font family?

( equivalent MWE with fontspec produce result without any warnings )

@JavierBezos

Salim Bou
  • 17,021
  • 2
  • 31
  • 76
  • I'll rewrite the text to something like: “There is nothing intrinsically wrong with it, and if you do not need these fonts you can ignore this warning altogether. If they are used in the document, 'babel' will no set Script and Language for them, so you may consider defining a new family with \babelfont.” – Javier Bezos Oct 06 '19 at 16:10

2 Answers2

6

The main purpose of \babelfont is to define at once in a multilingual document the fonts required by the different languages, with their corresponding language systems (script and language). So, if you load, say, 4 languages, \babelfont{rm}{FreeSerif} defines 4 fonts (with their variants, of course), which are switched with the language by babel. It's just a tool to make things easier and transparent to the user.

There is no real need to use \babelfont in a monolingual document, if you set the language system in \setmainfont (or not, depending on what you want).

babel assumes (actually, I assume :-)) that if you are using \babelfont for a family, very likely you want to define the rest of them. If you don't, you can find some inconsistencies between families. This checking is done at the beginning of the document, at a point where we cannot know which families will be used.

As the message explains, there is nothing intrinsically wrong with not defining all the families. In fact, there is nothing intrinsically wrong with not using \babelfont at all. But you must be aware that this may lead to some problems. And this is the very reason of the warning.

Javier Bezos
  • 10,003
5

The package babel is informing you that you lack definitions for the serif family and the mono family.

\documentclass{beamer}
\usefonttheme{professionalfonts}
\usepackage[english]{babel}
\babelfont{rm}[Language=Default]{DejaVu Serif}
\babelfont{sf}[Language=Default]{DejaVu Serif}
\babelfont{tt}[Language=Default]{DejaVu Sans Mono}

\begin{document}
\begin{frame}{}
Test
\end{frame}

\end{document}
egreg
  • 1,121,712
  • Thanks for your response but my question is why babel requests \rmfamily and a \ttfamily font? I thought we just need a sans serif font with beamer. With fontspec we add just the sans serif family. – Salim Bou Oct 05 '19 at 14:30
  • @SalimBou Apparently you need to. It should be asked to Javier why. – egreg Oct 05 '19 at 14:37
  • Not at all. On the contrary, the warning makes clear “There is nothing intrinsically wrong with it”. I thought it was enough, but clearly it's not. – Javier Bezos Oct 06 '19 at 16:31
  • @JavierBezos Perhaps just an Info message, rather than a Warning? – egreg Oct 06 '19 at 16:33
  • @egreg But it warns about the fact Script and Language will not be set by babel automatically, which could lead to wrong results. So, it's not just an info, but a real warning. – Javier Bezos Oct 06 '19 at 17:00
  • 1
    Finally, I've created a new “type of warning”: it's printed to the console, because it's relevant, but the message now reads “Info“ instead of “Warning”. – Javier Bezos Jan 02 '20 at 14:24