1

I have my document with Russian text. Formerly, it was stored as UTF-8 without BOM and compiled with LaTeX. All worked fine with the following preamble:

\documentclass[11pt,a4paper,final]{moderncv}

\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}

\renewcommand{\rmdefault}{cmr} % Шрифт с засечками
\renewcommand{\sfdefault}{cmss} % Шрифт без засечек
\renewcommand{\ttdefault}{cmtt} % Моноширинный шрифт

But some utilities were not able to identify UTF-8 because of BOM absence, so I added it. From now on LaTeX was unable to compile the document, because of BOM. I switched to XeTeX and replaced preamble:

\documentclass[11pt,a4paper,final]{moderncv}

% Resolving "Failed to convert input string to UTF16" error. See http://tex.stackexchange.com/q/66722/24133
\usepackage[unicode,pdfencoding=auto]{hyperref}

\usepackage{polyglossia}   %% загружает пакет многоязыковой вёрстки
\setdefaultlanguage[spelling=modern]{russian}  %% устанавливает главный язык документа
\setotherlanguage{english} %% объявляет второй язык документа

\setmainfont{CMU Serif}           %% задаёт основной шрифт документа
\setsansfont{CMU Sans Serif}      %% задаёт шрифт без засечек
\setmonofont{CMU Typewriter Text} %% задаёт моноширинный шрифт

%\renewcommand{\rmdefault}{cmr} % Шрифт с засечками
%\renewcommand{\sfdefault}{cmss} % Шрифт без засечек
%\renewcommand{\ttdefault}{cmtt} % Моноширинный шрифт

But in this case I got several problems:

  1. Fonts are slightly different
  2. Italic is missing!
  3. Quotes << & >> are not parsed

See image before and after: before after

How to resolve these issues? I suppose that if I can tell XeTeX to use the same non-unicode fonts as LaTeX, it will help.

Please, advice on all the issues, since I need them all to be fixed.

PS I'm using MiKTeX 2.9 (x64) under Windows 7 (x64).

Update Example for LaTeX, where everything is fine:

\documentclass[11pt,a4paper,final]{moderncv}

\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}

\renewcommand{\rmdefault}{cmr}
\renewcommand{\sfdefault}{cmss}
\renewcommand{\ttdefault}{cmtt}

\moderncvstyle{classic}
\moderncvcolor{green}
\name{Михаил \vspace{0.5ex} \\}{Матросов}

\begin{document}

\section{Свои проекты и вклады}

\cvitem{2014}{
    \httplink[\textbf{C++ User Group, Russia}]{meetingcpp.ru}, \emph{Докладчик} \newline{} 
    Доклад \httplink[<<С++ без new и delete>>]{meetingcpp.ru/?p=250}.
}

\end{document}

And example for XeTeX, with the mentioned issues (document body hasn't changed):

\documentclass[11pt,a4paper,final]{moderncv}

% Resolving "Failed to convert input string to UTF16" error. See http://tex.stackexchange.com/q/66722/24133
\usepackage[unicode,pdfencoding=auto]{hyperref}

\usepackage{polyglossia}
\setdefaultlanguage[spelling=modern]{russian}
\setotherlanguage{english}

\setmainfont{CMU Serif}  
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}

\moderncvstyle{classic}
\moderncvcolor{green}
\name{Михаил \vspace{0.5ex} \\}{Матросов}

\begin{document}

\section{Свои проекты и вклады}

\cvitem{2014}{
    \httplink[\textbf{C++ User Group, Russia}]{meetingcpp.ru}, \emph{Докладчик} \newline{} 
    Доклад \httplink[<<С++ без new и delete>>]{meetingcpp.ru/?p=250}.
}

\end{document}
  • 1
    As far as I know, using a BOM for UTF-8 shouldn't be necessary: "Use of a BOM is neither required nor recommended for UTF-8, but may be encountered in contexts where UTF-8 data is converted from other encoding forms that use a BOM or where the BOM is used as a UTF-8 signature" (From the Unicode Standard 5.0) – egreg Oct 29 '14 at 12:42
  • @egreg But it the only way I know to make KDiff3 and SmartGit understand UTF-8-encoded files :( – Mikhail Oct 29 '14 at 12:50
  • Please post a minimal working example (MWE). – Sverre Oct 29 '14 at 13:08
  • @Sverre Please, see updated question. – Mikhail Oct 29 '14 at 13:38
1

This is not an answer, but a comment can't contain an MWE and pictures

It would be helpful if you did some more work in diagnosing where the problem occurs. Simplifying your example and compiling the code with XeLaTeX gives no issues for me.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{CMU Serif}  
\begin{document}
\section{Свои проекты и вклады}
\emph{Докладчик}Доклад <<С++ без new и delete>>.
\end{document}

enter image description here

  • I have different result with the same issues and the following errors: 1) Package babel Error: You haven't loaded the option russian yet. \select@language {russian} 2) Font shape 'EU1/CMUSerif(0)/m/it' undefined(Font) using 'EU1/CMUSerif(0)/m/n' instead 3) Some font shapes were not available, defaults substituted. – Mikhail Oct 29 '14 at 14:14
  • @Mikhail You get this error when compiling my MWE? I don't understand why that should happen when there's nothing in this document that mentions the option russian for babel. Try deleting your auxiliary files before compiling again. – Sverre Oct 29 '14 at 14:27
  • Deleted .aux file, error 1) is now gone, but result is the same. – Mikhail Oct 29 '14 at 15:09
  • @Mikhail As indicated in my answer, please do some work in diagnosing where the problems occur, and edit your original question, and post a minimal example. This doesn't seem to have anything to do with moderncv, polyglossia, etc. – Sverre Oct 29 '14 at 15:24
  • Currently I decided to switch back to LaTeX without BOM. Shame on me. Tanks for your help! – Mikhail Oct 29 '14 at 15:27

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.