2

I have a long text in English with one pages and one more word in Serbian.
Originally, the package used was for typesetting is fourier.
The package works well, except that it is missing fonts for the Serbian language, in particular for Cyrillic.

I found another package, called erewhon which is rather similar and has Cyrillic symbols. However, there are some differences with respect to spacing.

If I only load the fourier package, then the Cyrillic part is bad.
If I only load the erewhon package, then the math formulas are thin and look bad, and there are spacing issues and too much space in new lines (this is barely noticeable, but sums up over the document).

If I load both packages, then the fonts are ok, but there are some spacing issues and too much space in new lines (again barely noticeable, but sums up over the document).

Is it possible to somehow load a package only for one page and one extra word, or to use the font from erewhon only for these two pages and use the package fourier in the rest of the document?

I tried creating two pdfs, one with both packages and one with only fourier. Then I copied the two pages with Cyrillic text into the second document. This is exactly how I want the document to look, however, changing the pdf file broke all the links in the document.

Here's an example.

\documentclass[a4paper,11pt]{book}

\usepackage[utf8]{inputenc}
\usepackage[serbianc, french, italian, main=english]{babel}
\usepackage[T2A]{fontenc} 

\usepackage{lmodern} %used for fixing blurry typewriter font (from the document, not sure if needed)
\usepackage{erewhon}
\usepackage{fourier}


\begin{document}

This page is in English.
\newpage

\begin{otherlanguage}{serbianc}
Ова страница је на Српском. % The spacing here is not important
\end{otherlanguage}
\newpage

This is another page.
The previous pages are in English/\foreignlanguage{serbianc}{Српски}). % The spacing here is not important
\newpage

The document continues in English...
Line one.     % The spacing between line here changes when I \usepackage{erewhon}
Line two.     % With only \usepackage{fourier} the spacing is good
Line three.

\end{document}

So, the above code compiles, and works well, except that spacing is inherited from erewhon, which looks bad and creates huge gaps in the document. Is it possible to fix the spacing issue, or to load the Cyrillic font in a different way which would preserve the fourier spacing?

4
  • 1
    The huge gaps are definitely a bug in serbianc.ldf from babel.
    – egreg
    Sep 23, 2022 at 17:49
  • Can that be fixed? To make things clear, the spacing issues I am referring to is not the spacing before a Serbian word in \begin{otherlanguage}... . I noticed that "\foreignlangage{serbianc}{some text}" has a large space before it. This is not a problem. The spacing issue that I have is the spacing in regular English text which is in the later part of the document. To put it simply, new lines are slightly taller, which sums up over many pages and completely destroys the conception of the document.
    – Kolja
    Sep 23, 2022 at 19:35
  • 1
    fourier scales the font, see e.g. tex.stackexchange.com/a/142736/2388, but you can get a similar effect by scaling erewhon, e.g. \usepackage[scale=0.95]{erewhon}. But beside this, you can select erewhon locally by calling the font family: {\fontfamily{erewhon-TLF}\selectfont Ова страница је на Српском} Sep 24, 2022 at 9:18
  • @UlrikeFischer Scaling completely fixes the problem! Thank you! If you want to submit this fix as an answer I will gladly accept it.
    – Kolja
    Sep 25, 2022 at 21:23

2 Answers 2

2

You can use Erewhon just for Cyrillic with \DeclareFontFamilySubstitution (needs LaTeX after February 2020). You can also load Erewhon at a slightly reduced size, so as to match Fourier.

Also a few spurious spaces in serbianc.ldf have to be fixed. Unfortunately, the only way I found (lest editing the files) is to repair the whole definition of \extrasserbianc. If you don't fix them, you get seven spaces every time you call \foreignlanguage{serbianc}{...}.

The spurious spaces are at the end of lines 305–307, 351–354 and 356–359 of serbianc.ldf. You should report the bug.

Don't forget to also declare the T1 encoding, necessary for French and Italian.

\documentclass[a4paper,11pt]{book}

%\usepackage[utf8]{inputenc}
\usepackage[serbianc, french, italian, main=english]{babel}
\usepackage[T2A,T1]{fontenc}

\usepackage{fourier}

\makeatletter
\providecommand{\erewhon@scale}{0.98116}
\makeatother

\DeclareFontFamilySubstitution{T2A}{\familydefault}{erewhon-TLF}

\makeatletter
\def\extrasserbianc{%
  \cyrillictext
  \languageshorthands{serbianc}%
  \bbl@activate{"}%
  \bbl@frenchspacing
  \bbl@serbiancindent
  \babel@save\@Alph\let\@Alph\srbc@Alph
  \babel@save\@alph\let\@alph\srbc@alph
  \babel@save\enumEng\def\enumEng{\srbc@lettering=\tw@}% <--- was missing
  \babel@save\enumLat\def\enumLat{\srbc@lettering=\@ne}% <--- was missing
  \babel@save\enumCyr\def\enumCyr{\srbc@lettering=\z@}% <--- was missing
  \babel@save{\th}\let\ltx@th\th
    \def\th{\textormath{\ltx@th}{\mathop{\operator@font th}\nolimits}}%
  \babel@save\nzs
  \babel@save\nzd
  \babel@save\NZS
  \babel@save\NZD
  \if@srbc@uni@ode
    \def\nzs{\mathop{\mathrm{нзс}}\nolimits}% <--- was missing
    \def\nzd{\mathop{\mathrm{нзд}}\nolimits}% <--- was missing
    \def\NZS{\mathop{\mathrm{НЗС}}\nolimits}% <--- was missing
    \def\NZD{\mathop{\mathrm{НЗД}}\nolimits}% <--- was missing
  \else
    \def\nzs{\mathop{\textnormal{\cyrn\cyrz\cyrs}}\nolimits}% <--- was missing
    \def\nzd{\mathop{\textnormal{\cyrn\cyrz\cyrd}}\nolimits}% <--- was missing
    \def\NZS{\mathop{\textnormal{\CYRN\CYRZ\CYRS}}\nolimits}% <--- was missing
    \def\NZD{\mathop{\textnormal{\CYRN\CYRZ\CYRD}}\nolimits}% <--- was missing
  \fi
}
\makeatother

\begin{document}

This page is in English.
\newpage

\begin{otherlanguage}{serbianc}
Ова страница је на Српском.
\end{otherlanguage}
\newpage

This is another page.
The previous pages are in English/\foreignlanguage{serbianc}{Српски}).
\newpage

The document continues in English...

\end{document}

enter image description here

With the scaling I propose, the height of a capital C (Latin) in Fourier is 7.12843pt and the height of a capital С (Cyrillic) is 7.12839pt. The difference is negligible. Without the scaling, the height of capital Cyrillic letters is 7.26532pt, and the difference is not negligible.

2
  • I will report the spacing bug, thanks for letting me know. It seems that scaling the font was the main problem, and if scaled accordingly both erewhon and fourier can be equally sized.
    – Kolja
    Sep 25, 2022 at 21:24
  • A spurious spaces are removed in the version 3.2a (2022/09/30) of the 'babel-serbianc' package.
    – Урош
    Oct 2, 2022 at 16:52
1

The fourier package loads Utopia text fonts (scaled at 92%, without Cyrillic) and adds matching maths fonts. The erewhon package loads Utopia text fonts (scaled at 94%, with Cyrillic) but does nothing for maths, you get LatinModern for maths that you consider too thin.

I suggest to switch to LuaTeX instead of pdfTeX and try to compile this file with lualatex:

\documentclass[a4paper,11pt]{book}

\usepackage[serbianc, french, italian, main=english]{babel}

\usepackage{fourier-otf}
%\setsansfont{...}           % Choose a SansSerif font if needed
\setmonofont{lmmono10-regular.otf} % Latin Modern Typewriter font

\begin{document}

This page is in English.
\newpage

\begin{otherlanguage}{serbianc}
  Ова страница је на Српском.
\end{otherlanguage}
\newpage

This is another page.
The previous pages are in English/\foreignlanguage{serbianc}{Српски}). 
\newpage

The document continues in English...
Line one.
Line two.
Line three.
\end{document}

Does it help?

1
  • Indeed scaling was the problem, and rescaling erewhon when loading it fixes the problem. Thanks!
    – Kolja
    Sep 25, 2022 at 21:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .