# newcommand for foreign language

I started to learn russian, and I need to write russian in LaTeX. I am aware of the \foreignlanguage{russian}{text} function. But how do I make a new command, so I only need to type \rl{text}?

\documentclass{article}
\usepackage[OT2, T1]{fontenc}
\usepackage[russian, english]{babel}

\begin{document}
\newcommand{\rl}[1] {\foreignlanguage{russian}{}}

\rl{This should be russian}

\end{document}

• You need the placeholder for the argument #1: \newcommand{\rl}[1] {\foreignlanguage{russian}{#1}} Sep 21, 2013 at 11:27
• See here for more information: en.wikibooks.org/wiki/LaTeX/Macros#New_commands Sep 21, 2013 at 11:33
• @MarcoDaniel Maybe you can convert your comment into an answer for being accepted.
– Red
Sep 21, 2013 at 12:30

The main problem is that you're not telling TeX what to typeset in the cyrillic script: your definition ends up in discarding the argument and typesetting nothing in Russian.

You need

\newcommand{\rl}[1]{\foreignlanguage{russian}{#1}}


where #1 stands for the contents of the argument following \rl when called.

Since TeX is a macro expansion language, also

\newcommand{\rl}{\foreignlanguage{russian}}


would work, because when TeX sees \rl{Russkii0 yazyk}, it would replace \rl with \foreignlanguage{russian}. But probably the first way is easier to understand.

However, if you plan to use the default Computer Modern font, you'd better make a change to how \cyrillictext (the internal macro called when switching to Russian) works. The problem is that the cmr font family in the encoding OT2 is associated to a font that's only available as bitmap. A very similar font is distributed by AMS also as Type1. The change I propose is thus

\documentclass{article}
\usepackage[OT2, T1]{fontenc}
\usepackage[russian, english]{babel}

%% Let's patch \cyrillictext so that it uses
%% the Washington University fonts
\usepackage{xpatch}
\xpatchcmd{\cyrillictext}
{\selectfont}
{\fontfamily{wncyr}\selectfont}
{}{}
\let\cyr\cyrillictext

\newcommand{\rl}[1] {\foreignlanguage{russian}{#1}}

\begin{document}

\rl{Russkii0 yazyk}

\end{document}


A comparison of the output should say all. In the first image you see pixelated fonts. The “ka” and the “ya” in the second example are slightly different, but “more Cyrillic” in my opinion.