# Mixing latin and cyrillic characters

I have an idea of how to mix those, but failed to find out which fontenc encoding to use for Central European characters.

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1,T2A]{fontenc}

\begin{document}

\fontencoding{T1}
Some latin text here with Central European characters such as š or đ.
\fontencoding{T2A}
А овдје се налази ћирилични текст.
\fontencoding{T1}
And latin again!

\end{document}


Everything works just fine if I remove character đ, but when I put it there, T1 doesn't work for it.

I get this error message:

! LaTeX Error: Command \dj unavailable in encoding T2A.


Now this is a little confusing, since đ should be under T1 encoding, right?

What encoding should I use to be able to use character đ? Is there a list of available fontenc encodings (I could iterate until I found the one that works)?

-

The problem is that you're not selecting the font encodings properly; you need to write \selectfont after changing the encoding. Here's a better example:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1,T2A]{fontenc}
\usepackage{lmodern}
\begin{document}
\fontencoding{T1}\selectfont
Some latin text here with Central European characters such as š or đ.
\fontencoding{T2A}\selectfont
А овдје се налази ћирилични текст.
\fontencoding{T1}\selectfont
And latin again!
\end{document}


Note the use of the Latin Modern fonts, which should generally give you much better output with European languages.

More information about font encodings can be found in the LaTeX2e documentation file encguide.pdf which you should be able to access on your system with texdoc encguide.

-