# 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.

## Installation

### 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):`

`texmf/tex/format/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:`

`texmf/fonts/type/supplier/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. ftp.dante.de, follow this procedure.`

1. `ftp ftp.dante.de`
2. `[LOGIN] ftp`
`[PASSWD] ftp`
3. `cd pub/tex/language/korean`
4. `bin`
5. `get HLaTeX.tar.gz HLaTeX-0.99.tar.gz`
6. `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.`

- `josa.tab: 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/hind.ist: For index generation.`
- `contrib/hglo.ist: 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 omtrans.ch with contrib/teTeX-1.0.ch.diff.`

### `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 ftp.linguistik.uni-erlangen.de, follow the links below. The location in CTAN is /pub/tex/fonts/korean/HLaTeX.`

`Downloadable font files are:`

- UHC (Unified Hangul Code) Type1 fonts: Contains Hangul, Hanja and Symbol characters. This fonts can be used in LaTeX and Lambda. (supported by HLaTeX)

font | LATEX/Lambda | size
myoungjo | `uhc-myoungjo.tar.gz` | 10.5M
gothic | `uhc-gothic.tar.gz` | 8.3M
taza | `uhc-taza.tar.gz` | 1.3M
graphic | `uhc-graphic.tar.gz` | 3.2M
gungseo | `uhc-gungseo.tar.gz` | 5.3M
shinmun | `uhc-shinmun.tar.gz` | 4.7M
pilgi | `uhc-pilgi.tar.gz` | 2.3M
pen/penheulim | `uhc-pen.tar.gz` | 2.6M
bom | `uhc-bom.tar.gz` | 1.2M
yetgul | `uhc-yetgul.tar.gz` | 5.1M
jamo (mj/gt/nv/sr) | `uhc-jamo.tar.gz` | 4.1M

- `Moonttf TrueType fonts from Moonhwabu: Consists of Hangul characters only.`

- Moonhwabu TrueType fonts (moonttf.tar.gz: 7.7M) (Batang, Doteum, Gung, Hoonmin, Sseugi. supported by HLaTeX).

- wansung fonts: not supported anymore. Use this at your own risk.

font | MF | size | PS | size
hangul myoungjo | wsmj | 983K | pkmj | 1.3M
hangul gothic | wsgt | 30K | pkgt | 437K
taza(hangul, hanja, symbol) | taza | 41K | ptaza | 95K
hangul graphic | wsgr | 565K | pkgr | 661K
hangul saemyoungjo | wssm | 1.5M | pksm | 1.2M
hangul pilgi | wspg | 921K | pkpg | 1.2M
hangul bom | wsbm | 1.3M | pkbm | 970K
hangul gungseo | wsgs | 2.0M | pkgs | 1.3M
hangul mokgak | wsmg | 3.2M | pkmg | 2.8M
hangul outline | wsol | 9K | pkol | 11K
hangul yetgul | wsyt | 1.4M | pkyt | 1.3M
hangul pen | wspn | 2.7M | pkpn | 2.6M
hangul jamo (mj,gt,sr,nv) | jamo | 119K | pjamo | 140K
hanja myoungjo | hanja-myoungjo | 4.9M | pshanja-myoungjo | 3.2M
hanja gothic | hanja-gothic | 2.7M | pshanja-gothic | 1.9M
hanja gungseo | hanja-gungseo | 5.1M | pshanja-gungseo | 3.5M
symbol (mj,gt) | hsym | 517K | phsym | 487K
common macros | common | 22K |  |

You need to install macro files in the directory `unsupported/wansung` to use thesse fonts. Tar'ed and gzipped file is here.
- `Unsupported Wansung/Johab mixed fonts: pk files for 600dpi(Johab-Hangul-pk600.tar.gz)
  or
  300dpi(Johab-Hangul-pk300.tar.gz)
  and
  tfm(Johab-Hangul-tfm.tar.gz) file for both.`
`You need also oldhan.tar.bz2 to use them.`

### `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 psfonts.map in the directory texmf/dvips/base. HLaTeX provides two kinds of this map file.

- `For UHC PS fonts:`

- `uhc/config/uhc.map: 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-down.map: 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 psfonts.map file of dvips. Because dvips always looks for the configuration file config.ps in the directory texmf/dvips/config, you can insert following line, for example, to the end of the file config.ps, instead of appending to psfonts.map.`

`p +uhc.map`

`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 psfonts.map, 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
    texmf/fonts/{afm,type1}/uhc

`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:

      case
    $ps_to_pk in

        ps2pk)

          set x `echo "$psline" | sed
    's%[<["]%%g'`<["]%%g'`

          shift; shift; shift;

          encoding=; psname=; slant=;
    extend=

          while test ! -z "$1"; do

            case "$1" in

    *.enc)       encoding="-e
    $1";;

    *.pf[ab])    psname="$1";;

    *SlantFont)  slant="-S $lastopt";;

    *ExtendFont) extend="-E $lastopt";;

            esac

    lastopt="$1"

            shift

          done

          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
    's/8r$/8a/'`

          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" ];
    then

            echo "$progname:
    cannot find $NAME.pfa or $NAME.pfb. Trying gsftopk."
    >&2

            cmd="gsftopk $NAME
    $DPI"

            # make sure that
    gsftopk uses the psline from out mapfile:

            echo "$psline" >
    psfonts.map

    TEXFONTMAPS=.:$TEXFONTMAPS

          else

            cmd="ps2pk -v
    -X$DPI -R$BDPI $slant $extend $encoding $psname
    $NAME.${DPI}pk"

          fi

          ;;

`modified` mktexpk for ps2pk:

      case $ps_to_pk in

        ps2pk)

          PSRESOURCEPATH=`kpsewhich
    -format='dvips config' encoding.upr`

          export
    PSRESOURCEPATH=.:`dirname $PSRESOURCEPATH`

          set x `echo "$psline" | sed
    's%[<["]%%g'`<["]%%g'`

          shift; shift;

          psname=$1;

          shift;

          encoding=; slant=;
    extend=

          while test ! -z "$1";
    do

            case "$1"
    in

    *ReEncodeFont) encoding="-e$lastopt";;

    *SlantFont)    slant="-S $lastopt";;

    *ExtendFont)   extend="-E $lastopt";;

            esac

    lastopt="$1"

            shift

          done

          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 psfonts.map 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 ttfonts.map 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 ttfonts.map 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;
    then

      MODE=modeless

      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.:`

    \usepackage[hanja]{hangul}

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

`or`

    \fontseries{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.`

    \fontseries{bux}

- `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`

- `Erlanger (department of Computer Linguistics) mirror of ftp.nuri.net`

- `Hangul directory`
- `HLaTeX directory`

- `CTAN in Germany (ftp.dante.de)`

- `HLaTeX macro directory`
- `HLaTeX fonts directory`

- `CTAN in England (ftp.tex.ac.uk)`

- `HLaTeX macro directory`
- `HLaTeX fonts directory`

- `CTAN in USA (ctan.tug.org)`

- `HLaTeX macro directory`
- `HLaTeX fonts directory`

`Please send comments by email to koaunghi.un@student.uni-tuebingen.de`