# Remapping fonts between different encodings?

Consider this MWE:

\documentclass{article}

% http://tex.stackexchange.com/questions/215447/using-cyrillic-with-tex-gyre-pagella-and-pdflatex
\usepackage[utf8]{inputenc}
\usepackage[T2A, T1]{fontenc} % before babel!
\usepackage[russian,greek,english]{babel} % tlmgr install babel-russian

\usepackage[sc]{mathpazo}
\usepackage{paratype} % tlmgr install paratype
\usepackage{tgpagella}

% T2A for cyrillic - paratype
\usepackage{substitutefont}
\substitutefont{T2A}{\rmdefault}{PTSerif-TLF}

\begin{document}

\fontencoding{T1}\selectfont
Testing: \textsc{Small-caps Test!}

\fontencoding{T2A}\selectfont
Testing: \textsc{Small-caps Test!}

\end{document}


When building this, it will fail with:

! No declaration for shape T2A/PTSerif-TLF/m/sc.
sub@sfcnt ...e forspace shapespace mandatory@arg }
error@fontshape else #1{Fo...
l.23 Testing: \textsc{Small-caps Test!}


... but you can press ENTER here, and pdflatex will complete, producing this:

So this is the thing: how can I tell Latex, that once it encounter small caps (e.g. \scshape) in T2A font encoding (which here uses the paratype's PTSerif font), that it should instead use the tgpagella font in the T1 encoding (for the small caps only)? I was trying with this in the preamble:

\sbox0{\fontencoding{T2A}\selectfont \scshape X}
\DeclareFontShape{T2A}{PTSerif-TLF}{m}{sc}{<-> qpl}{} % nope


... but that doesn't seem to work. Is this kind of mapping between fonts in different font encodings possible at all?

• You could tell it to use the upright shape from PTSerif-TLF. But I don't think you can tell it to automatically substitute something in a different encoding. – cfr Dec 5 '14 at 17:59