The inputenc package can only work from when it is loaded, so obviously not at the very start of the document. Until then, only ASCII should be used.
For real unicode handling, use a Unicode capable engine like XeTeX or LuaTeX (in your case, xelatex
or lualatex
). Then you don't need inputenc (and likely want to change some other packages, too).
Update: from the April 2018 LaTeX release, UTF-8 is the default encoding of LaTeX also with non-unicode engines. Thus this error should not happen anymore (you might get different errors for non-unicode documents, though). See the LaTeX News 28 (PDF) for details.
You need to announce LaTeX the languages you intend to use (T2A is for cyrillic):
\documentclass{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian,french,english]{babel}
\begin{document}
In Dahl’s dictionary there is a similar sounding word “\foreignlanguage{russian}{дуван}”.
\begin{otherlanguage*}{french}
“C’est auprès de son père, écrivain de la nation pisane à la douane de Bougie, à
la fin du douzième siècle[todo], que le célèbre mathématicien Léonard
Bonacci
\end{otherlanguage*}
\end{document}
The main problem is that fonts have only 256 slots available for glyphs and writing in French and Russian requires more than 256 glyphs. (Maybe this is not strictly true, but even if the number of glyphs were less than 256, a special output encoding for French and Russian would be needed; what about German and Russian, Polish and Russian, or a mixing of three languages?)
You can always define an abbreviation, say \RUS
, for typesetting isolated words in Russian
\newcommand{\RUS}[1]{\foreignlanguage{russian}{#1}}
(or, more efficiently, \newcommand{\RUS}{\foreignlanguage{russian}}
). You have the benefit that hyphenation will be correct.
A different approach requires using an OpenType font that contains all the needed glyphs, but of course XeLaTeX or LuaLaTeX with fontspec
are required.
Best Answer
Just load
pmboxdraw
: