bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding support for ISO-8859-1 in printed manuals


From: Paulo Sequeira
Subject: Adding support for ISO-8859-1 in printed manuals
Date: Fri, 17 Nov 2006 01:00:44 -0600
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

Hi,

I was annoyed by having to use @' commands for accents for my documents in Spanish, so I decided to try having @documentencoding do something to enable support for ISO-8859-1 encoding, following the approach of LaTeX's inputenc package (but in a greatly simplified form).

I could work out something that is ok for me, so I wanted to share it and see if this can be useful. It is a quick and dirty hack, and furthermore is my first try at Plain TeX "programming", so I'm sure there's plenty of room for improvement.

The results come close to those inputenc give you when you use OT1 font encoding. A few characters are still missing, and some don't look totally right. Also, there's still the limitation that node names can't have accented characters, but is better than nothing.

Any comments are welcome, specially if you think this can make into the source tree.

--
Paulo Sequeira
% txi-ISO-8859-1.tex -- TeX macros to handle ISO-8859-1 document encoding
%
% Copyright (C) 2006 by Paulo Sequeira Gutierrez
%
% This txi-es.tex file is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
% published by the Free Software Foundation; either version 2, or (at
% your option) any later version.
%
% This txi-ISO-8859-1.tex file is distributed in the hope that it will be
% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% General Public License for more details.
%

\global\catcode`^^a0=\active\gdef^^a0{\nobreakspace}
\global\catcode`^^a1=\active\gdef^^a1{\textexclamdown}
\global\catcode`^^a2=\active\gdef^^a2{\textcent}
\global\catcode`^^a3=\active\gdef^^a3{\pounds}

% Not in OT1 encoding
%\global\catcode`^^a4=\active\gdef^^a4{\textcurrency}

% Not in OT1 encoding
%\global\catcode`^^a5=\active\gdef^^a5{\textyen}

% Not in OT1 encoding
%\global\catcode`^^a6=\active\gdef^^a6{\textbrokenbar}

\global\catcode`^^a7=\active\gdef^^a7{\S}
\global\catcode`^^a8=\active\gdef^^a8{\"{}}
\global\catcode`^^a9=\active\gdef^^a9{\copyright}
\global\catcode`^^aa=\active\gdef^^aa{$^a$}

% Not in OT1 encoding
%\global\catcode`^^ab=\active\gdef^^ab{\guillemotleft}
\global\catcode`^^ac=\active\gdef^^ac{$\lnot$}
\global\catcode`^^ad=\active\gdef^^ad{\-}
\global\catcode`^^ae=\active\gdef^^ae{\registeredsymbol}
\global\catcode`^^af=\active\gdef^^af{\={}}

\global\catcode`^^b0=\active\gdef^^b0{$^\circ$}
\global\catcode`^^b1=\active\gdef^^b1{$\pm$}
\global\catcode`^^b2=\active\gdef^^b2{$^2$}
\global\catcode`^^b3=\active\gdef^^b3{$^3$}
\global\catcode`^^b4=\active\gdef^^b4{\'{}}
\global\catcode`^^b5=\active\gdef^^b5{$\mu$}
\global\catcode`^^b6=\active\gdef^^b6{\P}

%\global\catcode`^^b7=\active\gdef^^b7{\textperiodcentered}
\global\catcode`^^b8=\active\gdef^^b8{\c\ }
\global\catcode`^^b9=\active\gdef^^b9{$^1$}
\global\catcode`^^ba=\active\gdef^^ba{$^o$}

% Not in OT1 encoding
%\global\catcode`^^bb=\active\gdef^^bb{\guillemotright}
\global\catcode`^^bc=\active\gdef^^bc{$1\over4$}
\global\catcode`^^bd=\active\gdef^^bd{$1\over2$}
\global\catcode`^^be=\active\gdef^^be{$3\over4$}
\global\catcode`^^bf=\active\gdef^^bf{?`}

\global\catcode`^^c0=\active\gdef^^c0{\`A}
\global\catcode`^^c1=\active\gdef^^c1{\'A}
\global\catcode`^^c2=\active\gdef^^c2{\^A}
\global\catcode`^^c3=\active\gdef^^c3{\~A}
\global\catcode`^^c4=\active\gdef^^c4{\"A}
\global\catcode`^^c5=\active\gdef^^c5{\r A}
\global\catcode`^^c6=\active\gdef^^c6{\AE}
\global\catcode`^^c7=\active\gdef^^c7{\c C}
\global\catcode`^^c8=\active\gdef^^c8{\`E}
\global\catcode`^^c9=\active\gdef^^c9{\'E}
\global\catcode`^^ca=\active\gdef^^ca{\^E}
\global\catcode`^^cb=\active\gdef^^cb{\"E}
\global\catcode`^^cc=\active\gdef^^cc{\`I}
\global\catcode`^^cd=\active\gdef^^cd{\'I}
\global\catcode`^^ce=\active\gdef^^ce{\^I}
\global\catcode`^^cf=\active\gdef^^cf{\"I}

%\global\catcode`^^d0=\active\gdef^^d0{\DH}
\global\catcode`^^d1=\active\gdef^^d1{\~N}
\global\catcode`^^d2=\active\gdef^^d2{\`O}
\global\catcode`^^d3=\active\gdef^^d3{\'O}
\global\catcode`^^d4=\active\gdef^^d4{\^O}
\global\catcode`^^d5=\active\gdef^^d5{\~O}
\global\catcode`^^d6=\active\gdef^^d6{\"O}
\global\catcode`^^d7=\active\gdef^^d7{$\times$}
\global\catcode`^^d8=\active\gdef^^d8{\O}
\global\catcode`^^d9=\active\gdef^^d9{\`U}
\global\catcode`^^da=\active\gdef^^da{\'U}
\global\catcode`^^db=\active\gdef^^db{\^U}
\global\catcode`^^dc=\active\gdef^^dc{\"U}
\global\catcode`^^dd=\active\gdef^^dd{\'Y}
%\global\catcode`^^de=\active\gdef^^de{\TH}
\global\catcode`^^df=\active\gdef^^df{\ss}

\global\catcode`^^e0=\active\gdef^^e0{\`a}
\global\catcode`^^e1=\active\gdef^^e1{\'a}
\global\catcode`^^e2=\active\gdef^^e2{\^a}
\global\catcode`^^e3=\active\gdef^^e3{\~a}
\global\catcode`^^e4=\active\gdef^^e4{\"a}
\global\catcode`^^e5=\active\gdef^^e5{\r a}
\global\catcode`^^e6=\active\gdef^^e6{\ae}
\global\catcode`^^e7=\active\gdef^^e7{\c c}
\global\catcode`^^e8=\active\gdef^^e8{\`e}
\global\catcode`^^e9=\active\gdef^^e9{\'e}
\global\catcode`^^ea=\active\gdef^^ea{\^e}
\global\catcode`^^eb=\active\gdef^^eb{\"e}
\global\catcode`^^ec=\active\gdef^^ec{\`\ptexi}
\global\catcode`^^ed=\active\gdef^^ed{\'\ptexi}
\global\catcode`^^ee=\active\gdef^^ee{\^\ptexi}
\global\catcode`^^ef=\active\gdef^^ef{\"\ptexi}

%\global\catcode`^^f0=\active\gdef^^f0{\dh}
\global\catcode`^^f1=\active\gdef^^f1{\~n}
\global\catcode`^^f2=\active\gdef^^f2{\`o}
\global\catcode`^^f3=\active\gdef^^f3{\'o}
\global\catcode`^^f4=\active\gdef^^f4{\^o}
\global\catcode`^^f5=\active\gdef^^f5{\~o}
\global\catcode`^^f6=\active\gdef^^f6{\"o}
\global\catcode`^^f7=\active\gdef^^f7{$\div$}
\global\catcode`^^f8=\active\gdef^^f8{\o}
\global\catcode`^^f9=\active\gdef^^f9{\`u}
\global\catcode`^^fa=\active\gdef^^fa{\'u}
\global\catcode`^^fb=\active\gdef^^fb{\^u}
\global\catcode`^^fc=\active\gdef^^fc{\"u}
\global\catcode`^^fd=\active\gdef^^fd{\'y}
%\global\catcode`^^fe=\active\gdef^^fe{\th}
\global\catcode`^^ff=\active\gdef^^ff{\"y}

\endinput

Index: texinfo.tex
===================================================================
RCS file: /sources/texinfo/texinfo/doc/texinfo.tex,v
retrieving revision 1.223
diff -r1.223 texinfo.tex
6c6
< \def\texinfoversion{2006-11-08.17}
---
> \def\texinfoversion{2006-11-17.00}
7130,7132c7130,7147
< % @documentencoding should change something in TeX eventually, most
< % likely, but for now just recognize it.
< \let\documentencoding = \comment
---
> % @documentencoding imports definition of active characters
> % corresponding to the specified encoding
> \parseargdef\documentencoding{%
>   \tex % read txi-??.tex file in plain TeX.
>     % Read the file if it exists.
>     \openin 1 txi-#1.tex
>     \ifeof 1
>       \errhelp = \noenchelp
>       \errmessage{Cannot read encoding file txi-#1.tex}%
>     \else
>       \input txi-#1.tex
>     \fi
>     \closein 1
>   \endgroup
> }
> \newhelp\noenchelp{The given encoding definition file cannot be found or
> is empty.  Maybe you need to install it?  In the current directory
> should work if nowhere else does.}

Attachment: psequeira.vcf
Description: Vcard


reply via email to

[Prev in Thread] Current Thread [Next in Thread]