RUN: xelatex book.tex
\documentclass[a5paper,12pt]{book}
\usepackage[X2,T2A,OT2]{fontenc}
\usepackage[english,russian]{babel}
\usepackage{marvosym}
\usepackage{fontspec}
\usepackage{xunicode,xltxtra,url,parskip}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{supertabular}
\usepackage{titlesec}
\newpagestyle{mystyle}{\setfoot[\thepage][][]{}{}{\thepage}}
\pagestyle{mystyle}
% \defaultfontfeatures{Mapping=tex-text}
% \setmainfont{OldStandard}[
% Extension=.otf,
% UprightFont=*-Regular,
% ItalicFont=*-Italic,
% BoldItalicFont =*-BoldItalic,
% BoldFont=*-Bold
% ]
\newcommand{\И}{{\fontencoding{X2}\selectfont\CYRII}} % І
\newcommand{\и}{{\fontencoding{X2}\selectfont\cyrii}} % і
\newcommand{\Е}{{\fontencoding{X2}\selectfont\CYRYAT}} % Ѣ
\newcommand{\е}{{\fontencoding{X2}\selectfont\cyryat}} % ѣ
\newcommand{\Ф}{{\fontencoding{X2}\selectfont\CYROTLD}} % Ө
\newcommand{\ф}{{\fontencoding{X2}\selectfont\cyrotld}} % ө
\newcommand{\Ы}{{\fontencoding{X2}\selectfont\CYRIZH}} % Ѵ
\newcommand{\ы}{{\fontencoding{X2}\selectfont\cyrizh}} % ѵ
\usepackage[absolute]{textpos}
\begin{document}
\И \и \Е \е \Ф \ф \Ы \ы % IT WORKS with trailing space!
Нар\еч\ие % Нарѣчіе, ERROR: Undefined control sequence.
\end{document}
Why aliases \И
\и
, and etc do not work without trailing space?
Is it possible to create such kind of alias?
\еч
followed by the command\ие
, which are both undefined. LaTeX is not smart enough to check if there are shorter alternatives if a longer command is not defined (which would make the implementation of the parser much more complex). The space is disregarded when parsing, so the output should be ok when you useНар\е ч\и е
or alternativelyНар\е{}ч\и{}е
. But don't do that - XeLaTeX is not designed to use the older fontencodings as @UlrikeFischer said.\usepackage[X2,T2A,OT2]{fontenc}
you are forcing legacy 8 and 7 bit encodings so losing almost all the benefits of xetex and making it impossible to get correct hyphenation. It is recommended not to use eitherxunicode
orxltxtra
with current xelatex as well.