summaryrefslogtreecommitdiff
path: root/language/korean/pmhanguljamo/doc/pmhanguljamo-doc.tex
blob: 83063ab4b3b13c7bc61cb4966f192fe43780711f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
%!TEX program = xelatex
% 
% pmhanguljamo-doc.tex
%.   written by Kangsoo Kim, 2020.
%
\documentclass[a4paper]{article}
\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]
%\newcommand*\jamo[1]{\begingroup\hangulfont\jamoword{#1}}
\newcommand*\jamo[1]{\textkorean{\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{20 Jan 2020\quad version 0.2.1}

\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 
enables to typeset Korean Letters (Hangul) with the help of proper fonts.
The name is from ``Poorman's Hangul Jamo Input Method.'' It is mainly for
the people who have a system without Korean 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', `Yet Ieung' or `Pan-Sios' etc.\ can also be typeset.

\XeLaTeX\ or \LuaLaTeX\ is required (\XeLaTeX\ recommended). The legacy pdf\TeX\ is not supported.
The Korean Language supporting packages such as \pkg{xetexko} or \pkg{luatexko} (in the ko.\TeX\ bundle)
or \pkg{polyglossia} 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}

\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/oa/haiss/da/.
\end{jamotext}
\end{verbatim}
The result will be like this:
\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/oa/haiss/da/.
\end{jamotext}
\end{korean}
\end{quote}


\subsection{Preamble of Document}

Without any other packages, you can type Hangul. Note that
proper fonts should be declared for Hangul, using \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 rule.
The line breaking can arise at the end of mostly every character. Therefore,
without Korean language supporting packages the line breaking and
justification of paragraphs will not be acceptable.
But 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}\label{sec:rule}

\subsection{Tone Marks and Syllable Serapator}

This package assumes that every Hangul syllable has 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}.
\item The letter `c' is for `\textkorean{\jmcc{C}}'. In the RRK, it is `\texttt{ch}' there.
\item Note that 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 should be reserved for `\textkorean{\jamoword{@ng/}}'
\item And 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}. 
\item The letters `l' and `lr' are 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 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.
\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/font.aspx}
\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] 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. 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}

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}

\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}

\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: jey 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: jey 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}

For more examples and information about this package, 
please read the documentation \texttt{pmhanguljamo-kdoc.pdf}
(in Korean).

\section{Acknowledgement}

Thanks go to yihoze at the KTUG board, there he commented, 
``The IMs 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 IM solutions.''\footnote{\url{http://www.ktug.org/xe/index.php?mid=KTUG_open_board&document_srl=240134}}

\end{document}