[Tex/LaTex] How to enter Unicode characters in TeX

unicode

I need to write a few Unicode characters (e.g. Л) into a text without using e.g. XeTeX, LuaTeX or inputencoding with UTF-8 (please assume as little as possible about the typesetting system).

I have read other questions regarding this problem, but did not find an answer without
XeTeX/LuaTeX/UTF-8/… (therefore the explicit TeX in the question).

EDIT (because it is way too long for a comment and comments do not provide code markup):

Egreg's answer works perfect with TeXlive 2011 (as expected for an answer of egreg and for TeXlive; +1 for that). Also as expected, with "Old-TeX" (SWP5.5 @ http://www.mackichan.com, which is the recent version) it does not work. Additionally it is necessary to install the cyrillic and lh packages and to change the code to

\documentclass{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[T2A,T1]{fontenc}
\begin{document}
{\fontencoding{T2A}\selectfont\CYRL\cyra\CYRT\cyre\CYRK\CYRS}%
\end{document}

(There must be an empty line before \documentclass, which SE does not show.)
Then the document does compile even with SWP, but Л still is not shown. The reason (as found by Ulrike Fischer) for this is that
the needed tfm font file (larm1000.mf) cannot be generated by the "Old-TeX".
When generating it with TeXlive and copying it to SWP, it is still not used.

Thus: With the current version of SWP it is not possible. 🙁

Nevertheless, it is possible to do this:

\documentclass{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[T2A,T1]{fontenc}

\def\cylatex{%
%TCIMACRO{LaTeX}%
%BeginExpansion
{\fontencoding{T2A}\selectfont\CYRL\cyra\CYRT\cyre\CYRK\CYRS}%
%EndExpansion
}

\begin{document}

Text\cylatex{}Text

\end{document}

(There must be an empty line before \documentclass again, which SE does not show.)

When compiled with modern LaTeX, it writes TextЛаТеКСText
(I'm not sure about КС for X – anyone speaking a language using cyrillic signs here to help?),
and when compiled with SWP it writes TextLaTeXText (which is better than having just TextText).

Caveat: When the document is opened with SWP and saved, the definition will be changed to

\def\cylatex{LaTeX}

therefore the main document may never be saved by SWP (using subdocuments and editing those is possible).

Placing the

\def\cylatex{%
%TCIMACRO
...
}

into a style file will result in SWP reading the {\fontencoding{T2A}\selectfont\CYRL\cyra\CYRT\cyre\CYRK\CYRS}
part and again creating an error instead of ЛаТеКС or LaTeX.

Best Answer

Every character in one of the standard output encoding has a LaTeX Internal Character Representation (LICR). The LICR for л is \cyrl and the character belongs to the output encoding T2A (cyrillic). So

\documentclass{article}
\usepackage[T2A,T1]{fontenc} % T1 can also be OT1
\usepackage[unicode=true,bookmarks=true]{hyperref}
\begin{document}
\section{{\fontencoding{T2A}\selectfont\cyrl} is the cyrillic letter ``ell''}

{\fontencoding{T2A}\selectfont\cyrl}l

\end{document}

will do. Of course you'll want to define a more handy command for choosing a different output encoding.