Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

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.