% kotex.sty
%
% (C) Copyright 2007-2013 Koaunghi Un <koaunghi at kornet net>
%                         Kangsoo Kim <karnes at ktug or kr>
%                         Dohyun Kim  <nomos at ktug org>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%  http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2006/05/20 or later.
%
% -------------------------------------------------
%
% main style of ko.TeX
%
% Usage : \usepackage{kotex}          \usepackage[hangul]{kotex}
%         \usepackage[euc]{kotex}     \usepackage[euc,hangul]{kotex}
%         \usepackage[cjk]{kotex}     \usepackage[cjk,hangul]{kotex}

\ProvidesPackage{kotex}[2013/03/23 v1.1 Korean TeX (ko.TeX)]

\newif\if@ko@euc
\let\@ko@cjk\undefined

\ifx\directlua\relax \let\directlua\undefined \fi
\ifx\eTeXversion\relax \let\eTeXversion\undefined \fi
\ifx\eTeXversion\undefined \let\@ko@cjk\empty \fi
\IfFileExists{kotexutf.sty}{}{\let\@ko@cjk\empty}

\DeclareOption{utf}{}
\DeclareOption{euc}{\@ko@euctrue}
\DeclareOption{cjk}{\let\@ko@cjk\empty}
\DeclareOption*{
  \ifx가가%
    \ifx\directlua\undefined
      \PassOptionsToPackage{\CurrentOption}{xetexko}
    \else
      \PassOptionsToPackage{\CurrentOption}{luatexko}
    \fi
  \else
    \if@ko@euc
      \PassOptionsToPackage{\CurrentOption}{kotex-euc}
    \else
      \ifx\@ko@cjk\undefined
	\PassOptionsToPackage{\CurrentOption}{kotexutf}
      \else
	\PassOptionsToPackage{\CurrentOption}{cjkutf8-ko}
      \fi
    \fi
  \fi}
\InputIfFileExists{kotex.cfg}{}{}
\ProcessOptions\relax

%%% compatibility
\if@ko@euc \else
 \let\gtfamily\sffamily
 \DeclareTextFontCommand{\textgt}{\gtfamily}
\fi

%%% load one of ko.TeX packages
\ifx가가%
  \ifx\directlua\undefined
    \RequirePackage{xetexko}
  \else
    \RequirePackage{luatexko}
  \fi
\else
  \if@ko@euc
    \RequirePackage{kotex-euc}
  \else
    \ifx\@ko@cjk\undefined
      \RequirePackage{kotexutf}
    \else
      \RequirePackage{cjkutf8-ko}
    \fi
  \fi
\fi

\endinput
