summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-11-09 00:54:10 +0000
committerKarl Berry <karl@freefriends.org>2013-11-09 00:54:10 +0000
commitd6aeafcbba09b7d46df19292790393b475facb8e (patch)
tree33be22110f65d9826533b3338ab9651ab14f4a39 /Master/texmf-dist
parentd82f205d424457a0853f7501ab50cf5fb81b9f38 (diff)
kotex-plain
git-svn-id: svn://tug.org/texlive/trunk@32104 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/plain/kotex-plain/ChangeLog55
-rw-r--r--Master/texmf-dist/doc/plain/kotex-plain/README69
-rw-r--r--Master/texmf-dist/tex/plain/kotex-plain/hangulcweb.tex232
-rw-r--r--Master/texmf-dist/tex/plain/kotex-plain/kotexplain.tex46
-rw-r--r--Master/texmf-dist/tex/plain/kotex-plain/kotexutf-core.tex645
-rw-r--r--Master/texmf-dist/tex/plain/kotex-plain/kotexutf.tex120
6 files changed, 1167 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/plain/kotex-plain/ChangeLog b/Master/texmf-dist/doc/plain/kotex-plain/ChangeLog
new file mode 100644
index 00000000000..aad779051bf
--- /dev/null
+++ b/Master/texmf-dist/doc/plain/kotex-plain/ChangeLog
@@ -0,0 +1,55 @@
+2013-10-26 Kangsoo Kim <karnes at ktug org>
+
+ Version 2.0.2
+
+ * kotexplain.tex: fix for xetexko and luatexko v2.1
+ * hangulcweb.sty: fix for xetexko and luatexko v2.1
+ * kotexutf.sty: fix for xetexko and luatexko v2.1
+
+2010-01-04 Dohyum Kim <nomos at ktug org>
+
+ Version 2.0.1a
+
+ * kotexutf.tex: finemath on bas been plain TeX default
+
+2009-03-06 Dohyun Kim <nomos at ktug org>
+
+ Version 2.0.1
+
+ * kotexplain.tex: plaintex wrapper
+
+2009-03-05 Dohyun Kim <nomos at ktug org>
+
+ Version 2.0.0
+
+ * kotexplain.tex: do nothing except loading kotexutf.tex
+
+2007-06-26 Dohyum Kim <nomos at ktug org>
+
+ Version 1.0.5
+
+ * kotexplain.tex: error if char does not exist
+
+2007-06-26 Dohyun Kim <nomos at ktug org>
+
+ Version 1.0.4
+
+ * kotexplain.tex: redefine U+2018, U+2019, u+201C, u+201D
+
+2007-06-25 Dohyun Kim <nomos at ktug org>
+
+ Version 1.0.3
+
+ * kotexplain.tex: fix bugs introduced by previous minor upgrade
+
+2007-06-24 Dohyun Kim <nomos at ktug org>
+
+ Version 1.0.2
+
+ * kotexplain.tex: lower multiple punctuations
+
+2007-06-14 Dohyun Kim <nomos at ktug org>
+
+ Version 1.0.1
+
+ * kotexplain.tex: \hu was too normal a CS. use \dhucs@hu instead
diff --git a/Master/texmf-dist/doc/plain/kotex-plain/README b/Master/texmf-dist/doc/plain/kotex-plain/README
new file mode 100644
index 00000000000..c452bdb705a
--- /dev/null
+++ b/Master/texmf-dist/doc/plain/kotex-plain/README
@@ -0,0 +1,69 @@
+kotex-plain
+===========
+
+Introduction
+------------
+
+kotex-plain is a package for typesetting Hangul, the native
+alphabet of the Korean language, using plain TeX engine.
+The input Korean text should be encoded in UTF-8.
+kotex-plain belongs to ko.TeX, a comprehensive Korean typesetting
+system together with kotex-utf, kotex-oblivoir, kotex-utils,
+cjk-ko, xetexko, and luatexko.
+
+Files
+-----
+
+### TeXinputs
+
+ kotexplain.tex -> tex/plain/kotex/
+ kotexutf.tex -> tex/plain/kotex/
+ kotexutf-core.tex -> tex/plain/kotex/
+ hangulcweb.tex -> tex/plain/kotex/
+
+### Documents
+
+ README (this file) -> doc/plain/kotex/
+ ChangeLog -> doc/plain/kotex/
+
+Usage
+-----
+
+To typeset Hangul, start your document as follows:
+
+ \input kotexplain
+
+You should use `etex` or `pdftex` commands to compile the document
+since kotex-plain uses e-TeX primitives. Also keep in mind that
+Korean documents needs to be encoded in UTF-8.
+
+To specify Hangul fonts, you can use the following methods:
+
+* `\hfont{outbb}{at 12pt}`: This command set the current Hangul font
+as 12 point bold. This is the most general way of specifying
+Hangul fonts.
+* `\hfontname{outbtb}`: This is equivallent to `\hfont{outbb}{}`, which
+only applies bold typeface to the current font.
+* `\hfontsize{at 12pt}`: This command changes the size of the current
+font as 12 point. Same effect can be achieved by `\hfont{}{at 12pt}`.
+
+To use CWEB system for literate programming, you can use `hangulcweb.tex`
+as follows:
+
+ \input hangulcweb
+
+For more information, please refer to the kotex-utf package documentation
+(written in Korean).
+
+License
+-------
+
+kotex-plain is licensed under the LaTeX Project Public
+License (LPPL).
+
+Contacts
+--------
+
+Please report any errors or suggestions to the package maintainer,
+Kihwang Lee <leekh at ktug org>.
+
diff --git a/Master/texmf-dist/tex/plain/kotex-plain/hangulcweb.tex b/Master/texmf-dist/tex/plain/kotex-plain/hangulcweb.tex
new file mode 100644
index 00000000000..84a0ee26b68
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/kotex-plain/hangulcweb.tex
@@ -0,0 +1,232 @@
+%% File hangulcweb.tex
+%%
+%% (C) Copyright 2007-2013 Dohyun Kim <nomos at ktug org>
+%% Soojin Nam <sjnam 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.
+%%
+\input kotexplain
+
+\ifpdftex
+ \ifdefined\pdfgentounicode
+ \input glyphtounicode
+ \pdfgentounicode=1
+ \fi
+\fi
+
+\baselineskip 15pt
+
+% 기본 폰트를 한글을 포함하도록 다시 정의합니다.
+\expandafter\def\expandafter\tt\expandafter{\tt\hfontname{nanumgtm}}
+\expandafter\def\expandafter\sl\expandafter{\sl\hfontname{nanummjmo}}
+\expandafter\def\expandafter\it\expandafter{\it\hfontname{nanummjmo}}
+\expandafter\def\expandafter\bf\expandafter{\bf\hfontname{nanummjb}}
+
+% 각종 폰트를 한글을 포함하도록 재정의
+\let\otitlefont=\titlefont \def\titlefont{\hfont{nanummjm}{at 13pt}\otitlefont}
+\let\ottitlefont=\ttitlefont \def\ttitlefont{\hfont{nanumgtm}{at 13pt}\ottitlefont}
+\let\orgninerm=\ninerm \def\ninerm{\hfont{nanummjm}{at 9pt}\orgninerm}
+\let\orgeightrm=\eightrm \def\eightrm{\hfont{nanummjm}{at 8pt}\orgeightrm}
+\let\orgsc=\sc \def\sc{\hfont{nanummjm}{at 8pt}\orgsc}
+\let\orgtentex=\tentex \def\tentex{\hfontname{nanumgtm}\orgtentex}
+
+\expandafter\edef\csname AT(@):catcode\endcsname
+ {\noexpand\catcode`@\the\catcode`@}
+\catcode`\@=11
+
+% names of the sections
+\def\fin{\par\vfill\eject % this is done when we are ending the index
+ \ifpagesaved\null\vfill\eject\fi % output a null index column
+ \if L\lr\else\null\vfill\eject\fi % finish the current page
+ \parfillskip 0pt plus 1fil
+ \def\grouptitle{마디 목차}
+ \let\topsecno=\nullsec
+ \message{Section names:}
+ \output={\normaloutput\page\lheader\rheader}
+ \setpage
+ \def\note##1##2.{\quad{\eightrm\ifacro{\pdfnote##2.}\else{##2}\fi##1.}}
+ \def\Q{\note{번 마디에서 인용된다}} \let\Qs=\Q
+ \def\U{\note{번 마디에서 사용된다}} \let\Us=\U
+ \def\I{\par\hangindent 2em}\let\*=*
+ \ifacro \def\outsecname{\bschar376\bschar377\bschar271\bschar310\bschar265\bschar024\bschar000 \bschar272\bschar251\bschar314\bschar050}% 마디 목차
+ \let\Xpdf\X
+ \ifpdftex
+ \edef\0{\string\0}%
+ \edef\1{\string\1}%
+ \edef\2{\string\2}%
+ \edef\3{\string\3}%
+ \makebookmarks \pdfdest name {NOS} fitb
+ \pdfoutline goto name {NOS} count -\secno {\outsecname}
+ \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
+ {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
+ \pdfoutline goto num \the\toksA \expandafter{\the\toksE}}
+ \else\ifpdf
+ \special{pdf: outline -1 << /Title (\outsecname)
+ /Dest [ @thispage /FitH @ypos ] >>}
+ \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
+ {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
+ \special{pdf: outline 0 << /Title (\the\toksE)
+ /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}}
+ \fi\fi\fi
+ \readsections}
+
+% CWEB USER MANUAL의 부록C 14.에 해당하는 모든 매크로를 재정의
+\def\inote#1#2#3.{\Y\noindent{\hangindent2em%
+ \baselineskip10pt\eightrm#1~\ifacro{\pdfnote#3.}\else#3\fi#2.\par}}
+\def\rnote#1#2.{\Y\noindent{\hangindent2em%
+ \baselineskip10pt\eightrm\ifacro{\pdfnote#2.}\else#2\fi#1.\par}}
+\def\A{\rnote{번 마디도 살펴보라}} \let\As=\A
+\def\Q{\inote{이 코드는}{번 마디에서 인용된다}} \let\Qs=\Q
+\def\U{\inote{이 코드는}{번 마디에서 사용된다}} \let\Us=\U
+\def\ET{,~} \def\ETs{\ET}
+\def\ATH{{\acrofalse\X\kern-.5em:전처리기 정의들\X}}
+\def\ch{\note{Change 파일에서 변경된 마디들:}
+ \let\*=\relax}
+\def\today{\number\year 년 \number\month 월 \number\day 일}
+\def\datethis{\def\startsection{\leftline{\sc\today\ \ \hours}\bigskip
+ \let\startsection=\stsec\stsec}}
+\def\datecontentspage{% changed in version 3.66
+ \def\botofcontents{\vfill
+ \centerline{\covernote}
+ \bigskip
+ \leftline{\sc\today\ \hours}}} % timestamps the contents page
+
+% 단순한 한글화로 목차 재정의
+\def\con{\par\vfill\eject % finish the section names
+% \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
+ \rightskip 0pt \hyphenpenalty 50 \tolerance 200
+ \setpage \output={\normaloutput\page\lheader\rheader}
+ \titletrue % prepare to output the table of contents
+ \pageno=\contentspagenumber
+ \def\grouptitle{목차}
+ \message{Table of contents:}
+ \topofcontents \startpdf
+ \line{\hfil 마디\hbox to3em{\hss 쪽}}
+ \let\ZZ=\contentsline
+ \readcontents\relax % read the contents info
+ \botofcontents \end} % print the contents page(s) and terminate
+
+\ifacro\else\expandafter\endinput\fi % pdf mode에서만...
+% ascii문자는 앞에 zero 붙여 ucs string으로 만든다.
+\def\addF#1{\addtokens\toksF{\bschar000#1}\tokprocessedtrue}
+\def\makeoutlinetoks{\Tnumfalse
+ % BOM(0xfeff)을 outline string 맨 앞에 첨가한다.
+ \addtokens\toksF{\bschar376\bschar377}%
+ % ucs 패키지의 \unichar 재정의; 그룹내이므로 안전.
+ \def\unihangulchar##1{\ucsoltooctal{##1}\makeolnexttok}%
+ \afterassignment\makeolproctok\let\nxt=
+}
+\def\makeolproctok{\tokprocessedfalse
+ \let\next\makeolnexttok % default
+ \ifx\nxt\outlinedone\let\next\outlinedone
+ \else\ifx{\nxt \else\ifx}\nxt \Tnumfalse \instrfalse % skip braces
+ \else\ifx$\nxt % or a $ sign
+ \else\ifx^\nxt \addF^\else\ifx_\nxt \addF_% sanitize ^ and _
+ \else\ifx\nxt\spacechar \addF\space
+ \else\if\noexpand\nxt\relax % we have a control sequence; is it one we know?
+ \ifx\nxt~\addF\space
+ \else\ifx\nxt\onespace\addF\space
+ \else\the\usersanitizer
+ \iftokprocessed\else\makeolproctokctli
+ \iftokprocessed\else\makeolproctokctlii
+ \iftokprocessed\else\makeolproctokctliii % if not recognised, skip it
+ %%%%% skip 하지 않고 한글 처리!!!
+ %\iftokprocessed\else\let\next\nxt\fi
+ \iftokprocessed\else\makeolproctokhangul\fi
+ %%%%%
+ \fi\fi\fi\fi\fi
+ \else % we don't have a control sequence, it's an ordinary char
+ \ifx/\nxt \addF{\string\/}% quote chars special to PDF with backslash
+ \else\ifx(\nxt \addF{\string\(}\else\ifx)\nxt \addF{\string\)}%
+ \else\ifx[\nxt \addF{\string\[}\else\ifx]\nxt \addF{\string\]}%
+ \else\expandafter\makeolproctokchar\meaning\nxt
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \next
+}
+\def\makeolproctokhangul{%
+ % 음, 이렇게 단순무식하게 ifx 검사하는 것이 안전하긴 한데
+ % 더 좋은 방법은 없을까?
+ \ifx^^c2\nxt\let\next\nxt\else
+ \ifx^^c3\nxt\let\next\nxt\else
+ \ifx^^c4\nxt\let\next\nxt\else
+ \ifx^^c5\nxt\let\next\nxt\else
+ \ifx^^c6\nxt\let\next\nxt\else
+ \ifx^^c7\nxt\let\next\nxt\else
+ \ifx^^c8\nxt\let\next\nxt\else
+ \ifx^^c9\nxt\let\next\nxt\else
+ \ifx^^ca\nxt\let\next\nxt\else
+ \ifx^^cb\nxt\let\next\nxt\else
+ \ifx^^cc\nxt\let\next\nxt\else
+ \ifx^^cd\nxt\let\next\nxt\else
+ \ifx^^ce\nxt\let\next\nxt\else
+ \ifx^^cf\nxt\let\next\nxt\else
+ \ifx^^d0\nxt\let\next\nxt\else
+ \ifx^^d1\nxt\let\next\nxt\else
+ \ifx^^d2\nxt\let\next\nxt\else
+ \ifx^^d3\nxt\let\next\nxt\else
+ \ifx^^d4\nxt\let\next\nxt\else
+ \ifx^^d5\nxt\let\next\nxt\else
+ \ifx^^d6\nxt\let\next\nxt\else
+ \ifx^^d7\nxt\let\next\nxt\else
+ \ifx^^d8\nxt\let\next\nxt\else
+ \ifx^^d9\nxt\let\next\nxt\else
+ \ifx^^da\nxt\let\next\nxt\else
+ \ifx^^db\nxt\let\next\nxt\else
+ \ifx^^dc\nxt\let\next\nxt\else
+ \ifx^^dd\nxt\let\next\nxt\else
+ \ifx^^de\nxt\let\next\nxt\else
+ \ifx^^df\nxt\let\next\nxt\else
+ \ifx^^e0\nxt\let\next\nxt\else
+ \ifx^^e1\nxt\let\next\nxt\else
+ \ifx^^e2\nxt\let\next\nxt\else
+ \ifx^^e3\nxt\let\next\nxt\else
+ \ifx^^e4\nxt\let\next\nxt\else
+ \ifx^^e5\nxt\let\next\nxt\else
+ \ifx^^e6\nxt\let\next\nxt\else
+ \ifx^^e7\nxt\let\next\nxt\else
+ \ifx^^e8\nxt\let\next\nxt\else
+ \ifx^^e9\nxt\let\next\nxt\else
+ \ifx^^ea\nxt\let\next\nxt\else
+ \ifx^^eb\nxt\let\next\nxt\else
+ \ifx^^ec\nxt\let\next\nxt\else
+ \ifx^^ed\nxt\let\next\nxt\else
+ \ifx^^ee\nxt\let\next\nxt\else
+ \ifx^^ef\nxt\let\next\nxt\else
+ \ifx^^f0\nxt\let\next\nxt\else
+ \ifx^^f1\nxt\let\next\nxt\else
+ \ifx^^f2\nxt\let\next\nxt\else
+ \ifx^^f3\nxt\let\next\nxt\else
+ \ifx^^f4\nxt\let\next\nxt\else
+ %%% really skip it.
+\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+}
+\def\ucsoltooctal#1{%
+ \count@\dimexpr.00006103515625\dimexpr#1sp\relax\relax
+ \edef\ucsoltempa{\number\count@}%
+ \@tempcnta\numexpr#1-'40000*\count@\relax
+ \count@\dimexpr.00048828125\dimexpr\@tempcnta sp\relax\relax
+ \edef\ucsoltempa{\ucsoltempa\number\count@}%
+ \@tempcnta\numexpr\@tempcnta-'4000*\count@\relax
+ \count@\dimexpr.00390625\dimexpr\@tempcnta sp\relax\relax
+ \edef\ucsoltempa{\ucsoltempa\number\count@}%
+ \@tempcnta\numexpr\@tempcnta-'400*\count@\relax
+ \count@\dimexpr.015625\dimexpr\@tempcnta sp\relax\relax
+ \edef\ucsoltempb{\number\count@}%
+ \@tempcnta\numexpr\@tempcnta-'100*\count@\relax
+ \count@\dimexpr.125\dimexpr\@tempcnta sp\relax\relax
+ \edef\ucsoltempb{\ucsoltempb\number\count@}%
+ \edef\ucsoltempb{\ucsoltempb\number\numexpr\@tempcnta-'10*\count@\relax}%
+ \addtokens\toksF{\bschar\ucsoltempa\bschar\ucsoltempb}\tokprocessedtrue
+}
+
+\csname AT(@):catcode\endcsname
+
+\endinput
+
+%%% changes for ko.Tex 2.0, by Karnes.
diff --git a/Master/texmf-dist/tex/plain/kotex-plain/kotexplain.tex b/Master/texmf-dist/tex/plain/kotex-plain/kotexplain.tex
new file mode 100644
index 00000000000..36ac8f555f7
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/kotex-plain/kotexplain.tex
@@ -0,0 +1,46 @@
+%% File `kotexplain.tex`
+%%
+%% Typesetting UTF-8 hangul on plain e-TeX
+%%
+%% (C) Copyright 2007-2013 Dohyun Kim <nomos at ktug org>
+%% Soojin Nam <sjnam 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.
+%% ----------------------------------------------------------------
+%%
+%% changelog:
+%% 2013/10/26 2.0.2 xe(lua)texko v2.1
+%% 2009/03/06 2.0.1 plaintex wrapper
+%% 2009/03/05 2.0.0 do nothing except loading kotexutf.tex
+%% 2007/06/26 1.0.5 error if char does not exist
+%% 2007/06/26 1.0.4 redefine U+2018, U+2019, U+201C, U+201D
+%% 2007/06/25 1.0.3 fix bugs introduced by previous minor upgrade
+%% 2007/06/24 1.0.2 lower multiple punctuations.
+%% 2007/06/14 1.0.1 \hu was too normal a CS. use \dhucs@hu intead.
+%%
+\ifx가가\else
+ \input kotexutf
+ \expandafter\endinput
+\fi
+
+\ifdefined\XeTeXrevision
+ \input xetexko.sty
+\else
+ \ifdefined\directlua
+ \input luatexko.sty
+ \fi
+\fi
+
+\def\hfontname#1{}
+\def\hfontsize#1{}
+\def\hfont#1#2{}
+
+\endinput
+
+% eof
diff --git a/Master/texmf-dist/tex/plain/kotex-plain/kotexutf-core.tex b/Master/texmf-dist/tex/plain/kotex-plain/kotexutf-core.tex
new file mode 100644
index 00000000000..98bf4ce5959
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/kotex-plain/kotexutf-core.tex
@@ -0,0 +1,645 @@
+%% File `kotexutf-core.tex`
+%%
+%% Copyright (C) 2009-2013 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.
+%%
+\expandafter\ifx\csname eTeXversion\endcsname\relax
+ \errhelp{kotexutf requires e-TeX. Please run etex or pdftex.}
+ \errmessage{kotexutf : Not running under e-TeX.}
+ \expandafter\endinput
+\fi
+
+%% frenchspacing is default
+\frenchspacing
+
+%% modifying commands from utf8.def
+\def\UTFviii@two@octets#1#2{%
+ \ifx\protect\noexpand
+ \string#1\string#2%
+ \else
+ \ifx\protect\string
+ \string#1\string#2%
+ \else
+ \ifcsname u8:\string#1\string#2\endcsname
+ \csname u8:\string#1\string#2%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\endcsname
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\unihangul@two@octets
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter#1%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter#2%
+ \fi
+ \fi
+ \fi
+}
+\def\unihangul@two@octets#1#2{%
+ \expandafter\unihangulchar\expandafter{%
+ \number\numexpr
+ (`#1 - 192) * 64 +
+ (`#2 - 128) \relax}}
+\def\UTFviii@three@octets#1#2#3{%
+ \ifx\protect\noexpand
+ \string#1\string#2\string#3%
+ \else
+ \ifx\protect\string
+ \string#1\string#2\string#3%
+ \else
+ \ifcsname u8:\string#1\string#2\string#3\endcsname
+ \csname u8:\string#1\string#2\string#3%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\endcsname
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\unihangul@three@octets
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter#1%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter#2%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter#3%
+ \fi
+ \fi
+ \fi
+}
+\def\unihangul@three@octets#1#2#3{%
+ \expandafter\unihangulchar\expandafter{%
+ \number\numexpr
+ (`#1 - 224) * 4096 +
+ (`#2 - 128) * 64 +
+ (`#3 - 128) \relax}}
+\def\UTFviii@four@octets#1#2#3#4{%
+ \ifx\protect\noexpand
+ \string#1\string#2\string#3\string#4%
+ \else
+ \ifx\protect\string
+ \string#1\string#2\string#3\string#4%
+ \else
+ \ifcsname u8:\string#1\string#2\string#3\string#4\endcsname
+ \csname u8:\string#1\string#2\string#3\string#4%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\endcsname
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\unihangul@four@octets
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter#1%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter#2%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter#3%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter#4%
+ \fi
+ \fi
+ \fi
+}
+\def\unihangul@four@octets#1#2#3#4{%
+ \expandafter\unihangulchar\expandafter{%
+ \number\numexpr
+ (`#1 - 240) * 262144 +
+ (`#2 - 128) * 4096 +
+ (`#3 - 128) * 64 +
+ (`#4 - 128) \relax}}
+
+
+%% subfont plane and char slot
+\def\geth@ngulpl@ne@ndch@r{%
+ \count@\numexpr % 1 / 256 = .00390625
+ \number\dimexpr.00390625\dimexpr\unih@ngulpoint sp\relax\relax
+ \relax
+ \chardef\h@ngulch@r % hangul char slot
+ \number\numexpr\unih@ngulpoint-\@cclvi*\count@\relax
+ \let\h@ngulpl@ne\@empty % hangul subfont plane
+ \ifnum\count@>\@cclv
+ \ifnum\count@>4095
+ \def\h@ngulpl@ne{1}\count@\numexpr\count@-4096\relax
+ \else
+ \def\h@ngulpl@ne{0}%
+ \fi
+ \@tempcnta\numexpr % 1 / 256 = .00390625
+ \number\dimexpr.00390625\dimexpr\count@ sp\relax\relax
+ \relax
+ \edef\h@ngulpl@ne{\h@ngulpl@ne\dhucsnumt@hex\@tempcnta}%
+ \count@\numexpr\count@-\@cclvi*\@tempcnta\relax
+ \fi
+ \@tempcnta\numexpr % 1 / 16 = .0625
+ \number\dimexpr.0625\dimexpr\count@ sp\relax\relax
+ \relax
+ \edef\h@ngulpl@ne{\h@ngulpl@ne\dhucsnumt@hex\@tempcnta}%
+ \count@\numexpr\count@-\sixt@@n*\@tempcnta\relax
+ \edef\h@ngulpl@ne{\h@ngulpl@ne\dhucsnumt@hex\count@}%
+}
+\def\dhucsnumt@hex#1{\ifcase\number#1
+ 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or
+ 8\or 9\or a\or b\or c\or d\or e\or f\else \dhucserr@r\fi
+}
+
+%% hangul font specific dimens
+\def\dhucs@hu{}
+\def\dhucs@interhchar{}
+\def\dhucs@fullstoplower{}
+\def\dhucs@questionlower{}
+\def\dhucs@exclamationlower{}
+
+\def\usehangulfontspec#1{%
+ \begingroup
+ \immediate\openin\z@=hfontspec.#1 %
+ \ifeof\z@
+ \message{\space\space *** Cannot find hangul font-spec file hfontspec.#1 ***\space\space}
+ \else
+ \endlinechar\m@ne
+ \get@hfnt@spec@
+ \fi
+ \immediate\closein\z@
+ \endgroup}
+\def\get@hfnt@spec@{%
+ \read\z@ to \@tempb
+ \ifx\@tempb\@empty
+ \let\next\relax
+ \else
+ \expandafter\get@hfnt@spec@@\@tempb\@@nil
+ \let\next\get@hfnt@spec@
+ \fi\next}
+\def\get@hfnt@spec@@#1 = #2\@@nil{%
+ \expandafter\gdef\csname dhucs@#1\endcsname{#2}}
+
+%% \unih@ngulpoint is unicode code point
+\newcount\unih@ngulpoint
+
+%% protect \unihangulchar
+\protected\def\unihangulchar#1{%
+ \unih@ngulpoint#1\relax
+ \futurelet\dhucs@next\unihangulchar@@}
+\def\unihangulchar@@{% check what comes next to hangul?
+ % \nexttoh@ngul = 1 : ascii opening parentheses
+ % \nexttoh@ngul = 2 : ascii closing parentheses
+ % \nexttoh@ngul = 3 : ascii numbers
+ % \nexttoh@ngul = 4 : ascii fullstop
+ % \nexttoh@ngul = 5 : ascii question mark
+ % \nexttoh@ngul = 6 : ascii exclamation mark
+ % \nexttoh@ngul = 0 : all others
+ \chardef\nexttoh@ngul\z@
+ % \puncnobre@k = 0 : this is not char ``orphan'' case
+ % \puncnobre@k = 1 : do not break before char ``orphan''
+ \chardef\puncnobre@k\z@
+ % avoiding char ``orphan'' operates only in four cases :
+ % [hangulchar] [par]
+ % [hangulchar] [space] [par]
+ % [hangulchar] [.?!] [par]
+ % [hangulchar] [.?!] [space] [par]
+ \ifx\fi\dhucs@next \expandafter\let\csname dhucs@next\endcsname\relax \fi
+ \ifx\ifx\dhucs@next \expandafter\let\csname dhucs@next\endcsname\relax \fi
+ \ifx\par\dhucs@next
+ \chardef\puncnobre@k\@ne
+ \let\unihangul@branch\unihangulchar@@@
+ \else
+ \ifx\@sptoken\dhucs@next
+ \let\unihangul@branch\check@next@to@sptoken
+ \else
+ \if\noexpand\dhucs@next\relax
+ \else
+ \check@dhucs@next@ascii456123\@nil
+ \fi
+ \ifnum\nexttoh@ngul>\thr@@
+ \let\unihangul@branch\check@next@to@puncs
+ \else
+ \let\unihangul@branch\unihangulchar@@@
+ \fi
+ \fi
+ \fi
+ \unihangul@branch
+}
+
+\def\check@next@to@sptoken{%
+ \afterassignment\check@next@to@sptoken@\let\dhucs@next= }
+\def\check@next@to@sptoken@{%
+ \futurelet\dhucs@nextnext\check@next@to@sptoken@@}
+\def\check@next@to@sptoken@@{%
+ \ifx\dhucs@nextnext\par
+ \chardef\puncnobre@k\@ne
+ \fi
+ \unihangulchar@@@\dhucs@next
+}
+
+\def\check@next@to@puncs{%
+ \afterassignment\check@next@to@puncs@\let\dhucs@next= }
+\def\check@next@to@puncs@{%
+ \futurelet\dhucs@nextnext\check@next@to@puncs@@}
+\def\check@next@to@puncs@@{%
+ \ifx\dhucs@nextnext\par
+ \chardef\puncnobre@k\@ne
+ \expandafter\unihangulchar@@@\expandafter\dhucs@next
+ \else
+ \ifx\dhucs@nextnext\@sptoken
+ \expandafter\expandafter\expandafter\check@next@to@punc@sptoken
+ \else
+ \expandafter\expandafter\expandafter\unihangulchar@@@
+ \expandafter\expandafter\expandafter\dhucs@next
+ \fi
+ \fi
+}
+
+\def\check@next@to@punc@sptoken{%
+ \afterassignment\check@next@to@punc@sptoken@\let\dhucs@nextnext= }
+\def\check@next@to@punc@sptoken@{%
+ \futurelet\dhucs@nextnextnext\check@next@to@punc@sptoken@@}
+\def\check@next@to@punc@sptoken@@{%
+ \ifx\dhucs@nextnextnext\par
+ \chardef\puncnobre@k\@ne
+ \fi
+ \unihangulchar@@@\dhucs@next\dhucs@nextnext
+}
+
+%% see lucenc.dfu
+\def\check@dhucs@next@ascii#1{%
+ \def\@tempa{#1}%
+ \ifx#1\@nil
+ \let\next\relax
+ \else
+ \let\next\check@dhucs@next@ascii
+ \edef\@tempb{\csname nexttohangul-#1\endcsname}%
+ \expandafter\check@dhucs@next@ascii@\@tempb\@nnil
+ \fi\next
+}
+\def\check@dhucs@next@ascii@#1{%
+ \ifx#1\@nnil\let\next@\relax
+ \else
+ \ifx#1\dhucs@next
+ \chardef\nexttoh@ngul\@tempa
+ \let\next@\remove@to@nnil \let\next\remove@to@nil
+ \else
+ \let\next@\check@dhucs@next@ascii@
+ \fi
+ \fi\next@
+}
+\def\remove@to@nil#1\@nil{}
+\def\remove@to@nnil#1\@nnil{}
+
+%%% if \strictcharcheck is defined ...
+\ifdefined\strictcharcheck
+ \def\dhucs@check@if@char@exists{%
+ \unless\iffontchar\font@name\h@ngulch@r
+ \errmessage{Character \number\h@ngulch@r\space
+ doesn't exist in font \fontname\font@name}%
+ \fi}
+\else
+ \let\dhucs@check@if@char@exists\relax
+\fi
+
+%% hangul space factor
+\mathchardef\Hangul@spacefactor=1001\relax
+\mathchardef\Hanja@spacefactor=1002\relax
+\mathchardef\nobreak@spacefactor=998\relax
+
+\def\getthish@ngulcl@ss{% what is current hangul category?
+ % \thish@ngul = 1 : hangul
+ % \thish@ngul = 2 : hanja, hiragana, katakana
+ % \thish@ngul = 3 : opening parentheses; NOT in use: see lucenc.dfu
+ % \thish@ngul = 4 : closing parentheses; NOT in use: see lucenc.dfu
+ % \thish@ngul = 0 : all others
+ \ifnum\unih@ngulpoint<12352
+ \chardef\thish@ngul\z@ % cjk symbols
+ \else\ifnum\unih@ngulpoint<12539
+ \chardef\thish@ngul\tw@ % hiragana, katakana
+ \else\ifnum\unih@ngulpoint<13312
+ \chardef\thish@ngul\z@ % cjk symbols
+ \else\ifnum\unih@ngulpoint<44032
+ \chardef\thish@ngul\tw@ % hanja ext A; hanja unified
+ \else\ifnum\unih@ngulpoint<57344
+ \chardef\thish@ngul\@ne % hangul
+ \else\ifnum\unih@ngulpoint<64256
+ \chardef\thish@ngul\tw@ % hanja compatibillity
+ \else\ifnum\unih@ngulpoint<65520
+ \chardef\thish@ngul\z@ % full/half width marks
+ \else
+ \chardef\thish@ngul\tw@ % hanja ext. B mostly
+ \fi\fi\fi\fi\fi \fi\fi
+}
+
+%% disallow linebreak after opening parentheses
+\sfcode`\(=\nobreak@spacefactor
+\sfcode`\`=\nobreak@spacefactor
+\sfcode`\[=\nobreak@spacefactor
+\sfcode`\{=\nobreak@spacefactor
+%% TeX inserts \discretionary{}{}{} always after hyphen char,
+%% so we can safely give nobreak-spacefactor to ``-'' to suppress
+%% unwanted micro-space after latin hyphen char.
+\sfcode`\-=\nobreak@spacefactor
+
+\def\dobeforeh@ngulch@r{%
+ \ifhmode
+ \ifcase\lastnodetype
+ % e-TeX's lastnodetype 0 is char node
+ \dhucs@normal@break@before@cjk
+ \or % hlist node
+ % As \hbox returns spacefactor to 1000,
+ % we cannot identify what was before this korean char.
+ % So, allowing linebreak is somewhat dangerous; We Do, however.
+ \ifcase\thish@ngul
+ \or \ifcase\puncnobre@k\breakbetweenhanja
+ \or\nobreakbetweenhanja\fi
+ \or \ifcase\puncnobre@k\breakbetweenhanja
+ \or\nobreakbetweenhanja\fi
+ \fi
+ \or % vlist node
+ \or % rule node
+ \or % ins node
+ \or % mark node
+ \or % adjust node
+ \or % ligature node
+ \ifnum\spacefactor>\nobreak@spacefactor
+ \ifcase\thish@ngul
+ \or \ifcase\puncnobre@k\breakafterasciichar
+ \or\nobreakafterasciichar\fi
+ \or \ifcase\puncnobre@k\breakafterasciichar
+ \or\nobreakafterasciichar\fi
+ \fi
+ \fi
+ \or % disc node
+ \or % whatsit node
+ % how do we know what there was before whatsit?
+ \dhucs@normal@break@before@cjk
+ \or % math node
+ \ifcase\thish@ngul
+ \or \ifcase\puncnobre@k\breakafterinlinemath
+ \or\nobreakafterinlinemath\fi
+ \or \ifcase\puncnobre@k\breakafterinlinemath
+ \or\nobreakafterinlinemath\fi
+ \fi
+ \or % glue node
+ \or % kern node, which is another source of headache!
+ \ifdim\lastkern=\z@
+ % is it safe to break lines after \kern 0pt?
+ \dhucs@normal@break@before@cjk
+ \else
+ \ifnum\spacefactor>\nobreak@spacefactor
+ \ifdim\lastkern=\@tempdima % see redefinition of \sw@slant
+ \ifnum\spacefactor>\@m
+ \ifcase\thish@ngul
+ \or \ifcase\puncnobre@k\breakbetweenhanja
+ \or\nobreakbetweenhanja\fi
+ \or \ifcase\puncnobre@k\breakbetweenhanja
+ \or\nobreakbetweenhanja\fi
+ \fi
+ \else
+ \ifcase\thish@ngul
+ \or \ifcase\puncnobre@k\breakafterasciichar
+ \or\nobreakafterasciichar\fi
+ \or \ifcase\puncnobre@k\breakafterasciichar
+ \or\nobreakafterasciichar\fi
+ \fi
+ \fi
+ \else
+ \ifcase\thish@ngul
+ \or \ifcase\puncnobre@k\breakbetweenhanja
+ \or\nobreakbetweenhanja\fi
+ \or \ifcase\puncnobre@k\breakbetweenhanja
+ \or\nobreakbetweenhanja\fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \@tempdima\z@
+ \or % penalty node
+ % Even after \nobreak, inter-hangulchar kern should be applied!
+ \ifnum\lastpenalty<\@M
+ \dhucs@normal@break@before@cjk
+ \else
+ \chardef\puncnobre@k\@ne
+ \dhucs@normal@break@before@cjk
+ \fi
+ \or % unset node
+ \or % math mode node
+ \fi
+ \fi
+}
+
+\ifdefined\sw@slant
+ %% detect last italiccorr
+ \edef\sw@slant{\unexpanded\expandafter{\sw@slant\@tempdima\lastkern}}
+\else
+ \unless\ifdefined\@tempdima \newdimen\@tempdima\@tempdima=0pt \fi
+\fi
+
+\def\dhucs@normal@break@before@cjk{%
+ \ifnum\spacefactor>\nobreak@spacefactor
+ \ifcase\thish@ngul
+ % other cjk char: do nothing
+ \or % hangul
+ \ifnum\spacefactor=\Hangul@spacefactor
+ \ifcase\puncnobre@k\breakbetweenhangul
+ \or\nobreakbetweenhangul\fi
+ \else
+ \ifnum\spacefactor=\Hanja@spacefactor
+ \ifcase\puncnobre@k\breakbetweenhanja
+ \or\nobreakbetweenhanja\fi
+ \else
+ \ifcase\puncnobre@k\breakafterasciichar
+ \or\nobreakafterasciichar\fi
+ \fi
+ \fi
+ \or % hanja, hiragana, katakana
+ \ifnum\spacefactor=\Hangul@spacefactor
+ \ifcase\puncnobre@k\breakbetweenhanja
+ \or\nobreakbetweenhanja\fi
+ \else
+ \ifnum\spacefactor=\Hanja@spacefactor
+ \ifcase\puncnobre@k\breakbetweenhanja
+ \or\nobreakbetweenhanja\fi
+ \else
+ \ifcase\puncnobre@k\breakafterasciichar
+ \or\nobreakafterasciichar\fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+\def\do@fterh@ngulch@r{%
+ \ifhmode
+ \ifcase\nexttoh@ngul
+ \ifcase\thish@ngul
+ \declarehanjaspacefactor
+ \or \declarehangulspacefactor
+ \or \declarehanjaspacefactor
+ \or \declarenobreakspacefactor
+ \or \declarehanjaspacefactor
+ \fi
+ \or \breakbeforeasciichar % (
+ \or % )
+ \spacefactor\@m
+ \or \kernbeforeasciichar % 123
+ \or \expandafter\expandafter\expandafter\asciifullstopafterhangul % .
+ \or \expandafter\expandafter\expandafter\asciiquestionafterhangul % ?
+ \or \expandafter\expandafter\expandafter\asciiexclamationafterhangul % !
+ \fi
+ \fi
+}
+
+\def\declarenobreakspacefactor{\spacefactor\nobreak@spacefactor}
+\def\declarehangulspacefactor{\spacefactor\Hangul@spacefactor}
+\def\declarehanjaspacefactor{\spacefactor\Hanja@spacefactor}
+
+%% default linebreaking command
+\def\breakbetweenhanja{\discretionary{}{}{}}
+\def\nobreakbetweenhanja{}
+
+%% under option [finemath], hfontspec.un becomes active.
+%% otherwize, all font-spec value is 0pt.
+\ifdefined\finemath %\if@dhucsfinemath
+ %% As Korean typesetting allows linebreak at any point between hangul char,
+ %% \doublehyphendemerits does not have meaning any longer.
+ \doublehyphendemerits=0
+ %% Now that some code to suppress char ``orphan'' has been added,
+ %% \finalhyphendemerits does not have much meaning, either.
+ %% Moreover, \finalhyphendemerits discourages linebreak of final word
+ %% within a paragraph; undesirable when the final word is long.
+ \finalhyphendemerits=0
+ %%
+ \usehangulfontspec{default}
+ \def\breakbetweenhangul{\discretionary{}{}{\kern\dhucs@interhchar}}
+ \def\nobreakbetweenhangul{\kern\dhucs@interhchar}
+ % \dimexpr used, because \newdimen\something\something=1em fixes
+ % \something's dimen size when it is initially assigned.
+ % In this case, for example, \dhucs@hu applied to normal size is the same size
+ % as to \Huge size font. This does not seem to be what we want.
+ % Accordingly, we decided to declare \dhucs@hu as a macro, not a dimen.
+ % Now that \dhucs@hu is a macro, e-TeX's \dimexpr enables simple definition
+ % of its multiplication.
+ \def\breakafterinlinemath{\hskip\dimexpr\dhucs@hu*3\relax\relax}
+ % At above line, \dimexpr absorbs the first \relax;
+ % second \relax terminates \hskip's arguments.
+ % On the other hand, as \kern does not scan for ``plus'' or ``minus,''
+ % another \relax seems to be redundant at following line.
+ \def\nobreakafterinlinemath{\kern\dimexpr\dhucs@hu*3\relax}
+ \def\breakafterasciichar{\hskip\dimexpr\dhucs@hu*2\relax\relax}
+ \def\nobreakafterasciichar{\kern\dimexpr\dhucs@hu*2\relax}
+ \def\breakbeforeasciichar{\hskip\dimexpr\dhucs@hu*2\relax\relax}
+ \def\kernbeforeasciichar{\kern\dimexpr\dhucs@hu*2\relax}
+ \def\asciifullstopafterhangul#1{%
+ \lower\dhucs@fullstoplower\hbox\bgroup#1\dhucs@check@another@punc}
+ \def\asciiquestionafterhangul#1{%
+ \lower\dhucs@questionlower\hbox\bgroup
+ \let\dhucs@kern@before@quot@char\dhucs@kern@before@quot@char@
+ \kern\dimexpr\dhucs@hu*3\relax#1\dhucs@check@another@punc}
+ \def\asciiexclamationafterhangul#1{%
+ \lower\dhucs@exclamationlower\hbox\bgroup
+ \let\dhucs@kern@before@quot@char\dhucs@kern@before@quot@char@
+ \kern\dimexpr\dhucs@hu*4\relax#1\dhucs@check@another@punc}
+ \def\dhucs@kern@before@quot@char@{%
+ \ifx'\dhucs@next\kern\dimexpr\dhucs@hu*3\relax\fi
+ \spacefactor1003\relax} % for U+2019, U+201D; see lucenc.dfu
+ \let\dhucs@kern@before@quot@char\relax
+ %% lowering multiple puctuations:
+ %% If next char is a punctuation, do not close \hbox and scan another char.
+ \def\dhucs@check@another@punc{%
+ \futurelet\dhucs@next\dhucs@check@another@punc@}
+ \def\dhucs@check@another@punc@{%
+ \chardef\nexttoh@ngul\z@
+ \if\noexpand\dhucs@next\relax\else
+ \check@dhucs@next@ascii456\@nil
+ \fi
+ \dhucs@check@another@punc@@}
+ \def\dhucs@check@another@punc@@{%
+ \ifcase\nexttoh@ngul
+ \expandafter\dhucs@check@another@punc@end
+ \or \expandafter\dhucs@check@another@punc@end
+ \or \expandafter\dhucs@check@another@punc@end
+ \or \expandafter\dhucs@check@another@punc@end
+ \or \let\dhucs@kern@before@quot@char\relax
+ \expandafter\dhucs@check@another@punc@@@
+ \or \let\dhucs@kern@before@quot@char\dhucs@kern@before@quot@char@
+ \expandafter\dhucs@check@another@punc@@@
+ \or \let\dhucs@kern@before@quot@char\dhucs@kern@before@quot@char@
+ \expandafter\dhucs@check@another@punc@@@
+ \fi}
+ \def\dhucs@check@another@punc@@@#1{%
+ \kern\dhucs@hu\relax #1\dhucs@check@another@punc}
+ \def\dhucs@check@another@punc@end{%
+ \dhucs@kern@before@quot@char
+ \global\count@\spacefactor\egroup\spacefactor\count@}
+\else
+ \usehangulfontspec{default}
+ \def\breakafterinlinemath{\hskip\z@skip}
+ \def\nobreakafterinlinemath{}
+ \def\breakbetweenhangul{\discretionary{}{}{}}
+ \def\nobreakbetweenhangul{}
+ \def\breakafterasciichar{\hskip\z@skip}
+ \def\nobreakafterasciichar{}
+ \def\breakbeforeasciichar{\hskip\z@skip}
+ \def\kernbeforeasciichar{}
+ \def\asciifullstopafterhangul{}
+ \def\asciiquestionafterhangul{}
+ \def\asciiexclamationafterhangul{}
+\fi
+
+%% linebreaking related to cjk symbols
+\def\cjksymbolextraspace{\discretionary{}{}{}}
+\def\cjksymbolskip{%
+ \ifhmode
+ \ifnum\spacefactor>\nobreak@spacefactor
+ \ifnum\lastpenalty<\@M
+ \cjksymbolextraspace
+ \fi
+ \fi
+ \else
+ \leavevmode
+ \fi}
+\def\postcjksymskip{\ifhmode\declarehanjaspacefactor\fi}
+\def\postcjksymnobreak{\ifhmode\declarehanjaspacefactor\nobreak\fi}
+\def\postcjksymbol{\ifhmode\declarehanjaspacefactor\fi}
+\def\kernbeforelatinquoteclose{%
+ \ifhmode\ifnum\spacefactor=1003 \kern\dimexpr\dhucs@hu*3\relax\fi\fi}
+\def\cjksymbolunskip{}
+
+%% \disablehangulfontspec disables all the font-spefic spaces and dimens
+%% except the space after inline math.
+\def\disablehangulfontspec{%
+ \def\breakbetweenhangul{\discretionary{}{}{}}
+ \let\nobreakbetweenhangul\@empty
+ \def\breakafterasciichar{\hskip\z@skip}
+ \let\nobreakafterasciichar\@empty
+ \let\breakbeforeasciichar\breakafterasciichar
+ \let\kernbeforeasciichar\@empty
+ \let\asciifullstopafterhangul\relax
+ \let\asciiquestionafterhangul\relax
+ \let\asciiexclamationafterhangul\relax
+}
+
+%% \disablehangullinebreak disables all linebreaking
+%% related to hangul typesetting.
+\def\disablehangullinebreak{%
+ \let\unihangulchar@\unihangulchar@@@
+ \let\dobeforeh@ngulch@r\relax
+ \let\do@fterh@ngulch@r\relax
+ \let\cjksymbolskip\leavevmode}
+
+
+%% bangjom emphasis
+\def\dhucs@emph#1{}
+\newdimen\dhucs@emph@raise
+\protected\def\dotemph#1{\begingroup
+ \setbox\z@\hbox{#1}\dhucs@emph@raise\ht\z@
+ \advance\dhucs@emph@raise -.4em
+ \let\dhucs@emph\dot@emph
+ #1\endgroup}
+\def\dot@emph#1{%
+ \ifnum\thish@ngul>\z@ %\ifnum\thish@ngul<\thr@@ % hangul or hanja
+ \setbox\z@\hbox{#1}\dimen@\wd\z@
+ \rlap{\raise\dhucs@emph@raise
+ \hbox to\dimen@{\normalfont\bfseries\hss˙\hss}}\fi %\fi
+}
+
+
+\endinput
+
diff --git a/Master/texmf-dist/tex/plain/kotex-plain/kotexutf.tex b/Master/texmf-dist/tex/plain/kotex-plain/kotexutf.tex
new file mode 100644
index 00000000000..0e9d8076e31
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/kotex-plain/kotexutf.tex
@@ -0,0 +1,120 @@
+%% File `kotexutf.tex`
+%%
+%% 2010.01.04 v1.1
+%%
+%% Copyright (C) 2010-2013 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.
+%%
+%% finemath on has been plainTeX default
+%%
+\def\finemath{}
+
+\expandafter\edef\csname AT(@):catcode\endcsname{\noexpand\catcode`@\the\catcode`@}
+
+\unless\ifdefined\makeatletter \def\makeatletter{\catcode`\@=11 }\fi
+\unless\ifdefined\makeatother \def\makeatother{\catcode`\@=12 }\fi
+
+\makeatletter
+
+\unless\ifdefined\@tempcnta \newcount\@tempcnta\fi
+\unless\ifdefined\@tempcntb \newcount\@tempcntb\fi
+\unless\ifdefined\@empty \let\@empty\empty\fi
+\unless\ifdefined\@sptoken
+ \begingroup
+ \def\:{\global\let\@sptoken= }\: % this makes \@sptoken a space token
+ \endgroup
+\fi
+
+\unless\ifdefined\ProvidesFile
+ \def\ProvidesFile#1{\wlog{#1}\@ProvidesFile}
+ \def\@ProvidesFile{\futurelet\dhucs@next\@@ProvidesFile}
+ \def\@@ProvidesFile{%
+ \ifx\dhucs@next\@sptoken\expandafter\@@@ProvidesFile
+ \else\ifx\dhucs@next[\expandafter\expandafter\expandafter\ProvidesFile@
+ \fi\fi}
+ \def\@@@ProvidesFile{\afterassignment\@ProvidesFile\let\dhucs@next= }
+ \def\ProvidesFile@[#1]{\wlog{#1}}
+\fi
+
+\unless\ifdefined\IeC \protected\def\IeC#1{#1}\fi
+\unless\ifdefined\textperiodcentered \protected\def\textperiodcentered{$\cdot$}\fi
+\unless\ifdefined\textquoteleft \protected\def\textquoteleft{`}\fi
+\unless\ifdefined\textquoteright \protected\def\textquoteright{'}\fi
+\unless\ifdefined\textquotedblleft \protected\def\textquotedblleft{``}\fi
+\unless\ifdefined\textquotedblright \protected\def\textquotedblright{''}\fi
+
+\unless\ifdefined\saved@space@catcode \xdef\saved@space@catcode{\the\catcode`\ }\fi
+\unless\ifdefined\PackageError \def\PackageError#1#2#3{\errmessage{#2}}\fi
+\unless\ifdefined\@inpenc@test \let\@inpenc@test\relax \fi
+\unless\ifdefined\@begindocumenthook \let\@begindocumenthook\relax \fi
+\unless\ifdefined\@onlypreamble \def\@onlypreamble#1{}\fi
+\unless\ifdefined\cdp@list \let\cdp@list\relax \fi
+
+\unless\ifdefined\protect \let\protect\relax \fi
+
+\unless\ifdefined\normalfont \def\normalfont{\rm\hfontname{nanummjm}}\fi
+\unless\ifdefined\bfseries \def\bfseries{\bf\hfontname{nanummjb}}\fi
+
+% make first octet of a utf8 char active
+\count@"C2
+\loop\catcode\count@\active
+ \ifnum\count@<"F4
+ \advance\count@\@ne\repeat
+
+\input utf8.def
+
+\input kotexutf-core
+
+\def\unihangulchar@@@{%
+ \getthish@ngulcl@ss
+ \dobeforeh@ngulch@r
+ \leavevmode %%% moved from inside group
+ \begingroup
+ \geth@ngulpl@ne@ndch@r
+ \font\font@name\h@font@name\h@ngulpl@ne\space\h@font@size
+ \font@name
+ \dhucs@check@if@char@exists
+ \dhucs@emph\h@ngulch@r
+ \h@ngulch@r
+ \endgroup
+ \do@fterh@ngulch@r
+}
+
+\input lucenc.dfu
+
+% \다 = \nobreak 다
+\def\nobreak@hangul@da{\nobreak 다}
+\def\^^eb#1#2{%
+ \ifx#1^^8b%
+ \ifx#2^^a4% avoid orphan \다
+ \expandafter\expandafter\expandafter\nobreak@hangul@da
+ \else
+ \errmessage{Undefined Control Sequence}%
+ \fi
+ \else
+ \errmessage{Undefined Control Sequence}%
+ \fi}
+
+
+% hangul font definition
+% ex: \hfont{nanumgtm}{at 12pt}
+% \hfontname{nanumgtm}
+% \hfontsize{at 12pt}
+\protected\def\hfontname#1{\def\h@font@name{#1}}
+\protected\def\hfontsize#1{\def\h@font@size{#1}}
+\protected\def\hfont#1#2{\hfontname{#1}\hfontsize{#2}}
+
+\csname AT(@):catcode\endcsname
+
+\hfont{nanummjm}{}
+
+\endinput
+
+%% changes for ko.TeX 2.0, by Karnes.