View source | View history | Atom feed for this file

This page describes how to use pLaTeX to typeset Japanese documents. I am using Debian Wheezy below.


It easy enough to simply download and install the entire TeXLive 2012 distribution with sudo aptitude install texlive-full; however, I am pretty sure only the CJK support is necessary for the following. To begin, therefore, install the CJK support package with:

sudo aptitude install texlive-lang-cjk

Check to see that the above installed platex; type platex into the terminal and see if you get:

This is e-pTeX, Version 3.1415926-p3.3-110825-2.4 (utf8.euc) (TeX Live 2012/Debi
 restricted \write18 enabled.

(Ctrl-D to escape.)

We are now ready for our first document. This how-to will assume that the filename is called hello_world.tex.

Enter the following body of text using any text editor (copy-pasting is fine); assuming you are familiar with the syntax of LaTeX (or similar), the following should also look familiar:

    %% See for the
    %% differences between jarticle and jsarticle, but beware, the page
    %% is in Japanese.
    %% For useful features such as `\ruby{漢字}{かんじ}` for furigana and
    %% `\kenten{}` for dots above characters for emphasis.
    %% For the Japanese double-width dash; this is much easier than hunting
    %% around for the right type of dash.
    %% Again, this is easier than looking for the correct unicode
    %% character.
%% When compiling, use the command (on the command line):
    %%`platex hello_world.tex && dvipdfmx -f /usr/share/texlive/texmf-dist/fonts/map/dvipdfmx/jfontmaps/ hello_world.dvi`


\section{\LaTeX\ 入門}

    \int_1^x \frac{1}{t}\,dt = \log x。
この他にも「\jell 」や「\jdash 」などの記号が、\LaTeX のコマンドを入力することによって出力できます。

\section{Introduction to \LaTeX}

Hello world.
To emphasize words, one can use the gothic font or dots above the characters---either one will work.
Mathematics is also possible:
    \int_1^x \frac{1}{t}\,dt = \log x.
One can also produce special typographic symbols such as ``\jell'' and ``\jdash'' by entering the correct \LaTeX\ commands.


To compile the document, run:

platex hello_world.tex && dvipdfmx hello_world.dvi

(Example output.)

However, we notice that the font is all gothic (sans-serif). To fix this, i.e., to use a mincho (serif) font, we must use a “font mapping”. I’m not entirely sure how font mappings work, but I think the general idea is that one wants to replace each character in the DVI file in succession using a “map” file and a font file, so that the desired font appears in the final PDF. Therefore, we use:

platex hello_world.tex && dvipdfmx -f /usr/share/texlive/texmf-dist/fonts/map/dvipdfmx/jfontmaps/ hello_world.dvi

(Example output.)

If the .map file is not located in the same place, use locate filename.


Below are sources that were especially helpful in finding out how to use platex. One thing that will be noticed is that all sources are in Japanese; this is to be expected, as platex was designed specifically to deal with Japanese typesetting. One goal in writing this article was to provide some of the material available in Japanese in English, so that English speakers may also typeset Japanese documents (for whatever reason).