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 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.

share|improve this question
    
Well either you didn't install the lh-package correctly or your system is so old that it can't generate tfm's on-the-fly. What do you get on a terminal from kpsewhich larm1000.mf? –  Ulrike Fischer Nov 22 '11 at 15:32
    
What TeX distribution are you using? –  egreg Nov 22 '11 at 16:57
    
I don't know about SWP and the structure of the TeX system it uses. Maybe it's possible to copy into it the .tfm files needed (by running the file on TeX Live, that will produce them), but printing is another thing. :( –  egreg Nov 22 '11 at 17:51
    
Good question! I know of no document as such that lists the LICR available for all official encodings. :( But looking at t2aenc.def you at least find the names of the cyrillic letters. In general zzzenc.def is the file to examine, where zzz stands for the encoding name converted to lowercase. –  egreg Nov 22 '11 at 18:12
    
Sorry, no. The developers of the cyrillic encodings chose the placement of glyphs in a very different way than Unicode. –  egreg Nov 22 '11 at 18:28
add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
    
I changed \cyrl to \CYRL\cyra\CYRT\cyre\CYRK\CYRS to have some upper case letters as well, and \usepackage[unicode=true,bookmarks=true]{hyperref} and section can be removed to keep the example minimal. Would you care to adapt your answer? Maybe include the necessity of Cyrillic and lh packages, because they are necessary regardless of TeXlive or SWP? –  Stephen Nov 30 '11 at 18:43
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.