\documentclass[a4paper]{article}
\usepackage{kotex}
%\usepackage{fontspec}
%\setmainfont{Noto Serif}
%\setsansfont{Noto Sans}
%\setmonofont{Noto Sans Mono}
\setmainfont{XITS}

\usepackage{hologo}
\newcommand*\XeTeX{\hologo{XeTeX}}
\newcommand*\XeLaTeX{\hologo{XeLaTeX}}
\newcommand*\LuaTeX{\hologo{LuaTeX}}
\newcommand*\LuaLaTeX{\hologo{LuaLaTeX}}

\usepackage{pmhanguljamo}
\usepackage[colorlinks]{hyperref}

%\usepackage{polyglossia}
%\setotherlanguage{korean}
%\newfontfamily\hangulfont{UnBatang.ttf}[Script=Hangul,Renderer=OpenType]
%%\newcommand*\jamo[1]{\begingroup\hangulfont\jamoword{#1}}

\setmainhangulfont{Noto Serif CJK KR}[Script=Hangul,Renderer=OpenType]

\providecommand*\textkorean[1]{#1}
\newenvironment{korean}{}{}
\newcommand*\jamo[1]{\jamoword{#1}}

\newcommand*\pkg[1]{\textsf{#1}\index{#1}\index{Package!#1}}
\newcommand*\thispkg{\pkg{pmhanguljamo}}
%\maxsecnumdepth{section}

\begin{document}

\title{Poorman's Hangul Jamo Input Method \\ \Large \texttt{pmhanguljamo.sty} }
\author{Kangsoo Kim}
%\date{10 Mar 2021\quad version 0.3.5}
%\date{20 Sep 2021\quad version 0.3.6}
\date{28 Nov 2021\quad version 0.4}

\maketitle

\tableofcontents

\section{Introduction}
This \LaTeX\ package provides Hangul\footnote{%
    \emph{Hangul} is the Korean alphabet 
    to write the Korean language. In both South and North Korea,
    the standard writing system uses Hangul.}
\emph{transliteration} input method, which 
allows to typeset Korean Letters (Hangul) with the help of proper fonts.
The name comes from ``Poorman's Hangul Jamo Input Method.'' It is mainly for
the people who have a system without Korean keyboard IM, but want to typeset
Hangul in their document.
Not only modern Hangul, but so-colled ``Old Hangul'' characters
that uses the lost letters such as `Arae-A'(\textkorean{\jmcc{@}}), `Yet Ieung'(\textkorean{\jmcc{Q}}) or `Pan-Sios'(\textkorean{\jmcc{Z}}) etc.\ can also be typeset.

\XeLaTeX\ or \LuaLaTeX\ is required. The legacy pdf\TeX\ is not supported.
The Korean Language supporting packages such as \pkg{xetexko} and \pkg{luatexko} (in the ko.\TeX\ bundle)
or \pkg{polyglossia} package with Korean support %under \XeLaTeX\  
are recommended, but without them typesetting Hangul is of no problem
with this package \thispkg.

\section{Usage}

\subsection{Loading the package}

Put the following line in your preamble:
\begin{verbatim}
\usepackage{pmhanguljamo}
\end{verbatim}

The option \texttt{[RRK]} or \texttt{[rrk]}
can be given, in which case the \emph{Standard Korean Romanization Transliteration}
input method is activated. In section~\ref{sec:rrk},
we will explain about it.
Without option, the default input method of this package is used, that
is explained in sections~\ref{sec:rule}--\ref{sec:exam}.
You are to specify just one of them. Using both methods in one document is
not allowed.

\subsection{Commands and Environment Provided}

The main command to typeset Hangul is \verb|\jamoword|.

\begin{quote}
Input:
\verb|\jamoword{myec dan/e/ga or su iss/svb/ni/da/.}|\\
Result: \textkorean{\jamoword{myec dan/e/ga or su iss/svb/ni/da/.}}
\end{quote}

The argument of the command consists of roman alphabets 
and a few marks that represent the transliteration of Hangul Jamo.
The transliteration rule will be explained in the section~\ref{sec:rule} (page~\pageref{sec:rule}).

And an environment named \emph{jamotext} is provided.
In the environment, multiple paragraphs can be located. So, it is
suitable to typeset longer text stuffs. For example,
\begin{verbatim}
\begin{jamotext}
jug/nvn nar/gga/ji ha/nvr/vr u/re/re \\
han jem bu/ggv/rem ebs/gi/rvr 

ip/sai/ei i/nvn ba/ram/ei/do \\
na/nvn goi/ro/ue/haiss/da/.
\end{jamotext}
\end{verbatim}
The result:
\begin{quote}
\begin{korean}
\begin{jamotext}
jug/nvn nar/gga/ji ha/nvr/vr u/re/re \\
han jem bu/ggv/rem ebs/gi/rvr 

ip/sai/ei i/nvn ba/ram/ei/do \\
na/nvn goi/ro/ue/haiss/da/.
\end{jamotext}
\end{korean}
\end{quote}


\subsection{Setting up in your Preamble}

Without any other packages, you can type Hangul. Be sure that
proper fonts should be declared for Hangul, utilizing \pkg{fontspec}.

\begin{verbatim}
\documentclass{article}
\usepackage{fontspec}
\usepackage{pmhanguljamo}

\begin{document}
\fontspec[Script=Hangul]{UnBatang.ttf}
\jamoword{an/nyex/ha/sei/yo}
\end{document}
\end{verbatim}

\texttt{UnBatang.ttf} is a font shipped in \pkg{unfonts-core} package of \TeX\,Live.
Not all Korean fonts can be available to typeset so-called `Old Hangul',
because they happen to lack
the feature of composing Korean syllables from conjoining Jamo codes. Fortunately,
we have a few more fonts besides \texttt{UnBatang} that are \emph{proper}
and freely available, which are listed in the section~\ref{sec:font}.
In \TeX\,Live distribution, \texttt{UnBatang} is the only \emph{proper} one.

The \pkg{polyglossia} package provides Korean language support. This package \thispkg\
can be used with it. The following is an example.

\begin{verbatim}
\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{korean}
\newfontfamily\hangulfont{UnBatang.ttf}[Script=Hangul]
\usepackage{pmhanguljamo}

\begin{document}
\begin{korean}
\jamoword{han/gvr/vr si/hem/hab/ni/da/.}
\end{korean}
\end{document}
\end{verbatim}

Or the ko.\TeX\ package bundle can be used together.

\begin{verbatim}
\documentclass{article}
\usepackage{kotex}
\usepackage{pmhanguljamo}
\setmainhangulfont{UnBatang.ttf}[Script=Hangul]

\begin{document}
\jamoword{na/ras/mar/ss@/mi}
\end{document}
\end{verbatim}

In any case, the option \verb|[Script=Hangul]| should be given
to the font settings for Hangul. For more information, see section~\ref{sec:font}.

The Korean writing system does not have hyphenation rules.
The line breaking can occur just after almost every syllable. Therefore,
without Korean language supporting packages the line breaking and
justification of paragraphs will not be satisfactory.
However when just single or a few Hangul characters are needed, for example in the case of typesetting
the author's name in Hangul, this package provides a casual way to print them out.


\section{Transliteration Rule of This Package}\label{sec:rule}

\subsection{Tone Marks and Syllable Serapator}

This package assumes that every Hangul syllable has \emph{Tone Mark} which
must be explicitly put at the end of it. Table~\ref{tab:tonemark} 
shows the input scheme of them.

\begin{table}[h]
\centering
\caption{Tone Marks} \label{tab:tonemark}
\begin{tabular}{c|l}
\hline
input & description \\ \hline
\texttt{/} & for \emph{PyeongSeong}, no dot \\ \hline
\texttt{;} & for \emph{GeoSeong}, single dot on the left of a character, [U+302E] \\ \hline
\texttt{:} & for \emph{SangSeong}, double dots on the left of a character, [U+302F] \\ \hline
\end{tabular}
\end{table}

The tone marks were used in the 15th century, but in the modern Korean they are
out of use. Nevertheless the \verb|/| mark in this package is also used in order to depict
the completion of composing a syllable --- i.e., syllable separator. So DO NOT miss it.

However, it is possible to omit `\verb|/|' mark at the end of a word, i.e., just before \texttt{<space>}, or at the end of the argument of \verb|\jamoword|.
Note that before the puctuation mark --- period, comma, etc., omitting \verb|/| is not permitted.

\subsection{Consonants}

Table~\ref{tab:cons} shows the transliteration rule for the consonants which are
used in the leading and trailing position of a syllable.

\begin{table}[h]
\centering
\caption{Consonants} \label{tab:cons}
\fontspec{UnDotum.ttf}
\begin{tabular}{ll|ll|ll|ll}
\hline
ㄱ & g & ㄴ & n & ㄷ & d & ㄹ & r \\
ㅁ & m & ㅂ & b & ㅅ & s & ㅇ & \textbf{x} \\
ㅈ & j & ㅊ & c & ㅋ & k & ㅌ & t \\
ㅍ & p & ㅎ & h & \char"3181 & \textbf{q} & \char"317F & \textbf{z} \\
\char"3186 & \textbf{f} & & w & & & & \\
\hline 
\end{tabular}
\end{table}

\begin{enumerate}
\item The corresponding letters ``g, n, d, m, b, s, j, k, t, p, h'' are 
the same as Korean Romanization Method (RRK).\footnote{The \emph{Revised Romanization of Korean} 1995:2000 is the official Korean language romanization system in South Korea.}
\item The letter for `\textkorean{\jmcc{R}}' is allocated to \texttt{r} not \texttt{l}. The latter is reserved for another purpose, cf. item \ref{itm:llr}.
\item The letter `c' is for `\textkorean{\jmcc{C}}'. In the RRK, it is `\texttt{ch}' there.
\item The letter for `\textkorean{\jmcc{X}}' is \texttt{x}, which is a bit strange, but commonly accepted `\texttt{ng}' was not to be chosen. It is reserved for another consonant `\textkorean{\jamoword{@ng/}}'
\item The letters `q, z, f' are more freely selected. These letters are the lost ones in Modern Korean.
\item The letter `w' is chosen to present \emph{Choseong Filler}.
%\footnote{\emph{Jungseong Filler} is not provided.} 
\item\label{itm:llr} The letters `l' and `lr' are 
prepared for very rare case. In the 15th century Korean, `\textkorean{\jamoword{sla}}' and
`\textkorean{\jamoword{slra}}' were distinguishable. `sl' is chosen for the SIOS with left branch being longer, and `slr' means right branch longer. The same is the case `ssl', `sslr', `jl', `jlr' etc.
\item The `light labial consonants', \textkorean{\jmcc{BX}, \jmcc{PX}} in the Old Hangul can be input as `bx, px, bbx, mx'. 
\item In the Modern Korean, only `gg, dd, bb, ss, jj' are additionally permitted in the leading consonant position,
But in the Old Hangul this limitation was not applied. So \emph{Choseong} can have multiple consonants, e.g., `bsg', `bsd', `ss', `sd' etc.
\item The leading `zero consonant' can be omitted. So if a syllable begins with vowel, then the leading `\textkorean{\jmcc{X}}' will appear. You can write the leading `x' of a syllable or not.
For example, `\verb|\jamoword{xax}|' and `\verb|\jamoword{ax}|' will generate the same result `\jamo{xax}'.
\end{enumerate}

\subsection{Vowels}

Table~\ref{tab:vow} shows the transliteration rule for vowels. 

\begin{table}[h]
\centering
\caption{Vowels}\label{tab:vow}
\ttfamily\fontspec{UnDotum.ttf}
\begin{tabular}{ll|ll|ll|ll|ll}
\hline
ㅏ & a & ㅓ & e & ㅗ & o & ㅜ & u & ㅡ & \textbf{v} \\
ㅣ & i & \jmcc{@} & \textbf{@}  & & & & & & \\ \hline
ㅑ & ya & ㅕ & ye & ㅛ & yo & ㅠ & yu & \kern-.3em\jmcc{@}\kern-.6em\jmcc{@} & @@ \\ \hline
ㅐ & ay, ai & ㅔ & ey, ei & ㅚ & oy, oi & ㅟ & uy, ui & ㅢ & vy, vi \\ 
ㅒ & yay, yai & ㅖ & yey, yei & \jmcc{YOI} & yoi & \jmcc{YUI} & yui & \jmcc{@I} & @i \\ \hline
ㅘ & oa & ㅙ & oay, oai & ㅝ & ue & ㅞ & uey, uei &  & * \\ \hline
\end{tabular}
\end{table}

\begin{enumerate}
\item The rule for vowels may look a bit unfamiliar. But it is simple and easily rememberable.

\item The letter `v' is never considered to be a vowel. But this package 
determined it to stand for the vowel `\textkorean{\jmcc{V}}'. In fact,
the roman alphabets fall short of the vowels. This allocation is arbitrary.

\item The lost `Arae-A' is allocated to `@', and the rare `Double Arae-A' to `@@', which are forgotten vowels in Modern Korean.

\item The \emph{Jungseong Filler} ([U+1160]) can be input with \verb|*|. For example, \verb|\jamoword{h*n}| renders \jamoword{h*n}.
\end{enumerate}

\subsection{Compatibility Jamos}

The compatibility Jamo block in Unicode contains several Hangul Jamo characters,
which cannot be used to compose Hangul syllables, and are considered
independent Jamo characters respectively.

To input the compatibility Jamos in the arguments of \verb|\jamoword| or \verb|jamotext|, 
you are to type them in their capital letters (upper cases). And every compatibility Jamo has to be
separated with syllable separator --- \verb|/|. 
Because the \verb|@| character has no upper case, write \verb|W| instead of \verb|@| to display compatibility `Arae-A'.

Here is an example:
\begin{quote}
\begin{verbatim}
\jamoword{W/nvn a/rai/a/ra/go bu/rv/go A/oa 
    bi/svs/ha/gei irg/nvn/da}
\end{verbatim}
\textkorean{\jamoword{W/nvn a/rai/a/ra/go bu/rv/go A/oa bi/svs/ha/gei irg/nvn/da}}
\end{quote}


\section{Proper Fonts}\label{sec:font}

In order to typeset Hangul characters successfully with the input method
of this package, the help of the \emph{proper} font is crucial.
What we call \emph{proper} font is the font that has the Opentype feature of `Script Hangul', that is, the feature of conjoining jamo characters.
A Truetype font may have this Opentype feature.
Otherwise, it is regarded as an \emph{improper} font.

Not so many fonts are \emph{proper}. 
The fonts or font families listed in the following lines are 
what we know \emph{proper}.
They can be downloaded from the url and used freely. And note that
\texttt{UnBatang} is already installed in your \TeX\,Live installation.

\begin{description}
\item[Hamchorom LVT] Hamchorom fonts by Hancom Inc., and their variants with GSUB tables by KTS (the Korean \TeX\ Society).  \url{https://github.com/dohyunkim/hcr-lvt}
\item[KoPub World] free fonts by Korea Publisher Society. \url{http://www.kopus.org/biz-electronic-font2/}
\item[Malgun Gothic] One of Windows 10 system font. 
\item[Nanum Yet Hangul] Two font families from Naver. Nanum Myeongjo Yet Hangeul and Nanum Barun Gothic Yet Hangeul. \url{https://hangeul.naver.com/2014/archaicword}
\item[Noto CJK or Source Han] Google's Noto CJK fonts. Or Adobe's Source Han fonts. \url{https://www.google.com/get/noto/help/cjk/}
\item[Un Batang] \verb|UnBatang.ttf|. on CTAN. \url{https://ctan.org/pkg/unfonts-core}
\end{description}

To use one of these fonts, do not forget to provide
the \texttt{[Script=Hangul]} option.\footnote{%
	the option should be \\
	\texttt{[Script=Hangul,Renderer=Harfbuzz]}\\
	or\\
	\texttt{[Script=Hangul,Renderer=OpenType]},\\
	when the document is processed with \LuaLaTeX.}
%	The \LuaLaTeX\ version should be over 1.11, that is,
%	the \LaTeX\ format of LuaHB\TeX\ is needed.}
For example, you can specify
Hamchorom Batang LVT font as:
\begin{verbatim}
\newfontfamily\pmjamofont{HCR Batang LVT}[Script=Hangul]
\end{verbatim}
and then issue \verb|\pmjamofont| command in the scope of Hangul to be typeset.
It is recommended that the \emph{proper} font should be used consistently.

\medskip

In case the font you take is not \emph{proper}, you are to meet the warning
message at the console and log file,
\begin{verbatim}
 Package fontspec Warning: (fontspec)
 Font "batang" does not contain requested Script "Hangul".
\end{verbatim}
However, when \XeLaTeX\ is concerned, it is known that the \emph{Modern} Korean Characters (\emph{Hangul Precomposed Syllables} in the Unicode block [U+AC00] -- [U+D7A3]) can be rendered with this kind of font, in spite of the warning message. 


\section{Examples}\label{sec:exam}

Now, we will show a few practical examples, where
the \emph{korean} environment of \pkg{polyglossia} package is used.
The preamble is like this:

\begin{verbatim}
\usepackage{pmhanguljamo}
\usepackage{polyglossia}
\setotherlanguage{korean}
\newfontfamily\hangulfont{UnBatang.ttf}[Script=Hangul]
\end{verbatim}

\subsection{Modern Hangul}\label{sec:exammodern}

%\begin{verbatim}
%\begin{korean}
%\begin{jamotext}
%e/rin/i/nvn na/ra/oa gye/rey/vi ap/nar/vr i/e/na/gar 
%sai/sa/ram/i/mv/ro gv/dvr/vi mom/goa ma/vm/vr gui/hi 
%ye/gye orh/go a/rvm/dab/go ssig/ssig/ha/gey ja/ra/do/rog 
%him/sse/ya han/da/.
%\end{jamotext}
%\end{korean}
%
%\begin{enumerate}
%\item \textkorean{\jamoword{e/rin/i/nvn in/gan/v/ro/se 
%jon/jux/ha/ye/ya ha/mye sa/hoi/vi han sa/ram/v/ro/se 
%or/ba/rv/gey ki/ue/ya han/da/.}}
%\end{enumerate}
%\end{verbatim}
%
%\begin{quotation}
%\begin{korean}
%\begin{jamotext}
%e/rin/i/nvn na/ra/oa gye/rey/vi ap/nar/vr i/e/na/gar 
%sai/sa/ram/i/mv/ro gv/dvr/vi mom/goa ma/vm/vr gui/hi 
%ye/gye orh/go a/rvm/dab/go ssig/ssig/ha/gey ja/ra/do/rog 
%him/sse/ya han/da/.
%\end{jamotext}
%\end{korean}
%
%\begin{enumerate}
%\item \textkorean{\jamoword{e/rin/i/nvn in/gan/v/ro/se 
%jon/jux/ha/ye/ya ha/mye sa/hoi/vi han sa/ram/v/ro/se 
%or/ba/rv/gey ki/ue/ya han/da/.}}
%\end{enumerate}
%\end{quotation}

\begin{verbatim}
\begin{verse}
\begin{korean}
\begin{jamotext}
na bo/gi/ga yeg/gye/ue \\
ga/sir ddai/ei/nvn \\
mar ebs/i go/i bo/nai dv/ri/u/ri/da/.

yex/byen/ei yag/san \\
jin/dar/rai ggoc \\
a/rvm dda/da ga/sir gir/ei bbu/ri/u/ri/da/.

ga/si/nvn ger/vm ger/vm \\
noh/in gv ggoc/vr \\
sa/bbun/hi jv/rye/barb/go ga/si/ob/so/se

na bo/gi/ga yeg/gye/ue \\
ga/sir ddai/ei/nvn \\
jug/e/do a/ni nun/mur hvr/ri/u/ri/da/.
\end{jamotext}
\end{korean}
\end{verse}
\end{verbatim}

\begin{verse}
\begin{korean}
\begin{jamotext}
na bo/gi/ga yeg/gye/ue \\
ga/sir ddai/ei/nvn \\
mar ebs/i go/i bo/nai dv/ri/u/ri/da/.

yex/byen/ei yag/san \\
jin/dar/rai ggoc \\
a/rvm dda/da ga/sir gir/ei bbu/ri/u/ri/da/.

ga/si/nvn ger/vm ger/vm \\
noh/in gv ggoc/vr \\
sa/bbun/hi jv/rye/barb/go ga/si/ob/so/se

na bo/gi/ga yeg/gye/ue \\
ga/sir ddai/ei/nvn \\
jug/e/do a/ni nun/mur hvr/ri/u/ri/da/.
\end{jamotext}
\end{korean}
\end{verse}

\subsection{pre-1933 Hangul}

A 15th century text with tone marks (\emph{BangJeom}).

\begin{verbatim}
\begin{korean}
\begin{jamotext}
	na/ras;mar:ss@/mi;
	中dyuq/國guig;ei; dar/a;
	文mun/字jj@x;oa;ro; se/rv/ s@/m@s/di; a/ni;h@r/ss@i;
	i;ren jyen/c@;ro; e/rin; 百b@ig;姓syeq;i; 
	ni/rv/go;jye; horf; bai; i/sye;do;
	m@/c@m;nai: jei bdv;dvr; si/re; pye/di; mod:h@rf no;mi; ha/ni;ra;
\end{jamotext}
\end{korean}
\end{verbatim}

\begin{quote}
\begin{korean}
\begin{jamotext}
	na/ras;mar:ss@/mi;
	中dyuq/國guig;ei; dar/a;
	文mun/字jj@x;oa;ro; se/rv/ s@/m@s/di; a/ni;h@r/ss@i;
	i;ren jyen/c@;ro; e/rin; 百b@ig;姓syeq;i; 
	ni/rv/go;jye; horf; bai; i/sye;do;
	m@/c@m;nai: jei bdv;dvr; si/re; pye/di; mod:h@rf no;mi; ha/ni;ra
\end{jamotext}
\end{korean}
\end{quote}

And another example of 17th century, from \jamo{du/si/en/hai}, \emph{Selected Translations of 
Du Fu's Poems}, without tone marks.

\begin{verbatim}
\begin{verse}
\begin{korean}
\begin{jamotext}
g@/r@/mi p@/r@/ni sai de/ug h@i/o/,\\
moy/hi pe/re/h@/ni gos/ bi/ci bvr bvd/n@n d@s/do/da/.\\
ors bo/mi bon/d@in sdo di/na/ga/n@/ni \\
e/nv na/ri i do/ra/gar h@i/o/.
\end{jamotext}
\end{korean}
\end{verse}
\end{verbatim}

\begin{verse}
\begin{korean}
\begin{jamotext}
g@/r@/mi p@/r@/ni sai de/ug h@i/o/,\\
moy/hi pe/re/h@/ni gos/ bi/ci bvr bvd/n@n d@s/do/da/.\\
ors bo/mi bon/d@in sdo di/na/ga/n@/ni \\
e/nv na/ri i do/ra/gar h@i/o/.
\end{jamotext}
\end{korean}
\end{verse}

\let\jamoword\relax
\let\jamotext\relax
\let\endjamotext\relax
\ExplSyntaxOn
\input pmhanguljamo-rrk.sty
\ExplSyntaxOff


\section{The RRK Input Method: An Alternative Way} \label{sec:rrk}

In chapter 3 section 8 of \emph{Revised Romanization of Korean} (2000),
the `transliteration method' of Hangul romanization is declared. 
It is exceptionally permitted when it is required to restore
the original Hangul writings, while standard is the phonetic transcription one.
So we can make use of the former as an input method.

If the package option \texttt{[RRK]} or \texttt{[rrk]} is given, 
the RRK method is activated. In this case, only `Modern Hangul' can
be available. 

\subsection{Transliteration Rule of RRK}

Table~\ref{tab:rrkcons} and \ref{tab:rrkvow} show the
RRK transliteration rule.

\begin{table}[h]
\centering
\caption{RRK Consonants} \label{tab:rrkcons}
\fontspec{UnDotum.ttf}
\begin{tabular}{ll|ll|ll|ll|ll|ll}
\hline
ㄱ & g & ㄲ & kk & ㅋ & k & ㄷ & d & ㄸ & tt & ㅌ & t \\
ㅂ & b & ㅃ & pp & ㅍ & p & ㅈ & j & ㅉ & jj & ㅊ & ch \\
ㅅ & s & ㅆ & ss & ㅎ & h & & & & & & \\ \hline
ㄴ & n & ㅁ & m & ㅇ & ng & ㄹ & l & & & & \\ \hline
\end{tabular}
\end{table}

\begin{table}[h]
\centering
\caption{RRK Vowels} \label{tab:rrkvow}
\fontspec{UnDotum.ttf}
\begin{tabular}{ll|ll|ll|ll|ll||ll}
\hline
ㅏ & a & ㅓ & eo & ㅗ & o &  ㅜ & u & ㅡ & eu & ㅣ & i\\ 
ㅐ & ae & ㅔ & e & ㅚ & oe & ㅟ & wi &  & & & \\ \hline
ㅑ & ya & ㅕ & yeo  & ㅛ & yo & ㅠ & yu & ㅒ & yae & ㅖ & ye \\
ㅘ & wa & ㅙ & wae & ㅝ & wo & ㅞ & we & ㅢ & ui & &  \\ \hline
 \end{tabular}
 \end{table}

\begin{enumerate}
\item When the leading consonant `{\fontspec{UnBatang}\jmcc{X}}' is placed
at the head of a word, it can be ommitted. Otherwise the hyphen character (\verb|-|) should be put. For example, \\
\verb|\jamoword{annyeonghase-yo}| \textkorean{\jamoword{annyeonghase-yo}} \\
\verb|\jamoword{jung-ang jungang}| \textkorean{\jamoword{jung-ang jungang}} \\
\verb|\jamoword{ha-yeossseubnida}| \textkorean{\jamoword{ha-yeossseubnida}}

\item The hyphen character \verb|-| can be used to forcibly separate syllables.
And the special character \verb|/| is taken as another syllable separator.
They are exchangeable.\\
\verb|\jamoword{haeb/ssal haeb-ssal}| \textkorean{\jamoword{haeb/ssal haeb-ssal}}

\item The six pucntuation marks, \texttt{.} \texttt{,} \texttt{!} \texttt{?} \texttt{;} \texttt{:} can be located in the Hangul scope.
The others are not allowed.\\
\verb|\jamoword{a! malg-eun haneul, si-wonhan baram.}| \\
\textkorean{\jamoword{a! malg-eun haneul, si-wonhan baram.}}\\
The \LaTeX\ quotes, \verb|``|, \verb|''|, \verb|`| and \verb|'| cannot be used
within Hangul input scope. They should be located outside.
However you can use unicode quotes, \verb|“| and \verb|”|, which can be input
with syllable separator. For example, \\
\verb|\jamoword{“/hangeul/”/ilan hangug-eoleul jeogneun geul-ida.}|\\
\textkorean{\jamoword{“/hangeul/”/ilan hangug-eoleul jeogneun geul-ida.}}\\
In this case, the syllable separator \verb|/| cannot be replaced by hyphen character.

\item The leading consonant `\textkorean{\jmcc{R}}' is written with 
either \texttt{l} or \texttt{r}, while the trailing one should be \texttt{l}.\\
\verb|\jamoword{noraereul nolaeleul}| \textkorean{\jamoword{noraereul nolaeleul}}

\item We made it possible to use `Arae-A' with the RRK method.
Though it is not present in Modern Hangul writing system, typesetting
`Jeju language' or some pre-1933 Korean texts will be made easy with this.
The `Arae-A' is to be input as `\texttt{@}' character, and the `Double Arae-A' `\texttt{@@}'. There is one exception. The one word with one letter that
has only leading `@', i.e., \textkorean{\jamoword{x@}} should be input by `\verb|x@|'. 
If the syllable has trailing consonants or is part of a word, just \verb|@| is
good. \\
\verb|\jamoword{h@ngeul @@nam-eun}| \textkorean{\jamoword{h@ngeul @@nam-eun}}. 
\end{enumerate}

\subsection{Example of RRK method}

The text is one of the most famous poem in Korean, \textkorean{\jamoword{jindallaekkoch}} \emph{Azalea} by Kim So-wol.\footnote{%
	An English translation of this poem can be read in Wikipedia, 
	\url{https://en.wikipedia.org/wiki/Kim_Sowol}.}
In section~\ref{sec:exammodern}, we showed default way of inputting 
the poem. The \textit{korean} environment and font settings are 
the same as in section~\ref{sec:exam}.

\begin{verbatim}
\begin{verse}
\begin{korean}
\begin{jamotext}
na bogiga yeoggyeo-wo \\
gasil ttae-eneun \\
mal eobs-i go-i bonae deuli-ulida.

yeongbyeon-e yagsan \\
jindallae kkoch \\
aleum ttada gasil gil-e ppuli-ulida.

gasineun geol-eum geol-eum \\
noh-in geu kkoch-eul \\
sappunhi jeulyeobalbgo gasi-obsoseo

na bogiga yeoggyeo-wo \\
gasil ttae-eneun \\
jug-eodo ani nunmul heulli-ulida.
\end{jamotext}
\end{korean}
\end{verse}
\end{verbatim}

\begin{verse}
\begin{korean}
\begin{jamotext}
na bogiga yeoggyeo-wo \\
gasil ttae-eneun \\
mal eobs-i go-i bonae deuli-ulida.

yeongbyeon-e yagsan \\
jindallae kkoch \\
aleum ttada gasil gil-e ppuli-ulida.

gasineun geol-eum geol-eum \\
noh-in geu kkoch-eul \\
sappunhi jeulyeobalbgo gasi-obsoseo

na bogiga yeoggyeo-wo \\
gasil ttae-eneun \\
jug-eodo ani nunmul heulli-ulida.
\end{jamotext}
\end{korean}
\end{verse}

\section{Further Information}


For more examples and information about this package, 
please read the documentation 
\href{http://mirrors.ctan.org/language/korean/pmhanguljamo/doc/pmhanguljamo-kdoc.pdf}{\texttt{pmhanguljamo-kdoc.pdf}}
(in Korean).


\section{Acknowledgement}

Thanks go to yihoze at the KTUG board, there he commented, 
``The IM apps I've tried such as Korean Windows Old Hangul IM or Saenaru IM 
were all somewhat inconvenient. $\ldots$\ 
In my opinion, for the foreign scholar who
studies Korean language, especially Middle Age Korean language, 
this kind of transliteration method may be much more convenient and
confident way of typesetting Korean than the keyboard IM solutions.''\footnote{\url{http://www.ktug.org/xe/index.php?mid=KTUG_open_board&document_srl=240134}}

\end{document}
