TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I have known current font encoding? I know that a list of font encodings is saved in \cdp@list macro. Last element of \cdp@list is usually the effective encoding but this is not always true; for example, \setlanguage might switch current encoding.

Actually, I want to distinguish the case where either EU1 or EU2 font encoding is in effect from a non-unicode encoding.

share|improve this question
up vote 5 down vote accepted

The macro \f@encoding always expands to the current encoding:


\newcommand{\printenc}{the current encoding is~\texttt{\f@encoding}}

Text in English: \printenc

\foreignlanguage{russian}{Какой-то осмысленный текст: \printenc}

English again: \printenc

Какой-то осмысленный текст: \printenc

enter image description here

As far as XeLaTeX and LuaLaTeX are concerned, the encoding should always be EU1 or EU2, respectively, unless you're mixing fonts, which is not recommended.

share|improve this answer

Your Answer


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.