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.

Note I'm not actually planning on writing any, for instance, Russian prose or even any Russian words. It's just that, on paper, I've always had the habit of denoting sets by uppercase roman letters, sets of sets by script letters and, when the need arises, sets of sets of sets by uppercase Cyrillic letters. Is there some package I can load which will allow me to typeset (in LaTeX math mode) Cyrillic letters much as I would typeset Greek letters? ie. $\Zhe$ to produce an uppercase zhe. Thanks!

share|improve this question
    
I don't know if a package exists, you could look in the symbol list perhaps it mentions one. But it shouldn't be very difficult to define a \mathcyr command or to add a symbol font and define various command. Which cyrillic font do you want to use? Can you make a small test document which uses this font in normal text? –  Ulrike Fischer Mar 31 '11 at 7:57

2 Answers 2

up vote 8 down vote accepted

If you use only a few cyrillic letters and only in text size, the simplest way is to say

\usepackage[T2A,T1]{fontenc}
\newcommand{\Zhe}{\mbox{\usefont{T2A}{\rmdefault}{m}{n}\CYRZH}}

If you need them also in subscripts or superscripts, it's possible to use \mathchoice for getting them:

\usepackage[T2A,T1]{fontenc}
\makeatletter
\def\easycyrsymbol#1{\mathord{\mathchoice
  {\mbox{\fontsize\tf@size\z@\usefont{T2A}{\rmdefault}{m}{n}#1}}
  {\mbox{\fontsize\tf@size\z@\usefont{T2A}{\rmdefault}{m}{n}#1}}
  {\mbox{\fontsize\sf@size\z@\usefont{T2A}{\rmdefault}{m}{n}#1}}
  {\mbox{\fontsize\ssf@size\z@\usefont{T2A}{\rmdefault}{m}{n}#1}}
}}
\makeatother
\newcommand{\Ze}{\easycyrsymbol{\CYRZ}}

This makes available \Ze at all sizes.

The names to use are easy: just add \cyr or \CYR in front of the letter's English transliteration. For instance, the lowercase "shcha" is \cyrshch, the uppercase is \CYRSHCH. This is called the character's LICR (LaTeX internal character representation).

Another solution, useful if you need the entire repertory without wasting too much resources is to say

\usepackage[T2A,T1]{fontenc}
\DeclareSymbolFont{cyrillic}{T2A}{cmr}{m}{n}
\DeclareMathSymbol{\Sha}{\mathalpha}{cyrillic}{216}

since the Sha has that position in the T2A encoding; this can be deduced from the definitions in the file t2aenc.def. By using some sorcery, we can directly use the LICR name of the characters:

\usepackage[T2A,T1]{fontenc}
\DeclareSymbolFont{cyrillic}{T2A}{cmr}{m}{n}
\def\makecyrsymbol#1#2{%
  \begingroup\edef\temp{\endgroup
    \noexpand\DeclareMathSymbol{\noexpand#1}
    {\noexpand\mathalpha}{cyrillic}%
    {\expandafter\expandafter\expandafter
     \calccyr\expandafter\meaning\csname T2A\string#2\endcsname\end}}%
  \temp}
\expandafter\def\expandafter\calccyr\string\char#1\end{#1}

\makecyrsymbol\Zhe\CYRZH

The command \makecyrsymbol has two arguments: the first one is the desired name for the symbol, the second one is the internal LaTeX name for the cyrillic letter. With that last line we have defined \Zhe as a math command in all sizes.

The \usepackage[T2A,T1]{fontenc} line is necessary for resetting the document's main encoding to T1; use OT1, instead of T1 if you don't need accented letters because your language is English. I have prefixed with that line each of the four solutions: pick your preferred one.

share|improve this answer
    
Thanks, this is great! –  user4561 Apr 1 '11 at 4:37

There may be a better way to do this, but here at least is one way. The required glyphs are all in the STIX fonts, so far as I can determine, and the unicode math package can be used to use the STIX fonts in mathematics. The catch is that the authors of unicode-math don't seem to have allowed for the possibility of (easily) using arbitrary glyphs. A bit of digging and experimenting leads to the following code. Hopefully, one of the authors of unicode-math (or fontspec) will stop by and clean it up a bit!

Here's the (idea of) the code:

\documentclass{standalone}
\usepackage{unicode-math}
\setmathfont{xits-math.otf}

\ExplSyntaxOn
\newcommand{\mathcyrillic}[2]{%
\chardef#1=#2
\um_set_mathcode:nnnn{#1}{\mathalpha}{\um_symfont_tl}{#2}}
\ExplSyntaxOff

\mathcyrillic{\Tse}{"0426}
\mathcyrillic{\Che}{"0427}
\mathcyrillic{\Sha}{"0428}

\begin{document}
\(\Sha \Che \Tse\)
\end{document}

Obviously, one has to fill in the rest of the desired characters in the alphabet. You can get the unicode numbers of the Cyrillic letters at this wikipedia page. The numbers are in hex, so need to be prefixed by a double-quote mark: ".

Result:

Cyrillic in maths

Caveats: you need a font with the glyphs (STIX is pretty comprehensive), and you need to use XeLaTeX or LuaLaTeX for the unicode-math package to work.

share|improve this answer
    
Thanks for your reply! I went with egregs solution since I understood it better. This is nice too though. –  user4561 Apr 1 '11 at 4:39

Your Answer

 
discard

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