% pmCs.tex -- version 1.1
%
% Poor Man's Chinese TeX for GB coded simplified characters
%
% Stephen G. Simpson (simpson@math.psu.edu)
% Created 19 February October 1993
%
% Copyright (C) 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 pmCs'' near the beginning of your TeX document.
% You can then use ``\beginchinese'' and ``\endchinese'' to
% delimit groups which may contain GB coded Chinese characters.
% These will be printed as simplified (PRC style) characters.
%
% The conditional ``\bigC'' may be used to give your simplified
% Chinese characters an extra magstep 2 magnification.
% For instance, a title might be implemented as
% \centerline{\bigCtrue ...}.
%
% The needed fonts, wccs*.tfm and wccs*.300pk, are available
% for anonymous ftp at math.psu.edu:/pub/simpson/chinese/pmc.
%
%
% BUGS
%
% GB codes following ``\beginchinese'' on the same
% line are not printed correctly.  This has an easy workaround:
% Don't put any GB codes on the same line as ``\beginchinese''.
%
% 
% ACKNOWLEDGEMENTS
%
% Poor Man's Chinese TeX for GB codes is the creation of Thomas
% Ridgeway (ridgeway@blackbox.hacc.washington.edu), December 1990.
% A partial port to Big5 codes was done by Mark Leisher
% (mleisher@nmsu.edu), May 1991.  An improved Big5 version was done by
% Stephen G. Simpson, October 1991, with the help of wizards on
% comp.text.tex.
%
% The current GB version (embodied in the file you are now reading) is
% due to Stephen G. Simpson, using ideas from his 1991 Big5 version.
% The current GB version corrects some problems with the original GB 
% version due to Thomas Ridgeway.  For example, the current GB version
% works better with TeX's \headline macro.
%
% 
%
% declare our GB coded simplified character fonts
\font\gcfaB=wccsa1
\font\gcfaC=wccsa2
\font\gcfaD=wccsa3
\font\gcfaE=wccsa4
\font\gcfaF=wccsa5
\font\gcfaG=wccsa6
\font\gcfaH=wccsa7
\font\gcfaI=wccsa8
\font\gcfaJ=wccsa9
\font\gcfaa=wccsaa
\font\gcfab=wccsab
\font\gcfac=wccsac
\font\gcfad=wccsad
\font\gcfae=wccsae
\font\gcfaf=wccsaf
\font\gcfbA=wccsb0
\font\gcfbB=wccsb1
\font\gcfbC=wccsb2
\font\gcfbD=wccsb3
\font\gcfbE=wccsb4
\font\gcfbF=wccsb5
\font\gcfbG=wccsb6
\font\gcfbH=wccsb7
\font\gcfbI=wccsb8
\font\gcfbJ=wccsb9
\font\gcfba=wccsba
\font\gcfbb=wccsbb
\font\gcfbc=wccsbc
\font\gcfbd=wccsbd
\font\gcfbe=wccsbe
\font\gcfbf=wccsbf
\font\gcfcA=wccsc0
\font\gcfcB=wccsc1
\font\gcfcC=wccsc2
\font\gcfcD=wccsc3
\font\gcfcE=wccsc4
\font\gcfcF=wccsc5
\font\gcfcG=wccsc6
\font\gcfcH=wccsc7
\font\gcfcI=wccsc8
\font\gcfcJ=wccsc9
\font\gcfca=wccsca
\font\gcfcb=wccscb
\font\gcfcc=wccscc
\font\gcfcd=wccscd
\font\gcfce=wccsce
\font\gcfcf=wccscf
\font\gcfdA=wccsd0
\font\gcfdB=wccsd1
\font\gcfdC=wccsd2
\font\gcfdD=wccsd3
\font\gcfdE=wccsd4
\font\gcfdF=wccsd5
\font\gcfdG=wccsd6
\font\gcfdH=wccsd7
\font\gcfdI=wccsd8
\font\gcfdJ=wccsd9
\font\gcfda=wccsda
\font\gcfdb=wccsdb
\font\gcfdc=wccsdc
\font\gcfdd=wccsdd
\font\gcfde=wccsde
\font\gcfdf=wccsdf
\font\gcfeA=wccse0
\font\gcfeB=wccse1
\font\gcfeC=wccse2
\font\gcfeD=wccse3
\font\gcfeE=wccse4
\font\gcfeF=wccse5
\font\gcfeG=wccse6
\font\gcfeH=wccse7
\font\gcfeI=wccse8
\font\gcfeJ=wccse9
\font\gcfea=wccsea
\font\gcfeb=wccseb
\font\gcfec=wccsec
\font\gcfed=wccsed
\font\gcfee=wccsee
\font\gcfef=wccsef
\font\gcffA=wccsf0
\font\gcffB=wccsf1
\font\gcffC=wccsf2
\font\gcffD=wccsf3
\font\gcffE=wccsf4
\font\gcffF=wccsf5
\font\gcffG=wccsf6
\font\gcffH=wccsf7
\font\gcffI=wccsf8
% \font\gcffJ=wccsf9
% \font\gcffa=wccsfa
% \font\gcffb=wccsfb
% \font\gcffc=wccsfc
% \font\gcffd=wccsfd
% \font\gcffe=wccsfe
%
% define a macro to activate the bytes which can be
% the first byte of a GB character
\def\gcactive{%
\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 GB character
\def\gcinactive{%
\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\gcglue{\hskip0pt plus.5pt}
%
% define macros to begin and end each GB character
\def\gcbeginchar{\begingroup}
\def\gcendchar{\discretionary{}{}{}\gcglue\endgroup}
%
% Note: The wccs*.* fonts are portmanteaus containing Chinese 
% characters in two different sizes.  We now set up a conditional
% for picking one size or the other.
\newif\ifbigC
\bigCfalse
\newcount\gCnum
\def\gCch#1{\gCnum=`#1\ifbigC\advance\gCnum by -128\fi\char\the\gCnum}
%
% define a general macro for the bytes which can be
% the first byte of a GB character
\def\gcchar{\gcbeginchar\gcch}
\def\gcch#1#2{{#1\gCch#2}\gcendchar}
%
% define a macro to define individual macros for each of the bytes
% which can be the first byte of a GB character
\gcactive
\def\gcdefine{
\def^^a1{\gcchar\gcfaB}
\def^^a2{\gcchar\gcfaC}
\def^^a3{\gcchar\gcfaD}
\def^^a4{\gcchar\gcfaE}
\def^^a5{\gcchar\gcfaF}
\def^^a6{\gcchar\gcfaG}
\def^^a7{\gcchar\gcfaH}
\def^^a8{\gcchar\gcfaI}
\def^^a9{\gcchar\gcfaJ}
\def^^aa{\gcchar\gcfaa}
\def^^ab{\gcchar\gcfab}
\def^^ac{\gcchar\gcfac}
\def^^ad{\gcchar\gcfad}
\def^^ae{\gcchar\gcfae}
\def^^af{\gcchar\gcfaf}
\def^^b0{\gcchar\gcfbA}
\def^^b1{\gcchar\gcfbB}
\def^^b2{\gcchar\gcfbC}
\def^^b3{\gcchar\gcfbD}
\def^^b4{\gcchar\gcfbE}
\def^^b5{\gcchar\gcfbF}
\def^^b6{\gcchar\gcfbG}
\def^^b7{\gcchar\gcfbH}
\def^^b8{\gcchar\gcfbI}
\def^^b9{\gcchar\gcfbJ}
\def^^ba{\gcchar\gcfba}
\def^^bb{\gcchar\gcfbb}
\def^^bc{\gcchar\gcfbc}
\def^^bd{\gcchar\gcfbd}
\def^^be{\gcchar\gcfbe}
\def^^bf{\gcchar\gcfbf}
\def^^c0{\gcchar\gcfcA}
\def^^c1{\gcchar\gcfcB}
\def^^c2{\gcchar\gcfcC}
\def^^c3{\gcchar\gcfcD}
\def^^c4{\gcchar\gcfcE}
\def^^c5{\gcchar\gcfcF}
\def^^c6{\gcchar\gcfcG}
\def^^c7{\gcchar\gcfcH}
\def^^c8{\gcchar\gcfcI}
\def^^c9{\gcchar\gcfcJ}
\def^^ca{\gcchar\gcfca}
\def^^cb{\gcchar\gcfcb}
\def^^cc{\gcchar\gcfcc}
\def^^cd{\gcchar\gcfcd}
\def^^ce{\gcchar\gcfce}
\def^^cf{\gcchar\gcfcf}
\def^^d0{\gcchar\gcfdA}
\def^^d1{\gcchar\gcfdB}
\def^^d2{\gcchar\gcfdC}
\def^^d3{\gcchar\gcfdD}
\def^^d4{\gcchar\gcfdE}
\def^^d5{\gcchar\gcfdF}
\def^^d6{\gcchar\gcfdG}
\def^^d7{\gcchar\gcfdH}
\def^^d8{\gcchar\gcfdI}
\def^^d9{\gcchar\gcfdJ}
\def^^da{\gcchar\gcfda}
\def^^db{\gcchar\gcfdb}
\def^^dc{\gcchar\gcfdc}
\def^^dd{\gcchar\gcfdd}
\def^^de{\gcchar\gcfde}
\def^^df{\gcchar\gcfdf}
\def^^e0{\gcchar\gcfeA}
\def^^e1{\gcchar\gcfeB}
\def^^e2{\gcchar\gcfeC}
\def^^e3{\gcchar\gcfeD}
\def^^e4{\gcchar\gcfeE}
\def^^e5{\gcchar\gcfeF}
\def^^e6{\gcchar\gcfeG}
\def^^e7{\gcchar\gcfeH}
\def^^e8{\gcchar\gcfeI}
\def^^e9{\gcchar\gcfeJ}
\def^^ea{\gcchar\gcfea}
\def^^eb{\gcchar\gcfeb}
\def^^ec{\gcchar\gcfec}
\def^^ed{\gcchar\gcfed}
\def^^ee{\gcchar\gcfee}
\def^^ef{\gcchar\gcfef}
\def^^f0{\gcchar\gcffA}
\def^^f1{\gcchar\gcffB}
\def^^f2{\gcchar\gcffC}
\def^^f3{\gcchar\gcffD}
\def^^f4{\gcchar\gcffE}
\def^^f5{\gcchar\gcffF}
\def^^f6{\gcchar\gcffG}
\def^^f7{\gcchar\gcffH}
\def^^f8{\gcchar\gcffI}
% \def^^f9{\gcchar\gcffJ}
% \def^^fa{\gcchar\gcffa}
% \def^^fb{\gcchar\gcffb}
% \def^^fc{\gcchar\gcffc}
% \def^^fd{\gcchar\gcffd}
% \def^^fe{\gcchar\gcffe}
}
\gcinactive
%
% define macros to begin and end a group which may contain
% GB coded Chinese characters
%
\def\beginchinese{\begingroup\gcactive\gcdefine}
%
\def\endchinese{\gcinactive\endgroup}
%
