The HLaTeX Homepage

Last modified:

This is the homepage of HLaTeX, A LaTeX package for Korean Document.

Current version of HLaTeX is 0.99. All files are archived with tar and compressed with gzip.

This page is for the people, who have problem in reading Korean language. If you do have no problem with Korean language, please go to the page in Korean.

In this page, you can get the installation instruction of HLaTeX and a brief instruction to use HLaTeX.


1. TDS -- Where to put TeX-related files.

TDS stands for TeX Directory Structure. Given a root directory `prefix' (`/usr/local' by default), TDS looks as follows:
bin/ executables
man/ man pages
info/ info files
lib/ libraries (`libkpathsea.*')
share/ architecture-independent files
The root TDS directory is designated by `texmf'. The location of this directory on the system is site-dependent. On Unix systems, `/usr/local/share', `/usr/local', `/usr/local/lib', and `/opt' are common choices.

The directories under the `texmf' root identify the major components of a TeX system, called top-level directories.

The top-level directories specified by the TDS are:

  • `tex' for TeX files.
  • `fonts' for font-related files.
  • `metafont' for METAFONT files which are not fonts.
  • `metapost' for MetaPost files.
  • `bibtex' for BibTeX files.
  • `doc' for user documentation.
  • `source' for sources.
  • `implementation' for implementations (examples: `emtex', `web2c'), to be used for whatever purpose deemed suitable by the implementor or TeX administrator. Files that cannot be shared between implementations, such as pool files (`tex.pool') and memory dump files (`plain.fmt') go here, in addition to implementation-wide configuration files.
  • `extension' for program-specific input files for new programs (examples: `etex', `pdftex', `omega') that are extensions of TeX, METAFONT, or any standard program.
  • `program' for program-specific input and configuration files for any TeX-related programs (examples: `mft', `dvips'). In fact, the `tex', `metafont', `metapost', `bibtex', and `extension' items above may all be seen as instances of this case.
TeX macro files shall be stored in separate directories, segregated by TeX format and package name (`format' means a usefully `\dump'-able package):


  • `format' is a format name (examples: `amstex', `latex', `plain', `texinfo')
    • `generic', for input files that are useful across a wide range of formats (examples: `null.tex', `path.sty').
    • `local', for local additions.
  • `package' is a TeX package name (examples: `babel', `texdraw').
    • `base', for the base distribution of each format, including files used by INITEX when dumping format files.
    • `hyphen', for hyphenation patterns, including the original American English `hyphen.tex'.
    • `images', for image input files, such as Encapsulated PostScript figures.
    • `local', for local additions and configuration files.
    • `misc', for packages that consist of a single file.
Font files shall be stored in separate directories, segregated by file type, font supplier, and typeface:


  • `type' is the type of font file. The TDS reserves the following `type' names:
    • `afm', for Adobe font metrics.
    • `gf', for generic font bitmap files.
    • `pk', for packed bitmap files.
    • `source', for font sources (METAFONT files, property lists, etc.).
    • `tfm', for TeX font metric files.
    • `type1', for Type 1 fonts (in any format).
    • `vf', for virtual fonts.
  • `supplier' is a name identifying font source (examples: `adobe', `ams', `public'). The TDS reserves the following `supplier' names:
    • `ams', for the American Mathematical Society's AMS-fonts collection.
    • `local', for local additions.
    • `public', for freely redistributable fonts where the supplier neither (1) requested their own directory (e.g., `ams'), nor (2) also made proprietary fonts (e.g., `adobe').
    • `tmp', for dynamically-generated fonts, as is traditional on some systems.
  • `typeface' is the name of a typeface family (examples: `cm', `euler', `times'). The TDS reserves the following `typeface' names:
    • `cm' (within `public'), for the 75 fonts defined in Computers and Typesetting, Volume E.
    • `latex' (within `public'), for those fonts distributed with LaTeX in the base distribution.
    • `local', for local additions.

Following TDS, the installation of HLaTeX results:

texmf/tex/latex/hlatex macro files for LaTeX

texmf/omega/latex/hlatex macro files for lambda

texmf/fonts/format/supplier/shape font files

2. Installation of HLaTeX macro files

All macro files and configuration files are in HLaTeX-0.99.tar.gz. If you want to get this from CTAN, e.g., follow this procedure.
  1. ftp
  2. [LOGIN] ftp

  3. [PASSWD] ftp
  4. cd pub/tex/language/korean
  5. bin
  6. get HLaTeX.tar.gz HLaTeX-0.99.tar.gz
  7. quit
For the installation of macro files, this tar'ed and gzip'ed file should at first be unpacked in an empty directory, e.g. /usr/src. (For the source file from CTAN, you don't need to make an empty directory. If you unpack it in the directory /usr/src, a subdirectory HLaTeX will be created.)
  1. mkdir /usr/src/HLaTeX-0.99
  2. cd /usr/src/HLaTeX-0.99
  3. gunzip -c HLaTeX-0.99.tar.gz | tar xvf -
In this directory, files should be put in the directory:
  • texmf/tex/latex/hlatex:
    • hangul.sty: style file for Korean document.
    • hfont.tex: processes Korean codes for LaTeX.
    • hfont.sty: style file, which only enables LaTeX to recognize Korean letters in a document.
    • UHC font description files:
      • hswmj.fd hswgt.fd hswtt.fd hswgr.fd hswgs.fd hswsh.fd: Symbol fonts in PS format.
      • hwwmj.fd hwwgt.fd hwwtt.fd hwwgr.fd hwwgs.fd hwwsh.fd hwwbm.fd hwwpg.fd hwwph.fd hwwpn.fd hwwyt.fd hwwjmj.df hwwjgt.fd hwwjnv.fd hwwjsr.fd: Hangul fonts in PS format.
      • hhwmj.fd hhwgt.fd hhwtt.fd hhwgs.fd hhwsh.fd hhwyt.fd: Hanja fonts in PS format.
    • Moonhwabu font description files:
      • hwmbt.fd hwmdt.fd hwmgs.fd hwmgh.fd hwmhm.fd hwmsg.fd hwmsh.fd: Hangul fonts in TTF format.
    • table for automatic decision of josa.
    • texmf/omega/latex/hlatex:
      • ksx1001.tex: used by lambda to process Korean documents written in KS X 1001 coding system.
      • UHC font description files:
        • uhcmj.fd uhcgt.fd uhctt.fd uhcgr.fd uhcgs.fd uhcsh.fd uhcpg.fd uhcpn.fd uhcph.fd uhcbm.fd uhcyt.fd uhcjmj.fd uhcjgt.fd uhcjnv.fd uhcjsr.fd: Symbol, Hangul, Hanja fonts in PS format in KS X 1001 scheme.
    • texmf/omega/otp:
      • uhc/lambda/ksx1001.otp: Omega Translation Process file for KS X 1001 coding system.
    • texmf/omega/ocp:
      • uhc/lambda/ksx1001.ocp: compiled version of ksx1001.otp.
    • texmf/tex/latex/local:
      • hfont.cfg: sets default fonts or the relationship between external font and internal font of HLaTeX as system administrative purpose.
    • texmf/bibtex/bst/misc:
      • contrib/halpha.bst: needed by BibTeX for proper processing Korean letters.
    • texmf/makeindex:
      • contrib/ For index generation.
      • contrib/ For glossary generation.
    • TeX's binary directory:
      • contrib/hlambda: post-process outputs of Lambda to convert hexadecimal notation to Korean character. Not needed, if you compiled TeX system after patching with contrib/

    3. Installation of Fonts

    For the installation of fonts, you need to decide, which fonts you want to use.

    Current release of HLaTeX relies on the UHC fonts, which contains all Korean letters defined in the Unicode (currently the characters defined in KS X 1001 are accessible).

    Moonttf is consist of characters only in KS X 1001. When Unicode is wide-spread, these fonts cannot be used for Unicode.

    Unsupported Wansung/Johab mixed fonts and Wansung fonts are only for the people, who need them. HLaTeX doesn't support these fonts.

    You can also install all these fonts and use them together in a document. Be aware in this case, that the unsupported Wansung/Johab mixed fonts cannot be used with other fonts.

    The installation process after the above decision is very simple. You need to get and unpack the font files in the TeX's fonts directory.

    cd texmf/fonts

    gunzip -c ???.tar.gz | tar xvf -

    If you get font files from, follow the links below. The location in CTAN is /pub/tex/fonts/korean/HLaTeX.

    Downloadable font files are:

    4. Configuration of the installed Fonts

    For LaTeX/Lambda to work properly, you don't need anything but the TeX metric files (tfm). Once you have a formatted document (dvi file), the dvi drivers(e.g. dvips or xdvi) request the actual informations of the characters used. These informations are mostly in pk files, which are created in general from MF sources.

    If you use PS fonts or other types of font (e.g. TTF fonts), these fonts should be known to the drivers.

    dvips, for example, wants to know the relationship between the filename of tfm font and the name of PS font. If the filename of PS font is given in the configuration file, the PS font is assumed not to be resident in the PS printer. This information is stored in a file in the directory texmf/dvips/base. HLaTeX provides two kinds of this map file.

    • For UHC PS fonts:
      • uhc/config/ configures UHC fonts as resident font. This configuration works, if you use ghostscript as the PS interpreter. In this case the map between PS name and PS file name must be known to ghostscript via Fontmap file of ghostscript.
      • uhc/config/ UHC fonts are partially downloaded. All kind of PS interpreter will work with the resulting output of dvips without any other configuration for the interpreter.
    These map files can be directly appended to the existing file of dvips. Because dvips always looks for the configuration file in the directory texmf/dvips/config, you can insert following line, for example, to the end of the file, instead of appending to


    xdvi, on the other hand, cannot deal with PS font file. Another utility should provide pk files to xdvi for previewing a document containing PS fonts. gsftopk or ps2pk is the common component of TeX for this job. xdvi also need, to decide whether the font in question comes from PS font. This is done in the script mktexpk of web2c-TeX system.

    • If configured to use gsftopk for this task, gsftopk returns only the rendering information to ghostscript. For this reason, ghostscript should know the relationship of the names of font in it's mapping file Fontmap. The location of Fontmap depends on the installation of ghostscript. The default installation (prefix is set to the directory /usr/local) will result to the location /usr/local/share/ghostscript/5.50/Fontmap for the ghostscript version 5.50. HLaTeX provides uhc/config/Fontmap.uhc for UHC PS fonts and wansung/config/Fontmap.wan for Wansung PS fonts, which can be appended to the existing Fontmap file of ghostscript. Because ghostscript and TeX has nothing directly to do with each other, the location of TeX's PS font files is not known to ghostscript in general. In the HLaTeX's Fontmap files the path of the fonts is given absolutely, assuming the location of texmf as /usr/tex/share/texmf. If the location of texmf differs with your's, you should correct the absolute path of the font files, before appending them to ghostscript's Fontmap.
    • ps2pk is another utility with other mechanism to generate pk files from PS font files. It doesn't need ghostscript as a rendering machine. It interprets PS font files directly and generates pk files from the PS codes of the font files. There exist currently two versions of the same ps2pk (version 1.5), ps2pk distributed with web2c (named as ps2pkm but installed as ps2pk) and the original one.
      • The original ps2pk works with PS resource file, in which all informations about PS name and the location of the font files, encoding files, etc. are stored. You need to generate such resource files in the directory where ps2pk tries to find them. It doesn't matter, where the PS font files reside, because ps2pk relies on the informations in the PS resource file. The extension of PS resource file is upr on the UNIX operation system and dpr on the DOS system. mkpsres accompanied by ps2pk distribution can generate such resource file as follows.
      • mkpsres -o texmf/dvips/ps2pk/uhc.upr
        Some OS's, which use PS fonts to display screen font, have their own version of mkpsres. In this case, you can also use the upr files on the system directly, if you set the environment variable PSRESOURCEPATH to point to that directory (look at the directory /usr/lib/DPS or so). HLaTeX ships uhc/config/uhc.upr and wansung/config/wansung.upr assuming texmf as /usr/tex/share/texmf. If your's is not the same as this, you can edit the 6th line of each file to the correct path and copy them to texmf/dvips/ps2pk. Because the mktexpk script of web2c TeX distribution is not written for this original ps2pk, you need to modify it as follows.

        original mktexpk for ps2pk:

        $ps_to_pk in
              set x `echo "$psline" | sed
              shift; shift; shift;
              encoding=; psname=; slant=;
              while test ! -z "$1"; do
                case "$1" in
        *.enc)       encoding="-e
        *.pf[ab])    psname="$1";;
        *SlantFont)  slant="-S $lastopt";;
        *ExtendFont) extend="-E $lastopt";;
              test -n "$psname"
                { pfa=`(kpsewhich
        $NAME.pfa 2>/dev/null)`; psname=$pfa; }
              test -n "$psname"
                { pfb=`(kpsewhich
        $NAME.pfb 2>/dev/null)`; psname=$pfb; }
              ANAME=`echo $NAME | sed
              test -n "$psname"
                { pfa=`(kpsewhich
        $ANAME.pfa 2>/dev/null)`; psname=$pfa; }
              test -n "$psname"
                { pfb=`(kpsewhich
        $ANAME.pfb 2>/dev/null)`; psname=$pfb; }
              if [ -z "$psname" ];
                echo "$progname:
        cannot find $NAME.pfa or $NAME.pfb. Trying gsftopk."
                cmd="gsftopk $NAME
                # make sure that
        gsftopk uses the psline from out mapfile:
                echo "$psline" >
                cmd="ps2pk -v
        -X$DPI -R$BDPI $slant $extend $encoding $psname
        modified mktexpk for ps2pk:
          case $ps_to_pk in
        -format='dvips config' encoding.upr`
              set x `echo "$psline" | sed
              shift; shift;
              encoding=; slant=;
              while test ! -z "$1";
                case "$1"
        *ReEncodeFont) encoding="-e$lastopt";;
        *SlantFont)    slant="-S $lastopt";;
        *ExtendFont)   extend="-E $lastopt";;
              cmd="ps2pk -v -X$DPI -R$BDPI
        $slant $extend $encoding $psname $NAME.${DPI}pk"
        This modification works fine, if you make a PS resource file encoding.upr as follows:

        mkpsres -o texmf/dvips/ps2pk/encoding.upr texmf/dvips/base

      • The ps2pk in the web2c distribution is modified so that, it can work with alone and utilizes the kpathsea library to find the PS font file to be rendered. It doesn't need an extra stuff for the configuration, but the PS fonts are to be known to TeX system and sometimes it fails to work due to not finding afm files.

    TTF is an another format of font file, which is widely used on MS Windows and MacIntosh Computers. In recent days, the development of TrueType font renderer for free programs was started and a working version is born (currently freetype version 1.3). Based on this library, ttf2pk was included in the freetype distribution, which convert TTF font files to pk files to be used in TeX. ttf2pk works similarly as ps2pk as the name implies. It looks in the file to find TTF font file for the name of tfm file. Because CJK fonts (CJK stand for Chinese, Japanese and Korean) have usually more than 256 characters in a font file, new mechanism is integrated to divide several thousands of characters to maximal 256 characters in each pk files, called subfont definition (file name extension is sfd). The Moonhwabu fonts distributed with HLaTeX fall into this category, HLaTeX provides moonttf/config/ttfonts.mhb, which can be appended to the file and moonttf/config/wansung.sfd, which should be copied to the configuration directory of ttf2pk. You may make a directory texmf/dvips/ttf2pk for its configuration files and insert following lines between PS font part and MF part:

    elif (ttf2pk -t -q $NAME) >/dev/null 2>&1;
      cmd="ttf2pk -q $NAME $DPI"
    This is taken from the mktexpk script from teTeX-0.9-981113 distribution with one modification: the option -p should be -q. (The switch -t above works only for the ttf2pk distributed with freetype-1.2.)

    Using HLaTeX

    1. In the preamble

    • To process document written in KS X 1001 code, hangul.sty should be included in the document preamble as follows.
    • \usepackage{hangul}
    • As any other packages, hangul.sty has some options to the package. They are:
      • hanja: The names defined in LaTeX (e.g. \partname, \tableofcontentsname, ...) are koreanized using Hanja. Without this option, the names are formatted in Hangul.
      • hardbold: \bfseries fonts are taken from the existing bold faces.
      • softbold: \bfseries fonts are made from the \mdseries fonts by overstriking the letter three times. This is the default.
      • nojosa: The function of automatic decision of Josa is depressed. This option reduces the amount of memory used by LaTeX.
      Options can be defined in the bracket, e.g.:
    • hfont.sty can be used instead of hangul.sty, to process documents containing Korean letters without other styling for Korean documents. In this case only the letters written in Korean will be recognized by LaTeX. The options above take no effects, when hfont.sty is in use.
    • If you have installed Wansung fonts,
    • \usepackage{wanfont}
      should occur after \usepackage{hangul}, to use these fonts. But remember, HLaTeX does not support these fonts anymore.
    • Similarly, following line lets Moonhwabu TTF fonts accessible to HLaTeX.
    • \usepackage{moonttf}

    2. In the body

    • Font switching takes place with usual LaTeX macros. e.g. \textrm, \textsf, \texttt, \rmfamily, \sffamily, \ttfamily, ... Koreanized macros exist also, e.g. \textmj, \textgt, \texttz, \mjfamily, \gtfamily, \tzfamily. The font switching mechanism is based on HFSS (Hangul Font Selection Scheme), a koreanized version of LaTeX's NFSS, by selecting font family with

      \hfontfamily{external family}

      "external family" is a sort of pseudo font family, which is mapped with internal font family with

      \MapHangulFamily{external family}{Hangul,Symbol,Hanja}.

      For example, \MapHangulFamily{pn}{wpn,wmj,wmj} maps pn family to Hangul Pen, Symbol Myoungjo and Hanja Myoungjo fonts. The default mapping is defined in hangul.sty, so you rarely need to use this macro. Following families are predefined in hangul.sty:

      gr(Graphic) gs (Gungseo) gh(GungHeulim) mg(Mokgak) pg(Pilgi) yt(Yetgul) bm(Bom) pn(Pen) ph(PenHeulim) sh(Shinmun) jmj(Jamo Myoungjo) jgt(Jamo Gothic) jnv(Jamo Novel) jsr(Jamo Sora)

    • The option softbold of hangul.sty sets \bfdefault to Sbx. If this option is not in use, you can force this effect with ordinary NFSS command as follows:
    • \renewcommand{\bfdefault}{Sbx}
    • When using UHC fonts, there are 4 different widths, c (75%), m (100%), x (125%), ux (200%), and the usual 2 weights, n (normal), b (bold) for a font.

    • The following NFSS command selects double width bold weight fonts.

    • HLaTeX also provides some numbering macros useful for Korean documents.

    • \jaso, \gana, \ojaso, \ogana, \pjaso, \pgana, \onum, \pnum, \oeng, \peng

    • If \ref or \pageref is used, it's not possible to know which Josa should be used due to the nature of Korean language. If you prefix the Josa with "\", then HLaTeX will decide the proper one. Because HLaTeX should look up a mapping table for this decision, more memory is required. If the memory usage is more important than the correct Grammer, you can use option nojosa for hangul.sty.
    • For bibliography and indexing/glossary, some modifications to the orignal behavior are made. For more detailed information, refer to hlguide.tex, which is written in Korean.

    Online Documents

    • Click here to read HLaTeX guide in Korean (converted with tth_C). Available also as PS file.
    • A part of HLaTeX guide, Korean dictionary for computer terminology published by Moonhwabu in 1997, is available as PS file and PDF file.

    Other links

    Please send comments by email to