%%
%%  hlatex.ltx   Hangul (Korean) LaTeX2e (hLaTeXn or hLaTeXp)
%%               1996/01/14 version
%%               (LaTeX2e <1995/12/01> or later version is necessary)
%%
%%               By Jae Choon Cha
%%                  Department of Mathematics
%%                  Korea Advanced Institute of Science and Technology
%%
%%  Copyright (C) Jae Choon Cha. All Rights are reserved.
%%  You are not allowed to change this file.
%%  This file is part of hLaTeXp and hLaTeXn package. You are not allowed
%%  to distribute this file alone. This file should be distributed as part
%%  of hLaTeXp or hLaTeXn package of the author.
%%  This file (and any derivation) cannot be sold or distributed with
%%  any commercial product or used in any commercial organization without
%%  additional agreement with the author.
%%
%%  For suggestions and bug reports of UNCHANGED version, send e-mail to
%%  jccha@math.kaist.ac.kr.
%%
%% Input original LaTeX2e, without dump operation.
\let\originaldump\dump \let\dump\relax
\input latex.ltx
\let\dump\originaldump
\makeatletter
%
% Check version of non-localized LaTeX2e.
\@ifl@t@r\fmtversion{1995/12/01}{}{%
  \GenericError{\space}%
  {hLaTeX Dump Error: Too old non-localized LaTeX2e}%
  {\space\space Non-localized (standard) LaTeX2e 1995/12/01 version (or later) is required.}%
  {To dump hLaTeX, you need a non-localized (standard) version of LaTeX2e.^^J%
   This version of hLaTeX requires LaTeX2e 1995/12/01 version (or later),^^J%
   But you tried with \fmtversion\space version.^^J}}%
%%
\DeclareRobustCommand{\hLaTeX}{h\LaTeX}
\DeclareRobustCommand{\hLaTeXn}{h\LaTeX n}
\DeclareRobustCommand{\hLaTeXp}{h\LaTeX p}
\DeclareRobustCommand{\hTeXn}{h\TeX n}
\DeclareRobustCommand{\hTeXp}{h\TeX p}
%%
%% Input hLaTeXn and hLaTeXp specific code.
%% (format name, 2-byte characters, modifications of NFSS2)
\input hlatexp.ltx
%%
%% Protect 2-byte characters.
\def\set@display@protect{\let\protect\string\makedbcharstring}
%
\long\def\protected@write#1#2#3{%
      \begingroup
       \let\thepage\relax
       \makedbcharstring #2%
       \let\protect\@unexpandable@protect
       \edef\reserved@a{\write#1{#3}}%
       \reserved@a%
      \endgroup
      \if@nobreak\ifvmode\nobreak\fi\fi
}
%
\def\@verbatim{\trivlist \item\relax
  \if@minipage\else\vskip\parskip\fi
  \leftskip\@totalleftmargin\rightskip\z@skip
  \parindent\z@\parfillskip\@flushglue\parskip\z@skip
  \@@par
  \@tempswafalse
  \def\par{%
    \if@tempswa
      \leavevmode \null \@@par\penalty\interlinepenalty
    \else
      \@tempswatrue
      \ifhmode\@@par\penalty\interlinepenalty\fi
    \fi}%
  \obeylines \verbatim@font \@noligs
  \let\do\@makeother \dospecials \nohangulbreaking
  \everypar \expandafter{\the\everypar \unpenalty}%
}
%
\def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
  \bgroup \verbatim@font\@noligs
    \verb@eol@error \let\do\@makeother \dospecials
    \nohangulbreaking
    \@ifstar\@sverb\@verb}
%
\begingroup%
\gdef\filecontents{\@tempswatrue\filec@ntents}%
\catcode`\*=11 %
\gdef\filecontents*{\@tempswafalse\filec@ntents}%
\catcode`\^^M\active%
\catcode`\^^L\active\let^^L\relax%
\catcode`\^^I\active%
\gdef\filec@ntents#1{%
  \openin\@inputcheck#1 %
  \ifeof\@inputcheck%
    \@latex@warning@no@line%
        {Writing file `\@currdir#1'}%
    \chardef\verbatim@out15 %
    \ch@ck7\verbatim@out\write%
  \else%
    \closein\@inputcheck%
    \@latex@warning@no@line%
            {File `#1' already exists on the system.\MessageBreak%
             Not generating it from this source}%
    \def\immediate##1\relax{}%
  \fi%
  \immediate\openout\verbatim@out=#1\relax%
  \if@tempswa%
    \immediate\write\verbatim@out{%
      \@percentchar\@percentchar\space LaTeX2e file `#1'^^J%
      \@percentchar\@percentchar\space  generated by the %
         `filecontents' environment^^J%
      \@percentchar\@percentchar\space from source `\jobname' on %
         \number\year/\two@digits\month/\two@digits\day.^^J%
      \@percentchar\@percentchar}\relax%
  \fi%
  \let\do\@makeother\dospecials\makedbcharother%
  \@vwrend%
\catcode`\^^L\active%
\let\L\@undefined%
\def^^L{\@ifundefined L^^J^^J^^J}%
\catcode`\^^I\active%
\let\I\@undefined%
\def^^I{\@ifundefined I\space\space}%
  \catcode`\^^M\active%
  \def^^M##1^^M%
    {\def\reserved@b{##1}%
     \ifx\reserved@b\reserved@a%
       \expandafter\end\expandafter{\@currenvir}%
     \else%
       \immediate\write\verbatim@out{##1}\relax\expandafter^^M%
     \fi}}%
\endgroup%
%
\DeclareRobustCommand*{\ref}[1]{\begingroup\makedbcharstring
  \expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}\endgroup}
\DeclareRobustCommand*{\pageref}[1]{\begingroup\makedbcharstring
  \expandafter\@setref\csname r@#1\endcsname\@secondoftwo{#1}\endgroup}
\def\@newl@bel#1#2#3{\begingroup\makedbcharstring
  \@ifundefined{#1@#2}%
    \relax
    {\gdef \@multiplelabels {%
       \@latex@warning@no@line{There were multiply-defined labels}}%
     \@latex@warning@no@line{Label `#2' multiply defined}}%
  \global\@namedef{#1@#2}{#3}\endgroup}
%
\def\enddocument{%
   \@enddocumenthook
   \@checkend{document}%
   \clearpage
   \begingroup
     \if@filesw
       \immediate\closeout\@mainaux
       \let\@setckpt\@gobbletwo
       \let\@newl@bel\@testdef
       \@tempswafalse
       \makeatletter\makedbcharstring \input\jobname.aux \makedbcharactive
     \fi
     \@dofilelist
     \ifdim \font@submax >\fontsubfuzz\relax
       \@font@warning{Size substitutions with differences\MessageBreak
                  up to \font@submax\space have occured.\@gobbletwo}%
     \fi
     \@defaultsubs
     \@refundefined
     \if@filesw
       \ifx \@multiplelabels \relax
         \if@tempswa
           \@latex@warning@no@line{Label(s) may have changed.
               Rerun to get cross-references right}%
         \fi
       \else
         \@multiplelabels
       \fi
     \fi
   \endgroup
   \deadcycles\z@\@@end}
%
\def\@lbibitem[#1]#2{\item[\@biblabel{#1}\hfill]\if@filesw
      {\let\protect\noexpand\makedbcharstring
       \immediate
       \write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces}
\def\@bibitem#1{\item\if@filesw {\makedbcharstring
  \immediate\write\@auxout
  {\string\bibcite{#1}{\the\value{\@listctr}}}}\fi\ignorespaces}
\def\bibcite{\@newl@bel b}
\def\@citex[#1]#2{\begingroup\makedbcharstring
  \let\@citea\@empty
  \@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{,\penalty\@m\ }%
     \edef\@citeb{\expandafter\@iden\@citeb}%
     \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
     \@ifundefined{b@\@citeb}{\mbox{\reset@font\bfseries ?}%
       \G@refundefinedtrue
       \@latex@warning
         {Citation `\@citeb' on page \thepage \space undefined}}%
       {\hbox{\csname b@\@citeb\endcsname}}}}{#1}\endgroup}
%
\def\markboth#1#2{\gdef\@themark{{#1}{#2}}{%
     \let\protect\@unexpandable@protect \makedbcharnoexpand
     \let\label\relax \let\index\relax \let\glossary\relax
     \mark{\@themark}}\if@nobreak\ifvmode\nobreak\fi\fi}
\def\markright#1{{\let\protect\@unexpandable@protect \makedbcharnoexpand
     \let\label\relax \let\index\relax \let\glossary\relax
     \expandafter\@markright\@themark
     {#1}\mark{\@themark}}\if@nobreak\ifvmode\nobreak\fi\fi}
\makeatother
%% Now dump really.
\expandafter\everyjob\expandafter{\the\everyjob
\typeout{\hlatexfmtname\space<\hlatexfmtdate>}
\typeout{(C) Jae Choon Cha}
\typeout{\space\space\space\space Department of Mathematics, KAIST}}
\dump
