0

I am trying to typeset a document with multiple languages, and I need to use a different font for one of the languages because of the lack of boldface for said language in the global font.

I tried to do the following

\documentclass{article}

\usepackage[T2A,T1]{fontenc} \usepackage[utf8]{inputenc}

\usepackage[serbianc,french,english]{babel} \babelfont{rm}{Linguistics Pro} \babelfont[Language=serbian]{tt}{FreeSerif}

\begin{document} \Serbianc{Hello, \texttt\Huge{Поздрав}!} \end{document}

However, i get an "undefined control sequence" error. I have tried to run the example from the babel documentation, Section 1.14, and I still received the same error. I have no idea what is going on.

Is there a way to either load \babelfont, or to do the thing that I need in any other way?

Kolja
  • 125

2 Answers2

3

This works with the last version of babel (2022/02/26 3.73)

\documentclass{article}
\usepackage[serbianc,french,english]{babel}

\babelfont{rm}{Linguistics Pro} \babelfont[serbianc]{tt}{FreeSerif}

\begin{document}

\Serbianc{Hello, \texttt{\Huge Поздрав}!}

\end{document}

Note that \texttt\Huge does nothing at all.

enter image description here

egreg
  • 1,121,712
2

As I had the same issue recently where I was unable to change compiler from pdfLaTeX I did the following for Greek text:

\usepackage[greek,english]{babel}
\usepackage[LGR,T1]{fontenc}

% This is my main font \usepackage{mlmodern}

% Switch back to Computer Modern for Greek \usepackage{substitutefont} \substitutefont{LGR}{\rmdefault}{cmr}

For Serbian you would need to find a T2A compatible font that would let you make it bold and not an OpenType as this won't work with pdfLaTeX.

EDIT

The following MWE produces what you want I think:

\documentclass{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[serbianc,english]{babel}

\usepackage{substitutefont} \substitutefont{T2A}{\ttdefault}{iwona}

\begin{document} \Serbianc{Hello, \texttt{\Huge\textbf{Поздрав!}}} \end{document}

enter image description here

The key lies in using a font supporting T2A encoding (here iwona is used), have a look at this:

What fonts are compatible with T2A (Cyrillic) encoding?

eliasf
  • 141
  • What is \rmdefault? I am trying to apply the same fix to my code, but I have problems. It keeps using T1 for serbian instead of T2A, and I get "command ... unavailable in T1" Also \serbianc is an undefined control sequence, but this is a command from the babel serbianc package. And everything is recompiled in a different font now, serbian is even used where it shouldn't be (outside of serbian chapter). – Kolja Mar 09 '22 at 11:24