Michel Bovani found a bug in the CJK package (or rather a misfeature):
Font definition files which expect that its loading-settings (i.e.,
the last argument of \DeclareFontShape) are called only once haven't
worked correctly.  I haven't foreseen such a possibility, but some FD
files from the fourier package expect exactly this.

This is fixed now with a reimplementation of the \CJKbold mechanism.
CJK users, please test whether everything still works as expected!
I've appended a new version of CJK.sty.


    Werner


======================================================================


% This is the file CJK.sty of the CJK package
%   for using Asian logographs (Chinese/Japanese/Korean) with LaTeX2e
%
% created by Werner Lemberg <[EMAIL PROTECTED]>
%
% Version 4.7.0pre (31-Aug-2006)

% Copyright (C) 1994-2006  Werner Lemberg <[EMAIL PROTECTED]>
%
% This program 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 of the License, or
% (at your option) any later version.
%
% This program 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.
%
% You should have received a copy of the GNU General Public License
% along with this program in doc/COPYING; if not, write to the Free
% Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
% MA 02110-1301 USA

\NeedsTeXFormat{LaTeX2e}[2001/06/01]
\def\fileversion{4.6.0}
\def\filedate{2005/08/11}
\ProvidesPackage{CJK}[\filedate\space\fileversion]

\RequirePackage{MULEenc}

[EMAIL PROTECTED]@
[EMAIL PROTECTED]@false
[EMAIL PROTECTED]@true}

[EMAIL PROTECTED] \global
                       [EMAIL PROTECTED] \global
                       [EMAIL PROTECTED]  \global}
[EMAIL PROTECTED] \relax
                      [EMAIL PROTECTED] \global
                      [EMAIL PROTECTED]  \global}
[EMAIL PROTECTED] \relax
                       [EMAIL PROTECTED] \relax
                       [EMAIL PROTECTED]  \global}
[EMAIL PROTECTED] \relax
                             [EMAIL PROTECTED] \relax
                             [EMAIL PROTECTED]  \relax}

\ExecuteOptions{local}

\ProcessOptions


% we suppress any unwanted spaces produced by linefeeds.

\endlinechar [EMAIL PROTECTED]


% our input macro. For compatibility with ArabTeX, the catcode of `<'
%     is preserved.

[EMAIL PROTECTED]
  \makeatletter
  [EMAIL PROTECTED]< \the\catcode`<}
  \catcode`\< 12\relax
  \endlinechar [EMAIL PROTECTED]
  \input #1\relax
  \endlinechar `\^^M
  [EMAIL PROTECTED]
  \makeatother}


% our symbol macro. It honours the [EMAIL PROTECTED]@ flag (to be set in the .fd
%     files) for producing poor-man's bold fonts; if it is raised we print
%     the character three times with a small horizontal shift.
%
% The user commands to set and unset [EMAIL PROTECTED]@ are \CJKbold and
%     \CJKnormal respectively.
%
% \CJKboldshift defines the shift used to imitate bold fonts.

[EMAIL PROTECTED]@
[EMAIL PROTECTED]@true}
[EMAIL PROTECTED]@false}
\newcommand{\CJKboldshift}{0.015em}

\DeclareRobustCommand{\CJKsymbol}[1]{
  \symbol{#1}
  [EMAIL PROTECTED]@
    \hbox to \CJKboldshift{\hss\symbol{#1}}
    \hbox to \CJKboldshift{\hss\symbol{#1}}
  \fi}
\let\CJKpunctsymbol\CJKsymbol

% the same for HLaTeX which uses the ligature mechanism

\DeclareRobustCommand{\CJKsymbols}[2]{
  \char #1\char #2\relax
  [EMAIL PROTECTED]@
    \hbox to \CJKboldshift{\hss\char #1\char #2}
    \hbox to \CJKboldshift{\hss\char #1\char #2}
  \fi}


% the auxiliary macro [EMAIL PROTECTED] converts number #2 into a two-digit
%     hex string and assigns it globally to #1.

[EMAIL PROTECTED]
  {\count\z@ #2\relax
   \count\tw@ \count\z@
   \divide\count\z@ \sixt@@n

   \count@ \count\z@
   \multiply\count@ \sixt@@n
   \advance\count\tw@ -\count@

   \xdef#1{
     [EMAIL PROTECTED]@[EMAIL PROTECTED]@}}}}


% the auxiliary macro [EMAIL PROTECTED] converts number #2 into a four-digit
%     hex string and assigns it globally to #1.

[EMAIL PROTECTED]
  {\count\thr@@ #2\relax
   \count\tw@ \count\thr@@
   \divide\count\tw@ \sixt@@n
   [EMAIL PROTECTED] \count\tw@
   [EMAIL PROTECTED] \sixt@@n
   \count\z@ [EMAIL PROTECTED]
   \divide\count\z@ \sixt@@n

   \count@ \count\tw@
   \multiply\count@ \sixt@@n
   \advance\count\thr@@ -\count@
   \count@ [EMAIL PROTECTED]
   \multiply\count@ \sixt@@n
   \advance\count\tw@ -\count@
   \count@ \count\z@
   \multiply\count@ \sixt@@n
   [EMAIL PROTECTED] -\count@

   \xdef#1{
     [EMAIL PROTECTED]@}
     [EMAIL PROTECTED]@ne}
     [EMAIL PROTECTED]@}
     [EMAIL PROTECTED]@@}}}}


% with \CJKchar you can access a character directly at a low level:
%     the parameters are the first and the second byte of the CJK character
%     code. The second parameter will be ignored if you address one-byte
%     encoded characters in SJIS.
%
% the optional parameter selects the encoding (using \CJKenc).
%
% for Unicode characters you must select UTF-8 encoding (but enter real
%     Unicode values).
%
% you can enter character codes with or without the 8th bit set (GL or
%     GR form) except for SJIS, Bg5 and UTF-8 encodings.

\DeclareRobustCommand{\CJKchar}[3][]{
  [EMAIL PROTECTED]@true

   [EMAIL PROTECTED]
   [EMAIL PROTECTED] [EMAIL PROTECTED]
   \else
     [EMAIL PROTECTED] \CJK@@@enc
     \CJKenc{#1}
   \fi

   [EMAIL PROTECTED]
   [EMAIL PROTECTED] \CJK@@@enc
     \Unicode{#2}{#3}
   \else
     [EMAIL PROTECTED] #2
     [EMAIL PROTECTED]
     [EMAIL PROTECTED] [EMAIL PROTECTED]            % test for one-byte SJIS 
characters
     \else
       [EMAIL PROTECTED] #3
       \ifnum [EMAIL PROTECTED] > 160\relax
         [EMAIL PROTECTED] < 128\relax
           [EMAIL PROTECTED] 128\relax
           [EMAIL PROTECTED] 128\relax
         \fi
       \fi
       [EMAIL PROTECTED]@tempcntb}
     \fi

     [EMAIL PROTECTED]@tempcnta}
     \expandafter\csname [EMAIL PROTECTED]@temp\expandafter\endcsname
      [EMAIL PROTECTED]
   \fi

   [EMAIL PROTECTED] [EMAIL PROTECTED]
   \else
     [EMAIL PROTECTED] \global
       [EMAIL PROTECTED]
     \fi
   \fi}

  [EMAIL PROTECTED]


% with \Unicode you can access a Unicode character directly at a low level:
%     the parameters are the first and the second byte of the Unicode (real
%     Unicode values, not UTF-8).
%
%     If the Unicode value is greater than U+FFFF, put the first two bytes
%     into #1, and the third byte into #2.

\DeclareRobustCommand{\Unicode}[2]{
  [EMAIL PROTECTED]
   [EMAIL PROTECTED] \CJK@@@enc
   \else
     \PackageError{CJK}{
       You can't use \protect\Unicode\space here}{
       You must activate UTF-8 encoding to use \protect\Unicode.}
   \fi
   \ifnum #1 > 255\relax
     [EMAIL PROTECTED]@gtemp}{#1}
   \else
     [EMAIL PROTECTED]@gtemp}{#1}
   \fi
   [EMAIL PROTECTED]
     [EMAIL PROTECTED]
   [EMAIL PROTECTED]@gtemp}
   [EMAIL PROTECTED]@[EMAIL PROTECTED]@shape}

   [EMAIL PROTECTED]@
     \CJKsymbol{#2}
   \else
     [EMAIL PROTECTED]@uniPunct
      [EMAIL PROTECTED]
     [EMAIL PROTECTED]                                   % punctuation character
       [EMAIL PROTECTED]@gtemp}{#2}
       [EMAIL PROTECTED]
       \ifCJK@
         [EMAIL PROTECTED]@@@[EMAIL PROTECTED]@gtemp}
         \ifCJK@
           [EMAIL PROTECTED]@
             [EMAIL PROTECTED]
           \fi
         \else
           [EMAIL PROTECTED]@
             \discretionary{}{}{}
           \else
             \CJKglue
           \fi
         \fi
       \fi
       [EMAIL PROTECTED]@
         [EMAIL PROTECTED]
         \ifCJK@
           [EMAIL PROTECTED]
         \fi
       \fi

       \CJKsymbol{#2}

       [EMAIL PROTECTED]@@@[EMAIL PROTECTED]@gtemp}
       \ifCJK@
         [EMAIL PROTECTED]
       \else
         [EMAIL PROTECTED]
       \fi
     \else%                                     % not a punctuation character
       [EMAIL PROTECTED]
       \ifCJK@
         [EMAIL PROTECTED]@
           \discretionary{}{}{}
         \else
           \CJKglue
         \fi
       \fi
       [EMAIL PROTECTED]@
         [EMAIL PROTECTED]
         \ifCJK@
           [EMAIL PROTECTED]
         \fi
       \fi
       \CJKsymbol{#2}
       [EMAIL PROTECTED]
     \fi
   \fi}

  [EMAIL PROTECTED]


% the following commands are needed for UTF-8 encoding to select the proper
%     intercharacter glue.

[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@

\newcommand{\CJKCJKchar}{
  [EMAIL PROTECTED]@[EMAIL PROTECTED]
  [EMAIL PROTECTED]@[EMAIL PROTECTED]
  [EMAIL PROTECTED]@[EMAIL PROTECTED]

\newcommand{\CJKhangulchar}{
  [EMAIL PROTECTED]@[EMAIL PROTECTED]
  [EMAIL PROTECTED]@[EMAIL PROTECTED]
  [EMAIL PROTECTED]@[EMAIL PROTECTED]

\newcommand{\CJKlatinchar}{
  [EMAIL PROTECTED]@[EMAIL PROTECTED]
  [EMAIL PROTECTED]@[EMAIL PROTECTED]
  [EMAIL PROTECTED]@[EMAIL PROTECTED]

\CJKCJKchar


% the next commands control mapping of half-width katakana to full-width
%     glyphs within SJIS encoding.

[EMAIL PROTECTED]@

[EMAIL PROTECTED]@[EMAIL PROTECTED]

[EMAIL PROTECTED]@[EMAIL PROTECTED]

\CJKhwkatakana


% you will find the innermost routines of the macros defined above in the
%     xxx.chr files. These routines are
%
%         [EMAIL PROTECTED], [EMAIL PROTECTED],
%         [EMAIL PROTECTED], [EMAIL PROTECTED],
%         [EMAIL PROTECTED], [EMAIL PROTECTED],
%         [EMAIL PROTECTED], [EMAIL PROTECTED]    .


% we need to scan comma separated lists of character codes (represented as
%     hexadecimal strings), testing whether a particular character is in the
%     list. The macro [EMAIL PROTECTED] sets the flag \ifCJK@ globally if true.
%     Parameter #1 is the list, #2 the actual character code to test.
%
% see the documentation of the [EMAIL PROTECTED] macro in the doc package of
%     the standard LaTeX2e distribution for a detailed explanation of the
%     following tricky definitions.

\newif\ifCJK@

[EMAIL PROTECTED]@stop}

[EMAIL PROTECTED]
  [EMAIL PROTECTED],#2,[EMAIL PROTECTED]
    [EMAIL PROTECTED]
    [EMAIL PROTECTED]
    [EMAIL PROTECTED] [EMAIL PROTECTED]
      [EMAIL PROTECTED]
    \fi}
  [EMAIL PROTECTED],#1,#2,[EMAIL PROTECTED]


% lists defined in CJK.enc for plane yy with encoding xx are assigned to
%     global macros [EMAIL PROTECTED]@[EMAIL PROTECTED] and [EMAIL 
PROTECTED]@[EMAIL PROTECTED]

[EMAIL PROTECTED]
  \expandafter\gdef\csname [EMAIL PROTECTED]@[EMAIL PROTECTED]

[EMAIL PROTECTED]
  \expandafter\gdef\csname [EMAIL PROTECTED]@[EMAIL PROTECTED]


% the next two functions scan the lists of punctuation characters of a
%     particular plane which should not occur at the beginning or at the end
%     of a line. They will be used in the xxx.chr files. Parameters are the
%     encoding, the plane and the character to be tested. Again these macros
%     raise or lower [EMAIL PROTECTED]

[EMAIL PROTECTED]
  \expandafter\expandafter\expandafter
   [EMAIL PROTECTED]
   \expandafter\csname [EMAIL PROTECTED]@[EMAIL PROTECTED]
   \expandafter{#3}}

[EMAIL PROTECTED]
  \expandafter\expandafter\expandafter
   [EMAIL PROTECTED]
   \expandafter\csname [EMAIL PROTECTED]@[EMAIL PROTECTED]
   \expandafter{#3}}


% the macro \CJKenc changes the encoding inside of a CJK environment. It
%     always uses the fontencoding defined with \CJKfontenc (this
%     behaviour is intentionally different from the similar command pair
%     \CJKfamily and \CJKencfamily).

\DeclareRobustCommand{\CJKenc}[1]{
  \expandafter\ifx\csname [EMAIL PROTECTED]@fontenc\endcsname \relax
    \PackageError{CJK}{
      Encoding `#1' is not defined}{}
  \fi

  [EMAIL PROTECTED] [EMAIL PROTECTED]@fontenc\endcsname}

  \expandafter\ifx\csname [EMAIL PROTECTED]@temp @enc\endcsname \relax
    \PackageError{CJK}{
      Encoding [EMAIL PROTECTED]' is not defined}{}
  \else
    [EMAIL PROTECTED]@@@enc{#1}
    [EMAIL PROTECTED]
  \fi}

\edef\CJK@@@enc{}

% to change a fontencoding yyy for a specific encoding xxx say
%     \CJKfontenc{xxx}{yyy}. If you then change the encoding forth and back,
%     this fontencoding is still valid. You will need this command only in
%     cases where the fonts are not CJK-fontencoded, such as pmC or dnp
%     fontencodings.
%
% if you define a new encoding `foo', you *must* supply the command
%     `\CJKfontenc{foo}{}' (note the empty second parameter) since the
%     encoding existence test relies on this.

\DeclareRobustCommand{\CJKfontenc}[2]{
  [EMAIL PROTECTED]
   \csname [EMAIL PROTECTED]@fontenc\endcsname{#2}
  [EMAIL PROTECTED]

% \CJKfamily{xxx} selects the shape xxx for all encodings. It will override
%     \CJKencfamily, i.e., if you change the encoding, the family will be
%     the same. To reactivate \CJKencfamily, say `\CJKfamily{}'.
%
% For backward compatibility the macros \CJKshape and \CJKencshape are set
%     to \CJKfamily and \CJKencfamily, respectively.

\DeclareRobustCommand{\CJKfamily}[1]{
  [EMAIL PROTECTED]@globalfamily{#1}
  [EMAIL PROTECTED]

[EMAIL PROTECTED]

% to change a family for a specific encoding xxx (and a font encoding yyy),
%     use \CJKencfamily. If you then change the encoding forth and back,
%     this family is still valid. This macro is especially useful with
%     cjk-enc.el since it allows to change the encoding without the need to
%     select a (possibly different) family each time. See the various
%     encoding definitions in CJK.enc for the default values.
%
% note that it is equivalent to say \CJKencfamily[yyy]{xxx}{...} and
%     \CJKencfamily{xxxyyy}{...}.

\DeclareRobustCommand{\CJKencfamily}[3][]{
  [EMAIL PROTECTED]
   \csname [EMAIL PROTECTED]@family\endcsname{#3}
  [EMAIL PROTECTED]


\let\CJKshape \CJKfamily
\let\CJKencshape \CJKencfamily


% the next commands select the actual family and encoding.

[EMAIL PROTECTED]
  [EMAIL PROTECTED] [EMAIL PROTECTED]@@@enc @fontenc\endcsname}

  [EMAIL PROTECTED] [EMAIL PROTECTED]
    [EMAIL PROTECTED]@family{
     \csname [EMAIL PROTECTED]@@@[EMAIL PROTECTED] @family\endcsname}
  \else
    [EMAIL PROTECTED]@[EMAIL PROTECTED]
  \fi}


% \CJK@@@enc is the encoding selected by the user, [EMAIL PROTECTED] will be 
really
%     used. With the internal hook \CJK@@@[EMAIL PROTECTED] we can modify 
[EMAIL PROTECTED]
%     for the encoding xxx if necessary. With the hook [EMAIL PROTECTED]@hook 
other
%     packages can add stuff which should be executed immediately after the
%     encoding has changed.

[EMAIL PROTECTED]
  [EMAIL PROTECTED] [EMAIL PROTECTED]@@@enc @fontenc\endcsname}

  [EMAIL PROTECTED]@enc{
    \csname [EMAIL PROTECTED]@@@[EMAIL PROTECTED] @nfssenc\endcsname}
  \csname CJK@@@\CJK@@@[EMAIL PROTECTED] @hook\endcsname

  \csname [EMAIL PROTECTED]@@@[EMAIL PROTECTED] @enc\endcsname
  [EMAIL PROTECTED]
  \csname [EMAIL PROTECTED]@@@enc @hook\endcsname}

% and here the user-visible macro to add something to the encoding hook.
%     First parameter is the encoding, second parameter the data to be
%     appended.

\def\CJKaddEncHook#1#2{
  [EMAIL PROTECTED] \csname [EMAIL PROTECTED]@hook\endcsname
  [EMAIL PROTECTED]
   [EMAIL PROTECTED] #2}
  \expandafter\let\csname [EMAIL PROTECTED]@hook\endcsname [EMAIL PROTECTED]


% we disable [EMAIL PROTECTED] and [EMAIL PROTECTED] until a CJK environment
%     starts to avoid side effects while defining default values for
%     encodings (outside of a CJK environment).

[EMAIL PROTECTED] \relax
[EMAIL PROTECTED] \relax


% CJK.enc contains the [EMAIL PROTECTED]@enc macros and the punctuation lists.

\input CJK.enc


% the macros [EMAIL PROTECTED] and [EMAIL PROTECTED] check the last kern and
%     raise or lower [EMAIL PROTECTED]

[EMAIL PROTECTED] -2sp\kern 2sp}
[EMAIL PROTECTED] -1sp\kern 1sp}

\let\CJKkern [EMAIL PROTECTED]

% does previous CJK character request nonbreakable glue?

[EMAIL PROTECTED]
  [EMAIL PROTECTED]
  \ifnum\lastkern = \tw@
    [EMAIL PROTECTED]
  \fi
  \ifnum\lastkern = 5%                          % request from ruby.sty
    [EMAIL PROTECTED]
  \fi}

% is previous character a CJK character?

[EMAIL PROTECTED]
  [EMAIL PROTECTED]
  \ifnum\lastkern = [EMAIL PROTECTED]
    [EMAIL PROTECTED]
  \fi}


% we only check for lower and upper bounds, not for possible gaps in the
%     range of the second byte, as it happens for Big5 and SJIS encoding.

[EMAIL PROTECTED]
  \PackageError{CJK}{
    Invalid character code}{
    The second byte of the CJK code is out of range.\MessageBreak
    Do you use the right encoding scheme?}}

[EMAIL PROTECTED]
  \PackageError{CJK}{
    Invalid character code}{
    The third byte of the CJK code is out of range.\MessageBreak
    Do you use the right encoding scheme?}}

[EMAIL PROTECTED]
  \PackageError{CJK}{
    Invalid character code}{
    The CJK code is out of range for this font encoding.\MessageBreak
    Do you use the right encoding scheme?}}


% we now define a set of new size functions:
%     `CJK', `sCJK', `CJKfixed', and `sCJKfixed' are similar to `' (empty),
%     `s', `fixed', and `sfixed' except that the value of [EMAIL PROTECTED] is
%     appended to [EMAIL PROTECTED]
%
% `CJKsub', `CJKssub' are similar to `sub' and `ssub' except that the font
%     substitution warning appears only once per CJK fontset.
%
% `CJKb', `sCJKb', `CJKfixedb', and `sCJKfixedb' are absolutely identical
%     to the functions without the final `b'; they just exist to overcome
%     a special feature of LaTeX:
%
%     consider this example:
%
%       \DeclareFontShape{C00}{kai}{m}{n}{<-> CJK * ntukai}{}
%       \DeclareFontShape{C00}{kai}{bx}{n}{<-> CJK * ntukai}{\CJKbold}
%
%     the internal name of the macro which executes the last parameter
%     (\CJKbold) is identical to the fifth parameter (without spaces), in
%     this case `<->CJK*ntukai' -- the same name for both font shapes! This
%     means that the latter font shape definition overwrites the former.
%     Thus we have to write
%
%       \DeclareFontShape{C00}{kai}{bx}{n}{<-> CJKb * ntukai}{\CJKbold}
%
%     to get a different internal macro name.

[EMAIL PROTECTED]@[EMAIL PROTECTED]@encoding/[EMAIL PROTECTED]/[EMAIL 
PROTECTED]/[EMAIL PROTECTED]

[EMAIL PROTECTED]@[EMAIL PROTECTED]
[EMAIL PROTECTED]@[EMAIL PROTECTED]
[EMAIL PROTECTED]@[EMAIL PROTECTED]
[EMAIL PROTECTED]@[EMAIL PROTECTED]

[EMAIL PROTECTED]
  [EMAIL PROTECTED] [EMAIL PROTECTED]@
  [EMAIL PROTECTED] [EMAIL PROTECTED]
  \else
    \expandafter\ifx
     \csname [EMAIL PROTECTED]@arg/[EMAIL PROTECTED]/[EMAIL PROTECTED] \relax
      [EMAIL PROTECTED] [EMAIL PROTECTED]@tempdimb
      #1{Font\space shape\space [EMAIL PROTECTED]'\space
         will\space be\MessageBreak
         scaled\space to\space size\space [EMAIL PROTECTED]
      \expandafter
       \gdef\csname [EMAIL PROTECTED]@arg/[EMAIL PROTECTED]/[EMAIL PROTECTED]
    \fi
  \fi
  [EMAIL PROTECTED]
    [EMAIL PROTECTED]@plane\space at [EMAIL PROTECTED]
  [EMAIL PROTECTED]
    \csname [EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]
  \expandafter\global\expandafter\let
   \csname [EMAIL PROTECTED]@fontshape\expandafter\endcsname
    \csname [EMAIL PROTECTED]

[EMAIL PROTECTED]@[EMAIL PROTECTED]
[EMAIL PROTECTED]@[EMAIL PROTECTED]
[EMAIL PROTECTED]@[EMAIL PROTECTED]
[EMAIL PROTECTED]@[EMAIL PROTECTED]

[EMAIL PROTECTED]
  [EMAIL PROTECTED] [EMAIL PROTECTED]
    [EMAIL PROTECTED]
      [EMAIL PROTECTED]@plane}
  \else
    [EMAIL PROTECTED]
      [EMAIL PROTECTED]@plane\space at [EMAIL PROTECTED] pt}
  \fi
  [EMAIL PROTECTED]
    \csname [EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]
  #1{External\space font\space [EMAIL PROTECTED]'\space loaded\space
     for\space size\MessageBreak
     <[EMAIL PROTECTED]>}
  \expandafter\global\expandafter\let
   \csname [EMAIL PROTECTED]@fontshape\expandafter\endcsname
    \csname [EMAIL PROTECTED]

[EMAIL PROTECTED]@[EMAIL PROTECTED]
[EMAIL PROTECTED]@[EMAIL PROTECTED]

[EMAIL PROTECTED]
  [EMAIL PROTECTED]@encoding/[EMAIL PROTECTED]
  \begingroup
    [EMAIL PROTECTED]@arg/[EMAIL PROTECTED]
    [EMAIL PROTECTED]@fontshape
  \endgroup
  [EMAIL PROTECTED]@[EMAIL PROTECTED]
  [EMAIL PROTECTED] \relax
    \errmessage{No\space declaration\space for\space shape\space
                [EMAIL PROTECTED]
    [EMAIL PROTECTED]
  \else
    \expandafter\ifx\csname [EMAIL PROTECTED]@arg/[EMAIL PROTECTED] \relax
      #1{Font\space shape\space [EMAIL PROTECTED]'\MessageBreak
         in\space size\space <[EMAIL PROTECTED]>\space not\space 
available.\MessageBreak
         Font\space shape\space [EMAIL PROTECTED]'\MessageBreak
         tried\space instead}
      \expandafter\gdef\csname [EMAIL PROTECTED]@arg/[EMAIL PROTECTED]
    \fi
    [EMAIL PROTECTED]@arg/[EMAIL PROTECTED]
  \fi
  [EMAIL PROTECTED]@[EMAIL PROTECTED]
  [EMAIL PROTECTED]@font
  [EMAIL PROTECTED]@correction
  \expandafter\global\expandafter\let
   \csname [EMAIL PROTECTED]@fontshape\expandafter\endcsname
    \csname [EMAIL PROTECTED]

% the following size functions are needed for the DNP fonts in JIS encoding.
%     `DNPgen' is similar to `gen' but ignores the optional argument.
%     `DNP' is similar to `gen' but the optional argument is used to
%     indicate the designsize.
%
% see the comment above for an explanation of DNPb and DNPgenb.

[EMAIL PROTECTED]
[EMAIL PROTECTED]

[EMAIL PROTECTED]
  [EMAIL PROTECTED]
    [EMAIL PROTECTED]@[EMAIL PROTECTED]
  [EMAIL PROTECTED]
    \csname [EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]
  \expandafter\global\expandafter\let
   \csname [EMAIL PROTECTED]@fontshape\expandafter\endcsname
    \csname [EMAIL PROTECTED]

[EMAIL PROTECTED]
[EMAIL PROTECTED]

[EMAIL PROTECTED]
  [EMAIL PROTECTED] [EMAIL PROTECTED]@
  [EMAIL PROTECTED]
    [EMAIL PROTECTED]@[EMAIL PROTECTED] at [EMAIL PROTECTED]
  [EMAIL PROTECTED]
    \csname [EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]
  \expandafter\global\expandafter\let
   \csname [EMAIL PROTECTED]@fontshape\expandafter\endcsname
    \csname [EMAIL PROTECTED]


% we also must redefine [EMAIL PROTECTED] to append [EMAIL PROTECTED] to the 
font name
%     if the particular subfont is already known.

[EMAIL PROTECTED]
  [EMAIL PROTECTED]@plane}
    [EMAIL PROTECTED] \relax%         % old definition
       [EMAIL PROTECTED]
     \fi}
    {\expandafter%                              % CJK extension
      \ifx\csname [EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED] \relax
       [EMAIL PROTECTED]
     \else
       [EMAIL PROTECTED]
         \csname [EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]
     \fi}}

% the other LaTeX2e command we must redefine is \selectfont. It will
%     now reset [EMAIL PROTECTED]@ and calls [EMAIL PROTECTED]@fontshape 
additionally
%     (if it exists) to execute the loading-setting parameter of
%     \DeclareFontShape each time we switch to this font.
%     [EMAIL PROTECTED]@fontshape has been defined by the above size functions.

\DeclareRobustCommand{\selectfont}{
  [EMAIL PROTECTED] \baselinestretch
  \else
    [EMAIL PROTECTED]@[EMAIL PROTECTED]
  \fi
  [EMAIL PROTECTED]@fontshape/[EMAIL PROTECTED]
  [EMAIL PROTECTED]
  [EMAIL PROTECTED]
  \expandafter%                                 % CJK extension
   \ifx\csname [EMAIL PROTECTED]@fontshape\endcsname \relax
  \else
    [EMAIL PROTECTED]@false
    \csname [EMAIL PROTECTED]@fontshape\endcsname
  \fi
  [EMAIL PROTECTED]
  [EMAIL PROTECTED]


% additional vertical and horizontal information for a font is stored in
%     files with the extension `.fdx'.  We extend LaTeX's
%     [EMAIL PROTECTED]@fontshape@ macro to load them.
%
% the macros \CJKhdef, \CJKvdef, \CJKhlet and \CJKvlet should be used to
%     handle commands in `.fdx' files.

[EMAIL PROTECTED]@fdx{
  \expandafter\ifx\csname [EMAIL PROTECTED]@family+x\endcsname \relax
    \global\expandafter\let\csname [EMAIL PROTECTED]@family+x\endcsname [EMAIL 
PROTECTED]
    \def\CJKhdef##1##2{
      \expandafter\gdef\csname [EMAIL PROTECTED]/[EMAIL 
PROTECTED]/##1/h\endcsname{##2}}
    \def\CJKhlet##1##2{
      [EMAIL PROTECTED]@enc/[EMAIL PROTECTED]/##1/h}
      [EMAIL PROTECTED]@enc/[EMAIL PROTECTED]/##2/h}
      \global\expandafter\let
       [EMAIL PROTECTED] [EMAIL PROTECTED]
    \def\CJKvdef##1##2{
      \expandafter\gdef\csname [EMAIL PROTECTED]/[EMAIL 
PROTECTED]/##1/v\endcsname{##2}}
    \def\CJKvlet##1##2{
      [EMAIL PROTECTED]@enc/[EMAIL PROTECTED]/##1/v}
      [EMAIL PROTECTED]@enc/[EMAIL PROTECTED]/##2/v}
      \global\expandafter\let
       [EMAIL PROTECTED] [EMAIL PROTECTED]
    [EMAIL PROTECTED]
      [EMAIL PROTECTED]@family.fdx}}}
    [EMAIL PROTECTED]
  \fi}

[EMAIL PROTECTED]@fontshape\expandafter{
  [EMAIL PROTECTED]@fontshape
  [EMAIL PROTECTED]@fdx}


% \CJKglue defines the stretchability of CJK characters.

\newcommand{\CJKglue}{\hskip \z@ [EMAIL PROTECTED] .08\baselineskip}

[EMAIL PROTECTED]
  \nobreak
  \CJKglue
  \nobreak}

% if the `verbatim' package is loaded it is possible to improve the output
%     automatically, namely, to avoid breaking of overfull lines in a
%     verbatim environment. The following command will install a hook to
%     suppress insertion of glue between CJK glyphs. MULEenc.sty will extend
%     it for Thai glyphs.

[EMAIL PROTECTED]
  [EMAIL PROTECTED]@verbatim}{
    \renewcommand{\CJKglue}{}}}
[EMAIL PROTECTED]@verbatim}
  [EMAIL PROTECTED]
  {}

\def\CJKverbatim{
  [EMAIL PROTECTED]
  [EMAIL PROTECTED]


% increasing \CJKtolerance will allow more space between Hangul words.

\newcommand{\CJKtolerance}{400}


% \CJKtilde changes the definition of the active `~' character to embed
%     non-CJK words into CJK text. The horizontal space defined here has
%     a smaller width than an ordinary space character and is breakable.
%     It will suppress spaces afterwards.
%     The original definition will be preserved within \nbs, which is
%     a shorthand for the LaTeX command \nobreakspace.
%
% \standardtilde is the opposite command.

\let\nbs \nobreakspace

\newcommand{\CJKtilde}{
  [EMAIL PROTECTED] plus 0.125em minus 0.08em}\ignorespaces}}
\newcommand{\standardtilde}{
  [EMAIL PROTECTED]


% \CJKspace and \CJKnospace enables the user to switch between a CJK and a
%     CJK* environment without leaving the actual environment:
%
%     \CJKnospace switches from CJK to CJK*
%     \CJKspace switches from CJK* to CJK
%
% the definitions are in MULEenc.sty also.

\providecommand{\CJKspace}{
  [EMAIL PROTECTED]@ignorespaces [EMAIL PROTECTED]
\providecommand{\CJKnospace}{
  [EMAIL PROTECTED]@ignorespaces \ignorespaces}


% \CJKindent sets \parindent to two ideographic spaces. [EMAIL PROTECTED]
%     is defined in CJK.enc for all encodings.

[EMAIL PROTECTED]

\providecommand{\CJKindent}{
  [EMAIL PROTECTED]@[EMAIL PROTECTED]
  [EMAIL PROTECTED]
}


% make all characters possibly used as the first byte active so they can
%     become macros.

[EMAIL PROTECTED]
  [EMAIL PROTECTED] "081\relax
  \loop
    [EMAIL PROTECTED]@tempcnta \active
    [EMAIL PROTECTED] < "0FE\relax
      [EMAIL PROTECTED] [EMAIL PROTECTED]
  \repeat}

[EMAIL PROTECTED]
  [EMAIL PROTECTED] "081\relax
  \loop
    [EMAIL PROTECTED]@tempcnta 12\relax
    [EMAIL PROTECTED] < "0FE\relax
      [EMAIL PROTECTED] [EMAIL PROTECTED]
  \repeat}


% we assign to each active character ^^xx the macro [EMAIL PROTECTED] (if 
expansion
%     occurs); this will be done in the .bdg files. Then the various .enc
%     files define [EMAIL PROTECTED] (using [EMAIL PROTECTED]) with 
encoding-specific
%     macros.

[EMAIL PROTECTED]
  [EMAIL PROTECTED]
    \ifx\protect [EMAIL PROTECTED]@protect
      \string #1
    \else
      \noexpand #1
    \fi}}

[EMAIL PROTECTED]
  [EMAIL PROTECTED]
    \ifx\protect [EMAIL PROTECTED]@protect
      [EMAIL PROTECTED]
       \expandafter\string\expandafter#1
    \else
      \noexpand #1
    \fi}}

[EMAIL PROTECTED]
  [EMAIL PROTECTED]
    \ifx\protect [EMAIL PROTECTED]@protect
      [EMAIL PROTECTED]
       \expandafter\string\expandafter#1
    \else
      \noexpand #1
    \fi}}

[EMAIL PROTECTED]
  [EMAIL PROTECTED]
    \ifx\protect [EMAIL PROTECTED]@protect
      [EMAIL PROTECTED]
       \expandafter\string\expandafter#1
    \else
      \noexpand #1
    \fi}}

[EMAIL PROTECTED]
  [EMAIL PROTECTED]
    \ifx\protect [EMAIL PROTECTED]@protect
      [EMAIL PROTECTED]
       \expandafter\string\expandafter#1
    \else
      \noexpand #1
    \fi}}


[EMAIL PROTECTED]
  \csname [EMAIL PROTECTED] [EMAIL PROTECTED]

% two possibilities:
%     either [EMAIL PROTECTED] <arg1> <arg2>
%     or     [EMAIL PROTECTED] <arg1> \protect <arg2>
[EMAIL PROTECTED]
  \ifx #2\protect
    [EMAIL PROTECTED]
  \else
    \csname [EMAIL PROTECTED] [EMAIL PROTECTED]
  \fi}
[EMAIL PROTECTED]
  \csname [EMAIL PROTECTED] [EMAIL PROTECTED]

% two possibilities:
%     either [EMAIL PROTECTED] <arg1> <arg2> <arg3>
%     or     [EMAIL PROTECTED] <arg1> \protect <arg2> \protect <arg3>
[EMAIL PROTECTED]
  \ifx #2\protect
    [EMAIL PROTECTED]
  \else
    \csname [EMAIL PROTECTED] [EMAIL PROTECTED]
  \fi}
[EMAIL PROTECTED]
  \csname [EMAIL PROTECTED] [EMAIL PROTECTED]

% two possibilities:
%     either [EMAIL PROTECTED] <arg1> <arg2> <arg3> <arg4>
%     or     [EMAIL PROTECTED] <arg1> \protect <arg2> \protect <arg3> \protect 
<arg4>
[EMAIL PROTECTED]
  \ifx #2\protect
    [EMAIL PROTECTED]
  \else
    \csname [EMAIL PROTECTED] [EMAIL PROTECTED]
  \fi}
[EMAIL PROTECTED]
  \csname [EMAIL PROTECTED] [EMAIL PROTECTED]


% these auxiliary macros reset \lccode's and \uccode's of characters
%     0x80-0xFF. This overrides the values set by LaTeX2e.

[EMAIL PROTECTED]
  [EMAIL PROTECTED] "080\relax
  \loop
    [EMAIL PROTECTED]@tempcnta \z@
    [EMAIL PROTECTED] < "0FF\relax
      [EMAIL PROTECTED] [EMAIL PROTECTED]
  \repeat}

[EMAIL PROTECTED]
  [EMAIL PROTECTED] "080\relax
  \loop
    [EMAIL PROTECTED]@tempcnta \z@
    [EMAIL PROTECTED] < "0FF\relax
      [EMAIL PROTECTED] [EMAIL PROTECTED]
  \repeat}


% finally come the CJK environments:
%
% CJK* will swallow spaces after a CJK character, whereas CJK will not.
%
% the first parameter selects the CJK encoding, the second the CJK font
%     family; the optional argument selects the fontencoding.
%
% each time a CJK or CJK* environment will be opened the hook \CJKhook will
%     be called (this feature is used by cjk-enc.el).
%
% always end the line after saying \begin{CJK} or \begin{CJK*};
%     any characters on the same line will have already been read with
%     their non-CJK meanings.

[EMAIL PROTECTED]
  [EMAIL PROTECTED]
  [EMAIL PROTECTED]@
    [EMAIL PROTECTED]
  \fi

  [EMAIL PROTECTED]

  % we enable [EMAIL PROTECTED] and [EMAIL PROTECTED]

  [EMAIL PROTECTED]@selectFamily [EMAIL PROTECTED]
  [EMAIL PROTECTED]@selectEnc [EMAIL PROTECTED]

  \def\CJK@@@enc{#2}
  \ifx\CJK@@@enc [EMAIL PROTECTED]
    \PackageInfo{CJK}{
      no encoding parameter given,\MessageBreak
      waiting for \protect\CJKenc\space commands}
  \else
    \CJKenc{#2}
  \fi
  \CJKfontenc{#2}{#1}
  \CJKfamily{#3}
  [EMAIL PROTECTED]@series}
  [EMAIL PROTECTED]@shape}

  \csname CJKhook\endcsname}

[EMAIL PROTECTED]
  [EMAIL PROTECTED] \global
    [EMAIL PROTECTED]
    [EMAIL PROTECTED]@selectFamily \relax
    [EMAIL PROTECTED]@selectEnc \relax
  \fi}

\newenvironment{CJK}[3][]{
  \CJKspace
  [EMAIL PROTECTED]
 }{
  [EMAIL PROTECTED]

\newenvironment{CJK*}[3][]{
  \CJKnospace
  [EMAIL PROTECTED]
 }{
  [EMAIL PROTECTED]


% \CJKcaption{caption} will test whether we are in a CJK environment; if yes,
%     it tries to load `<caption>.cpx' (this is <caption>.cap in preprocessed
%     mode).

\newcommand{\CJKcaption}[1]{
  [EMAIL PROTECTED] [EMAIL PROTECTED]
    \PackageError{CJK}{
      You must be inside of a CJK environment to use \protect\CJKcaption}{}
  \else
    \makeatletter
    \InputIfFileExists{#1.cpx}{}{
      \PackageError{CJK}{
        Can't find #1.cpx}{
        The default captions are used if you continue.}}
    \makeatother
  \fi}


% the writing direction.

[EMAIL PROTECTED]


% reset endline character.

\endlinechar `\^^M


% in case some customization is necessary it should be done in the
%     configuration file `CJK.cfg' and *not* here.

\InputIfFileExists{CJK.cfg}
  {\typeout{^^J
            *****************************************^^J
            * Local configuration file CJK.cfg used *^^J
            *****************************************^^J}}
  {}


\endinput

_______________________________________________
Cjk maillist  -  [email protected]
http://lists.ffii.org/mailman/listinfo/cjk

Reply via email to