%
\catcode`@=11
\let\@dump\dump
\let\dump\relax
\input latex.ltx
\input multexbase.tex

%% addtion/modification of latex
%%
\makeatletter

% ltlogos
%
\DeclareRobustCommand{\JTeX}{\leavevmode\lower.5ex\hbox{J}\kern-.18em\TeX}
\DeclareRobustCommand{\JLaTeX}{\leavevmode\lower.5ex\hbox{\rm J}\kern-.1em
    \LaTeX}
\DeclareRobustCommand{\JLaTeXe}{\leavevmode\lower.5ex\hbox{\rm J}\kern-.1em
    \LaTeXe}
\DeclareRobustCommand{\MuLTeX}{\leavevmode M\kern-.1667em u\kern-.1667em
    \lower.5ex\hbox{L}\kern-.25em\TeX}
\DeclareRobustCommand{\MuLLaTeX}{\leavevmode M\kern-.1667em u\kern-.1667em
    \lower.5ex\hbox{L}\kern-.1em\LaTeX}
\DeclareRobustCommand{\MuLLaTeXe}{\leavevmode M\kern-.1667em u\kern-.1667em
    \lower.5ex\hbox{L}\kern-.1em\LaTeXe}

% ltfssbas
% redefine \DeclareFixedFont
\def\DeclareFixedFont#1#2#3#4#5#6{%
   \begingroup
      \math@fontsfalse
      \every@math@size{}%
      \fontsize{#6}\z@
      \usefont{#2}{#3}{#4}{#5}%
      \expandafter\ifx\csname JTcs@#2\endcsname\relax
        \global\expandafter\let\expandafter#1\the\font
      \else
        \global\expandafter\let\expandafter#1\jfont@name
      \fi
   \endgroup
  }
\DeclareRobustCommand\jfontencoding[1]{%
    \expandafter\ifx\csname T@#1\endcsname\relax
      \@latex@error{Encoding scheme `#1' unknown}\@eha
    \else
      \edef\jp@encoding{#1}%
      \expandafter\def\csname JTcs@#1\endcsname{jp}%
    \fi
}
\DeclareRobustCommand\jfontfamily[1]{\edef\jp@family{#1}}
\DeclareRobustCommand\jfontseries[1]{\edef\jp@series{#1}}
\DeclareRobustCommand\jfontshape [1]{\edef\jp@shape{#1}}
\let\jp@encoding\@empty
\let\jp@family\@empty
\let\jp@series\@empty
\let\jp@shape\@empty

% re-define \usefont
\def\usefont#1#2#3#4{%
\expandafter\ifx\csname JTcs@#1\endcsname\relax
  \fontencoding{#1}\fontfamily{#2}\fontseries{#3}\fontshape{#4}\selectafont
\else
  \jfontencoding{#1}\jfontfamily{#2}\jfontseries{#3}\jfontshape{#4}\selectjfont
\fi
\ignorespaces}

\def\pickup@jfont{%
    \expandafter \ifx \jfont@name \relax
       \define@newjfont
    \fi}
\def\define@newjfont{%
  \begingroup
    \let\typeout\@font@info
    \escapechar\m@ne
    \expandafter\expandafter\expandafter
       \split@name\expandafter\string\jfont@name\@nil
      \try@load@fontshape % try always
    \expandafter\ifx
       \csname\curr@fontshape\endcsname \relax
      \wrong@jfontshape\else
      \extract@jfont\fi
  \endgroup}
\def\DeclareErrorJFont#1#2#3#4#5{%
      \xdef\error@jfontshape{%
          \noexpand\expandafter\noexpand\split@name\noexpand\string
          \expandafter\noexpand\csname#1/#2/#3/#4/#5\endcsname
          \noexpand\@nil}%
      \gdef\jpdefault@family{#2}%
      \gdef\jpdefault@series{#3}%
      \gdef\jpdefault@shape{#4}%
      \global\let\jp@family\jpdefault@family
      \global\let\jp@series\jpdefault@series
      \global\let\jp@shape\jpdefault@shape
}
\@onlypreamble\DeclareErrorJFont
\def\wrong@jfontshape{%
    \csname D@\f@encoding\endcsname      % install defaults if in math
    \edef\reserved@a{\csname\curr@fontshape\endcsname}%
  \ifx\last@jfontshape\reserved@a
     \errmessage{Corrupted NFSS tables}%
     \error@jfontshape
  \else
    \let\f@shape\jpdefault@shape
    \expandafter\ifx\csname\curr@fontshape\endcsname\relax
       \let\f@series\jpdefault@series
        \expandafter
          \ifx\csname\curr@fontshape\endcsname\relax
           \let\f@family\jpdefault@family
        \fi \fi
  \fi
     \@font@warning{Font shape `\expandafter\string\reserved@a'
                     \expandafter\@gobble\string\@undefined\MessageBreak
                   using `\curr@fontshape' instead\@wrong@font@char}%
    \global\let\last@jfontshape\reserved@a
    \gdef\@defaultsubs{%
      \@font@warning{Some font shapes were not available, defaults
                      substituted.\@gobbletwo}}%
    \global\expandafter\expandafter\expandafter\let
       \expandafter\reserved@a
           \csname\curr@fontshape\endcsname
    \xdef\jfont@name{\expandafter\noexpand
      \csname\curr@fontshape/\f@size\endcsname}%
    \pickup@jfont}

\def\extract@jfont{%
   \get@external@jfont
   \global\expandafter\font\jfont@name\external@font\relax
   \global\expandafter\fontmcs\jfont@name\mcsjp
    \jfont@name \relax
    \csname \f@encoding+\f@family\endcsname
    \csname\curr@fontshape\endcsname
    \relax
       }
\def\get@external@jfont{%
   \let\external@font\@empty
   \edef\font@info{\expandafter\expandafter\expandafter\string
        \csname \curr@fontshape \endcsname}%
   \try@size@range
   \ifx\external@font\@empty
      \try@size@substitution
      \ifx\external@font\@empty
         \@latex@error{Font \expandafter \string\jfont@name\space
                     not found}\@eha
         \error@jfontshape
         \get@external@jfont
   \fi\fi
}

% ltfsstrc
% re-define \selectfont
\DeclareRobustCommand\selectfont
        {%
    \ifx\f@linespread\baselinestretch \else
      \set@fontsize\baselinestretch\f@size\f@baselineskip \fi
    \selectafont \selectjfont
    \size@update
    \enc@update
    }
\def\selectafont{%
    \xdef\font@name{%
      \csname\curr@fontshape/\f@size\endcsname}%
    \pickup@font
    \font@name}
\def\selectjfont{%
    \xdef\jfont@name{\expandafter\noexpand
      \csname\jp@encoding/\jp@family/\jp@series/\jp@shape/\f@size\endcsname}%
    \pickup@jfont
    \jfont@name}

\DeclareRobustCommand\rmfamily
        {\not@math@alphabet\rmfamily\mathrm
         \fontfamily\rmdefault\jfontfamily\jrmdefault\selectfont}
\DeclareRobustCommand\sffamily
        {\not@math@alphabet\sffamily\mathsf
         \fontfamily\sfdefault\jfontfamily\jsfdefault\selectfont}
\DeclareRobustCommand\ttfamily
        {\not@math@alphabet\ttfamily\mathtt
         \fontfamily\ttdefault\jfontfamily\jttdefault\selectfont}
\DeclareRobustCommand\bfseries
        {\not@math@alphabet\bfseries\mathbf
         \fontseries\bfdefault\jfontseries\jbfdefault\selectfont}
\DeclareRobustCommand\mdseries
        {\not@math@alphabet\mdseries\relax
         \fontseries\mddefault\jfontseries\jmddefault\selectfont}
\DeclareRobustCommand\upshape
        {\not@math@alphabet\upshape\relax
         \fontshape\updefault\jfontshape\jupdefault\selectfont}
\DeclareRobustCommand\slshape
        {\not@math@alphabet\slshape\relax
         \fontshape\sldefault\jfontshape\jsldefault\selectfont}
\DeclareRobustCommand\scshape
        {\not@math@alphabet\scshape\relax
         \fontshape\scdefault\jfontshape\jscdefault\selectfont}
\DeclareRobustCommand\itshape
        {\not@math@alphabet\itshape\mathit
         \fontshape\itdefault\jfontshape\jitdefault\selectfont}

\DeclareRobustCommand\normalfont
    {\fontencoding{\encodingdefault}\fontfamily{\familydefault}%
     \fontseries{\seriesdefault}\fontshape{\shapedefault}%
     \jfontencoding{\jencodingdefault}\jfontfamily{\jfamilydefault}%
     \jfontseries{\jseriesdefault}\jfontshape{\jshapedefault}%
     \selectfont}

\DeclareErrorJFont{JP}{dn}{m}{n}{10}  %%% don't modify this setting
                                      %%% overwrite it in jfontdef.cfg
                                      %%% if necessary
\InputIfFileExists{jfonttext.cfg}
           {\typeout{====================================^^J%
                     ^^J%
                      Local config file jfonttext.cfg used^^J%
                     ^^J%
                     ====================================}%
             \def\@addtofilelist##1{\xdef\@filelist{\@filelist,##1}}%
            }
           {\input{jfonttext.ltx}}

% ltclass
%
\def\documentstyle{%
  \makeatletter\input{jlatex209.def}\makeatother
  \documentclass}
%\def\NeedsJTeXFormat#1{%

%%
%% end of addtion/modification of latex

% in case charset other than Japanese is used
\def\mlbasefontnames{%
ltni10,ltnii10,ltniii10,ltniv10,ltnv10,%
crl10,grk10,hbw10,thai10,kana10,%
dm10,cn10,kr10,jsp10,bvi10,bvii10,%
viscl10,viscu10}
\allmlfonts{\tenml}{ten}{\mlbasefontnames}
\tenml

%
%
\input sitemlcode

\def\jmlfmtname{JMulLaTeX2e}%
\def\jmlfmtversion{1997/12/09}%

\let\dump\@dump
\makeatother
\dump
\endinput
