Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to produce a document with non-serif type. I also want to include Cyrillic characters. These two aims seem to be mutually exclusive. When I comment out \usepackage[T2A]{fontenc}, the document is beautiful, except that the Cyrillic characters won't print. When I include \usepackage[T2A]{fontenc}, the document is beautiful, but it is entirely a serif font.

Below is a MWE. Some of the preamble might seem a little bit goofy, but it's all included in my university's template (see link below). It will actually compile, but only with some encouragement (see http://helpdesk.ufl.edu/wp-content/uploads/2012/12/latex_spring_2011.zip).

From what I've read, I think I need to load a different font family. But I'm not sure if that's right, or even how to do it.

How do I have a document that both includes Cyrillic characters and retains its sans serif font?

\documentclass{article}
\renewcommand{\rmdefault}{ma1}
\renewcommand{\sfdefault}{phv}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{datetime}
\usepackage{qtree}
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tipa}
\usepackage{pgfplots}
\usepackage[authoryear]{natbib}
\usepackage{hypernat}
\usepackage[dvipdfm,hyperfootnotes=false]{hyperref}
\hypersetup{colorlinks=true,linkcolor=blue,anchorcolor=blue,citecolor=blue,filecolor=blue,urlcolor=blue,bookmarksnumbered=true,pdfview=FitB} \usepackage{gb4e}
\noautomath
\let\eachwordone=\sffamily
\let\eachwordtwo=\sffamily
\let\eachwordthree=\sffamily

\begin{document}

Todd is a cat. у меня есть машина. я очень харашо.

\end{document}
share|improve this question
4  
The log file tells you: LaTeX Font Warning: Font shape T2A/phv/m/n' undefined using T2A/cmr/m/n' instead .... This means that helvet (phv) has no cyrillic chars. You need to find a suitable sans serif, e.g. you could remove the \renewcommand\sfdefault ...-line –  Ulrike Fischer Apr 4 '13 at 7:33

2 Answers 2

up vote 13 down vote accepted

TeX fonts have only 256 slots. And you can't mix encodings without telling LaTeX to do it; \textcyrillic defined by babel with the russian option does this. The last specified encoding becomes the default one.


This should be a complete list of sans serif fonts available also in T2A encoding (for cyrillic):

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

\usepackage[russian,english]{babel}

\renewcommand{\familydefault}{\sfdefault}


\begin{document}

\renewcommand{\sfdefault}{PTSans-TLF}\normalfont
\section{PTSans}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}


\renewcommand{\sfdefault}{fds}\normalfont
\section{Droid}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}


\renewcommand{\sfdefault}{fco}\normalfont
\section{Comforta}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}


\renewcommand{\sfdefault}{fca}\normalfont
\section{Cantarell}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}


\renewcommand{\sfdefault}{iwona}\normalfont
\section{Iwona}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}


\renewcommand{\sfdefault}{fos}\normalfont
\section{OpenSans}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}

\end{document}

Of course the declarations should be given in the preamble, this is just to show the specimens.

enter image description here

With the following example, I show the result of having Helvetica (Arial is similar) for Latin text and one of the previous fonts for Russian text in cyrillic. Take your pick and define \sfcyrillic to the chosen family.

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

\usepackage[russian,english]{babel}

\renewcommand{\sfdefault}{phv}
\renewcommand{\familydefault}{\sfdefault}

\newcommand{\sfcyrillic}{} %%% Add here your preference
\usepackage{xpatch}
\xpatchcmd{\Russian}
  {\selectfont}
  {\fontfamily{\sfcyrillic}\selectfont}
  {}{}
\xshowcmd\Russian


\begin{document}

\renewcommand{\sfcyrillic}{PTSans-TLF}\normalfont
\section{PTSans}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}


\renewcommand{\sfcyrillic}{fds}\normalfont
\section{Droid}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}


\renewcommand{\sfcyrillic}{fco}\normalfont
\section{Comforta}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}


\renewcommand{\sfcyrillic}{fca}\normalfont
\section{Cantarell}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}


\renewcommand{\sfcyrillic}{iwona}\normalfont
\section{Iwona}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}


\renewcommand{\sfcyrillic}{fos}\normalfont
\section{OpenSans}

Todd is a cat. \textcyrillic{у меня есть машина. я очень харашо.}

\end{document}

enter image description here

share|improve this answer
    
With the current babel (2014/03/29, TL2013 more or less up to date), it seems that the patch should be applied to \cyrillictext not \Russian. –  jfbu Mar 29 at 8:10
    
@jfbu Yes, some changes have been made to babel-russian. But not to the modules for other languages using the Cyrillic alphabet. –  egreg Mar 29 at 9:14

To complement egreg's more accurate answer for latex, you might want to look into xelatex, which supports every package from latex that I have ever tried (and more!). You would just need to change your typesetting engine.

Here is the code to achieve what you want with the fewest lines possible.

Loading a new font family is easy:

\setmainfont{nameofsystemfont}

I chose (reluctantly) Arial for this example, but any font that contains both cyrillic characters and latin characters will suffice.

UPDATED CODE TO INCLUDE POLYGLOSSIA AS PER EGREG'S COMMENT

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{polyglossia} %% added for proper hyphening
\setmainfont{Arial}
\begin{document}

Todd is a cat. у меня есть машина. я очень харашо.

\end{document}

Sans Serif Cyrillic Typeset

Also check out What fonts can I use for writing in Cyrillic in LaTeX

share|improve this answer
2  
It should be noted that if you don't load Polyglossia and don't properly mark the Russian text, it won't be hyphenated. This might even be what's wanted, in case the Russian text is always short, but in general it can lead to poorly typeset paragraphs. –  egreg Apr 4 '13 at 11:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.