% pmCb.tex -- version 1.0
%
% Poor Man's Chinese TeX for Big5 coded traditional characters
%
% Stephen G. Simpson (simpson@math.psu.edu)
% Created 21 October 1991
% Last revised 06 November 1991
%
% Copyright (C) 06 November 1991 by Stephen G. Simpson.
%
% This file can be distributed freely.  Use of this file for any
% purpose contrary to the ideals of bourgeoise liberalism is
% prohibited.
%
%
%
% HOW TO USE THIS FILE
%
% Put ``\input pmCb'' near the beginning of your TeX document.
% You can then use ``\beginBchinese'' and ``\endBchinese'' to
% delimit groups which may contain Big5 coded Chinese characters.
%
% The needed fonts, kcm10*.tfm and kcm10*.300pk, are available
% for anonymous ftp at leibniz.math.psu.edu, directory
% pub/simpson/chinese/pmc.
%
%
% BUGS
%
% Big5 codes following ``\beginBchinese'' on the same
% line are not printed correctly.  This has an easy workaround:
% Don't put any Big5 codes on the same line as ``\beginBchinese''.
%
% Big5 codes whose second byte is \ or { or } will cause problems
% inside arguments to macros such as \centerline{...}.  There is
% really no way to fix this bug, because macro arguments are always
% completely tokenized before being fed to the macro expander.
%
% One workaround is to redefine \centerline as a macro with no 
% arguments, as follows:
%
% \def\centerline{\setbox0=\hbox\bgroup\aftergroup\finishcenterline\let\next=}
% \def\finishcenterline{\line{\hss\unhbox0\hss}}
%
% More generally, we can define an \expandarg macro:
%
% \def\expandarg#1{\let\command#1%
%    \setbox0=\hbox\bgroup\aftergroup\finishcommand\let\next=}
% \def\finishcommand{\command{\unhbox0}}
%
% and use \expandarg\centerline instead of \centerline as needed.
% Or redefine \centerline as follows:
%
% \let\oldcenterline\centerline
% \def\centerline{\expandarg\oldcenterline}
% 
% Here \centerline is only an example.  We can do the same with
% any macro whose argument may contain Big5 codes.
%
% 
%
% ACKNOWLEDGEMENTS
%
% Poor Man's Chinese TeX is the creation of Thomas Ridgeway
% (ridgeway@blackbox.hacc.washington.edu), December 1990.
% 
% A partial port to Big5 characters was done by Mark Leisher
% (mleisher@nmsu.edu), May 1991.
% 
% Simpson's port to Big5 characters was version 0.8 of this 
% file, October 1991.
% 
% After consultation with wizards on comp.text.tex, Simpson wrote
% version 0.9 of this file, October 1991.  It incorporates
% simplifications based on ideas of Raymond Chen
% (raymond@math.berkeley.edu) and Victor Eijkhout
% (eijkhout@csrd.uiuc.edu).  The \expandarg workaround was suggested
% by Raymond Chen and Kresten Krab Thorup (krab@iesd.auc.dk).
%
% 
%
% declare our Big5 coded traditional character fonts
\font\bcfaB=kcm10a1
\font\bcfaC=kcm10a2
\font\bcfaD=kcm10a3
\font\bcfaE=kcm10a4
\font\bcfaF=kcm10a5
\font\bcfaG=kcm10a6
\font\bcfaH=kcm10a7
\font\bcfaI=kcm10a8
\font\bcfaJ=kcm10a9
\font\bcfaa=kcm10aa
\font\bcfab=kcm10ab
\font\bcfac=kcm10ac
\font\bcfad=kcm10ad
\font\bcfae=kcm10ae
\font\bcfaf=kcm10af
\font\bcfbA=kcm10b0
\font\bcfbB=kcm10b1
\font\bcfbC=kcm10b2
\font\bcfbD=kcm10b3
\font\bcfbE=kcm10b4
\font\bcfbF=kcm10b5
\font\bcfbG=kcm10b6
\font\bcfbH=kcm10b7
\font\bcfbI=kcm10b8
\font\bcfbJ=kcm10b9
\font\bcfba=kcm10ba
\font\bcfbb=kcm10bb
\font\bcfbc=kcm10bc
\font\bcfbd=kcm10bd
\font\bcfbe=kcm10be
\font\bcfbf=kcm10bf
\font\bcfcA=kcm10c0
\font\bcfcB=kcm10c1
\font\bcfcC=kcm10c2
\font\bcfcD=kcm10c3
\font\bcfcE=kcm10c4
\font\bcfcF=kcm10c5
\font\bcfcG=kcm10c6
\font\bcfcH=kcm10c7
\font\bcfcI=kcm10c8
\font\bcfcJ=kcm10c9
\font\bcfca=kcm10ca
\font\bcfcb=kcm10cb
\font\bcfcc=kcm10cc
\font\bcfcd=kcm10cd
\font\bcfce=kcm10ce
\font\bcfcf=kcm10cf
\font\bcfdA=kcm10d0
\font\bcfdB=kcm10d1
\font\bcfdC=kcm10d2
\font\bcfdD=kcm10d3
\font\bcfdE=kcm10d4
\font\bcfdF=kcm10d5
\font\bcfdG=kcm10d6
\font\bcfdH=kcm10d7
\font\bcfdI=kcm10d8
\font\bcfdJ=kcm10d9
\font\bcfda=kcm10da
\font\bcfdb=kcm10db
\font\bcfdc=kcm10dc
\font\bcfdd=kcm10dd
\font\bcfde=kcm10de
\font\bcfdf=kcm10df
\font\bcfeA=kcm10e0
\font\bcfeB=kcm10e1
\font\bcfeC=kcm10e2
\font\bcfeD=kcm10e3
\font\bcfeE=kcm10e4
\font\bcfeF=kcm10e5
\font\bcfeG=kcm10e6
\font\bcfeH=kcm10e7
\font\bcfeI=kcm10e8
\font\bcfeJ=kcm10e9
\font\bcfea=kcm10ea
\font\bcfeb=kcm10eb
\font\bcfec=kcm10ec
\font\bcfed=kcm10ed
\font\bcfee=kcm10ee
\font\bcfef=kcm10ef
\font\bcffA=kcm10f0
\font\bcffB=kcm10f1
\font\bcffC=kcm10f2
\font\bcffD=kcm10f3
\font\bcffE=kcm10f4
\font\bcffF=kcm10f5
\font\bcffG=kcm10f6
\font\bcffH=kcm10f7
\font\bcffI=kcm10f8
\font\bcffJ=kcm10f9
% \font\bcffa=kcm10fa
% \font\bcffb=kcm10fb
% \font\bcffc=kcm10fc
% \font\bcffd=kcm10fd
% \font\bcffe=kcm10fe
%
% define a macro to activate the bytes which can be
% the first byte of a Big5 character
\def\bcactive{%
\catcode`\^^a1=13%
\catcode`\^^a2=13%
\catcode`\^^a3=13%
\catcode`\^^a4=13%
\catcode`\^^a5=13%
\catcode`\^^a6=13%
\catcode`\^^a7=13%
\catcode`\^^a8=13%
\catcode`\^^a9=13%
\catcode`\^^aa=13%
\catcode`\^^ab=13%
\catcode`\^^ac=13%
\catcode`\^^ad=13%
\catcode`\^^ae=13%
\catcode`\^^af=13%
\catcode`\^^b0=13%
\catcode`\^^b1=13%
\catcode`\^^b2=13%
\catcode`\^^b3=13%
\catcode`\^^b4=13%
\catcode`\^^b5=13%
\catcode`\^^b6=13%
\catcode`\^^b7=13%
\catcode`\^^b8=13%
\catcode`\^^b9=13%
\catcode`\^^ba=13%
\catcode`\^^bb=13%
\catcode`\^^bc=13%
\catcode`\^^bd=13%
\catcode`\^^be=13%
\catcode`\^^bf=13%
\catcode`\^^c0=13%
\catcode`\^^c1=13%
\catcode`\^^c2=13%
\catcode`\^^c3=13%
\catcode`\^^c4=13%
\catcode`\^^c5=13%
\catcode`\^^c6=13%
\catcode`\^^c7=13%
\catcode`\^^c8=13%
\catcode`\^^c9=13%
\catcode`\^^ca=13%
\catcode`\^^cb=13%
\catcode`\^^cc=13%
\catcode`\^^cd=13%
\catcode`\^^ce=13%
\catcode`\^^cf=13%
\catcode`\^^d0=13%
\catcode`\^^d1=13%
\catcode`\^^d2=13%
\catcode`\^^d3=13%
\catcode`\^^d4=13%
\catcode`\^^d5=13%
\catcode`\^^d6=13%
\catcode`\^^d7=13%
\catcode`\^^d8=13%
\catcode`\^^d9=13%
\catcode`\^^da=13%
\catcode`\^^db=13%
\catcode`\^^dc=13%
\catcode`\^^dd=13%
\catcode`\^^de=13%
\catcode`\^^df=13%
\catcode`\^^e0=13%
\catcode`\^^e1=13%
\catcode`\^^e2=13%
\catcode`\^^e3=13%
\catcode`\^^e4=13%
\catcode`\^^e5=13%
\catcode`\^^e6=13%
\catcode`\^^e7=13%
\catcode`\^^e8=13%
\catcode`\^^e9=13%
\catcode`\^^ea=13%
\catcode`\^^eb=13%
\catcode`\^^ec=13%
\catcode`\^^ed=13%
\catcode`\^^ee=13%
\catcode`\^^ef=13%
\catcode`\^^f0=13%
\catcode`\^^f1=13%
\catcode`\^^f2=13%
\catcode`\^^f3=13%
\catcode`\^^f4=13%
\catcode`\^^f5=13%
\catcode`\^^f6=13%
\catcode`\^^f7=13%
\catcode`\^^f8=13%
\catcode`\^^f9=13%
% \catcode`\^^fa=13%
% \catcode`\^^fb=13%
% \catcode`\^^fc=13%
% \catcode`\^^fd=13%
% \catcode`\^^fe=13%
}
%
% define a macro to deactivate bytes which can be
% the first byte of a Big5 character
\def\bcinactive{%
\catcode`\^^a1=12%
\catcode`\^^a2=12%
\catcode`\^^a3=12%
\catcode`\^^a4=12%
\catcode`\^^a5=12%
\catcode`\^^a6=12%
\catcode`\^^a7=12%
\catcode`\^^a8=12%
\catcode`\^^a9=12%
\catcode`\^^aa=12%
\catcode`\^^ab=12%
\catcode`\^^ac=12%
\catcode`\^^ad=12%
\catcode`\^^ae=12%
\catcode`\^^af=12%
\catcode`\^^b0=12%
\catcode`\^^b1=12%
\catcode`\^^b2=12%
\catcode`\^^b3=12%
\catcode`\^^b4=12%
\catcode`\^^b5=12%
\catcode`\^^b6=12%
\catcode`\^^b7=12%
\catcode`\^^b8=12%
\catcode`\^^b9=12%
\catcode`\^^ba=12%
\catcode`\^^bb=12%
\catcode`\^^bc=12%
\catcode`\^^bd=12%
\catcode`\^^be=12%
\catcode`\^^bf=12%
\catcode`\^^c0=12%
\catcode`\^^c1=12%
\catcode`\^^c2=12%
\catcode`\^^c3=12%
\catcode`\^^c4=12%
\catcode`\^^c5=12%
\catcode`\^^c6=12%
\catcode`\^^c7=12%
\catcode`\^^c8=12%
\catcode`\^^c9=12%
\catcode`\^^ca=12%
\catcode`\^^cb=12%
\catcode`\^^cc=12%
\catcode`\^^cd=12%
\catcode`\^^ce=12%
\catcode`\^^cf=12%
\catcode`\^^d0=12%
\catcode`\^^d1=12%
\catcode`\^^d2=12%
\catcode`\^^d3=12%
\catcode`\^^d4=12%
\catcode`\^^d5=12%
\catcode`\^^d6=12%
\catcode`\^^d7=12%
\catcode`\^^d8=12%
\catcode`\^^d9=12%
\catcode`\^^da=12%
\catcode`\^^db=12%
\catcode`\^^dc=12%
\catcode`\^^dd=12%
\catcode`\^^de=12%
\catcode`\^^df=12%
\catcode`\^^e0=12%
\catcode`\^^e1=12%
\catcode`\^^e2=12%
\catcode`\^^e3=12%
\catcode`\^^e4=12%
\catcode`\^^e5=12%
\catcode`\^^e6=12%
\catcode`\^^e7=12%
\catcode`\^^e8=12%
\catcode`\^^e9=12%
\catcode`\^^ea=12%
\catcode`\^^eb=12%
\catcode`\^^ec=12%
\catcode`\^^ed=12%
\catcode`\^^ee=12%
\catcode`\^^ef=12%
\catcode`\^^f0=12%
\catcode`\^^f1=12%
\catcode`\^^f2=12%
\catcode`\^^f3=12%
\catcode`\^^f4=12%
\catcode`\^^f5=12%
\catcode`\^^f6=12%
\catcode`\^^f7=12%
\catcode`\^^f8=12%
\catcode`\^^f9=12%
% \catcode`\^^fa=12%
% \catcode`\^^fb=12%
% \catcode`\^^fc=12%
% \catcode`\^^fd=12%
% \catcode`\^^fe=12%
}
%
% define glue to follow each Chinese character
\def\bcglue{\hskip0pt plus.5pt}
%
% define macros to begin and end each Big5 character
\def\bcbeginchar{\begingroup\catcode`\\=12 \catcode`\{=12 \catcode`\}=12 }
\def\bcendchar{\discretionary{}{}{}\bcglue\endgroup}
%
% define a general macro for the bytes which can be
% the first byte of a Big5 character
\def\bcchar{\bcbeginchar\bcch}
\def\bcch#1#2{{#1\char`#2}\bcendchar}
%
% define a macro to define individual macros for each of the bytes
% which can be the first byte of a Big5 character
\bcactive
\def\bcdefine{
\def^^a1{\bcchar\bcfaB}
\def^^a2{\bcchar\bcfaC}
\def^^a3{\bcchar\bcfaD}
\def^^a4{\bcchar\bcfaE}
\def^^a5{\bcchar\bcfaF}
\def^^a6{\bcchar\bcfaG}
\def^^a7{\bcchar\bcfaH}
\def^^a8{\bcchar\bcfaI}
\def^^a9{\bcchar\bcfaJ}
\def^^aa{\bcchar\bcfaa}
\def^^ab{\bcchar\bcfab}
\def^^ac{\bcchar\bcfac}
\def^^ad{\bcchar\bcfad}
\def^^ae{\bcchar\bcfae}
\def^^af{\bcchar\bcfaf}
\def^^b0{\bcchar\bcfbA}
\def^^b1{\bcchar\bcfbB}
\def^^b2{\bcchar\bcfbC}
\def^^b3{\bcchar\bcfbD}
\def^^b4{\bcchar\bcfbE}
\def^^b5{\bcchar\bcfbF}
\def^^b6{\bcchar\bcfbG}
\def^^b7{\bcchar\bcfbH}
\def^^b8{\bcchar\bcfbI}
\def^^b9{\bcchar\bcfbJ}
\def^^ba{\bcchar\bcfba}
\def^^bb{\bcchar\bcfbb}
\def^^bc{\bcchar\bcfbc}
\def^^bd{\bcchar\bcfbd}
\def^^be{\bcchar\bcfbe}
\def^^bf{\bcchar\bcfbf}
\def^^c0{\bcchar\bcfcA}
\def^^c1{\bcchar\bcfcB}
\def^^c2{\bcchar\bcfcC}
\def^^c3{\bcchar\bcfcD}
\def^^c4{\bcchar\bcfcE}
\def^^c5{\bcchar\bcfcF}
\def^^c6{\bcchar\bcfcG}
\def^^c7{\bcchar\bcfcH}
\def^^c8{\bcchar\bcfcI}
\def^^c9{\bcchar\bcfcJ}
\def^^ca{\bcchar\bcfca}
\def^^cb{\bcchar\bcfcb}
\def^^cc{\bcchar\bcfcc}
\def^^cd{\bcchar\bcfcd}
\def^^ce{\bcchar\bcfce}
\def^^cf{\bcchar\bcfcf}
\def^^d0{\bcchar\bcfdA}
\def^^d1{\bcchar\bcfdB}
\def^^d2{\bcchar\bcfdC}
\def^^d3{\bcchar\bcfdD}
\def^^d4{\bcchar\bcfdE}
\def^^d5{\bcchar\bcfdF}
\def^^d6{\bcchar\bcfdG}
\def^^d7{\bcchar\bcfdH}
\def^^d8{\bcchar\bcfdI}
\def^^d9{\bcchar\bcfdJ}
\def^^da{\bcchar\bcfda}
\def^^db{\bcchar\bcfdb}
\def^^dc{\bcchar\bcfdc}
\def^^dd{\bcchar\bcfdd}
\def^^de{\bcchar\bcfde}
\def^^df{\bcchar\bcfdf}
\def^^e0{\bcchar\bcfeA}
\def^^e1{\bcchar\bcfeB}
\def^^e2{\bcchar\bcfeC}
\def^^e3{\bcchar\bcfeD}
\def^^e4{\bcchar\bcfeE}
\def^^e5{\bcchar\bcfeF}
\def^^e6{\bcchar\bcfeG}
\def^^e7{\bcchar\bcfeH}
\def^^e8{\bcchar\bcfeI}
\def^^e9{\bcchar\bcfeJ}
\def^^ea{\bcchar\bcfea}
\def^^eb{\bcchar\bcfeb}
\def^^ec{\bcchar\bcfec}
\def^^ed{\bcchar\bcfed}
\def^^ee{\bcchar\bcfee}
\def^^ef{\bcchar\bcfef}
\def^^f0{\bcchar\bcffA}
\def^^f1{\bcchar\bcffB}
\def^^f2{\bcchar\bcffC}
\def^^f3{\bcchar\bcffD}
\def^^f4{\bcchar\bcffE}
\def^^f5{\bcchar\bcffF}
\def^^f6{\bcchar\bcffG}
\def^^f7{\bcchar\bcffH}
\def^^f8{\bcchar\bcffI}
\def^^f9{\bcchar\bcffJ}
% \def^^fa{\bcchar\bcffa}
% \def^^fb{\bcchar\bcffb}
% \def^^fc{\bcchar\bcffc}
% \def^^fd{\bcchar\bcffd}
% \def^^fe{\bcchar\bcffe}
}
\bcinactive
%
% define macros to begin and end a group which may contain
% Big5 coded Chinese characters
%
\def\beginBchinese{\begingroup\bcactive\bcdefine}
%
\def\endBchinese{\bcinactive\endgroup}
%
