Return-Path: Received: from relay2.vsu.ru ([62.76.169.17] verified) by vsu.ru (CommuniGate Pro SMTP 3.2b9) with ESMTP id 1250493 for CyrTeX-en@vsu.ru; Sat, 22 Jan 2000 01:14:24 +0300 Received: by relay2.vsu.ru (Postfix, from userid 5) id EC24A1A0E; Sat, 22 Jan 2000 01:14:13 +0300 (MSK) Received: (from vvv@localhost) by vvv.vsu.ru (8.9.3/8.9.3) id AAA03767; Sat, 22 Jan 2000 00:49:37 +0300 X-Authentication-Warning: vvv.vsu.ru: vvv set sender to vvv@vvv.vsu.ru using -f To: CyrTeX-en@vsu.ru Subject: inputenc extension: switch input encoding inside a paragraph From: Vladimir Volovich Date: 22 Jan 2000 00:49:37 +0300 Message-ID: User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.4 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Hi, currently LaTeX forbids one to use the \inputencoding macro in horizontal mode (inside a paragraph), because this will generally lead to extra glue inserted into a paragraph. some time ago we discussed a simple correction to the inputenc package which will "solve" this: allow usage of \inputencoding macro inside a paragraph. now, a December 1999 version of LaTeX seems to be released (but not yet announced?), and it looks like this change was not included into the "official" inputenc package (because it may lead to incompatibility problems with older releases). so, here is a test version of the extension to the inputenc package: an inpenc package. just use it instead of inputenc, and then \inputencoding will work everywhere. i've attached inpenc.sty together with a simple test file. what do you think, should this be uploaded to CTAN? Best regards, -- Vladimir. --=-=-= Content-Type: application/x-tex Content-Disposition: attachment; filename=inpenc.sty % inpenc.sty (c) 2000 by Vladimir Volovich % it may be distributed under LPPL. % TODO: load codepages into memory, and do not re-read files \ProvidesPackage{inpenc}[2000/01/20 v0.1 extended facilities for inputenc] \DeclareOption*{\PassOptionsToPackage\CurrentOption{inputenc}} \ProcessOptions \RequirePackage{inputenc} \def\inputencoding#1{% \gdef\@inpenc@test{\global\let\@inpenc@test\relax}% \def\@inpenc@undefined{\PackageError{inputenc}% {Keyboard character used is undefined\MessageBreak in inputencoding #1}% {You need to provide a definition with \noexpand\DeclareInputText\MessageBreak or \noexpand\DeclareInputMath before using this key.}}% \@inpenc@loop\^^A\^^H% \@inpenc@loop\^^K\^^K% \@inpenc@loop\^^N\^^_% \@inpenc@loop\^^?\^^ff% \ifhmode\kern\z@\fi \input{#1.def}% \ifhmode\@killglue\fi \ifx\@inpenc@test\relax\else \PackageWarning{inputenc}% {No characters defined\MessageBreak by input encoding change to `#1'\MessageBreak}% \fi } \endinput --=-=-= Content-Type: application/x-tex Content-Disposition: attachment; filename=test.tex Content-Transfer-Encoding: quoted-printable \documentclass{article} \usepackage[koi8-r,latin1]{inpenc} \usepackage[T2A,T1]{fontenc} \makeatletter \def\frenchtext{\fontencoding{T1}\selectfont % \let\encodingdefault\f@encoding % \expandafter\set@hyphenmins\frenchhyphenmins % \language\l@french \inputencoding{latin1}} \DeclareTextFontCommand\textfrench\frenchtext \def\russiantext{\fontencoding{T2A}\selectfont % \let\encodingdefault\f@encoding % \expandafter\set@hyphenmins\russianhyphenmins % \language\l@russian \inputencoding{koi8-r}} \DeclareTextFontCommand\textrussian\russiantext \makeatother \begin{document} This is a test: \textrussian{=F0=D2=CF=C2=C1 =D0=C5=D2=C1} this is a te= st. \russiantext =F0=D2=CF=C2=C1 =D0=C5=D2=C1: \textfrench{fran=E7ais} =D0=D2=CF=C2=C1 = =D0=C5=D2=C1. \end{document} --=-=-=--