LaTeX supports many worldwide languages by means of some special packages. In this article is explained how to import and use those packages to create documents in Japanese.
Contents |
Japanese language, just as many other oriental languages, requires special fonts and a particular document encoding.
\documentclass{article} \usepackage{xeCJK} \setCJKmainfont{AozoraMinchoRegular.ttf} \begin{document} \section{これは最初のセクションである} 日本語で \LaTeX の組版を実証するための導入部分。 フォントはまた、数学的な形態および他の環境で使用することができる \vspace{0.5cm} And you can also use Latin characters within your Japanese document. \end{document}
Documents in Japanese are usually formatted with the Japanese LaTeX distribution pLatex. But if you already have a LaTeX installation or want to compile your document on-line with ShareLaTeX you can use the CJK (Chinese, Japanese and Korean) package. Please note that the compiler will have to be set to XeLaTeX for this to work.
XƎLaTeX offers the possibility of importing external popular fonts or using the ones you already have in your Operating System:
\documentclass{article} \usepackage{xeCJK} \setCJKmainfont{AozoraMinchoRegular.ttf} \setCJKsansfont{KodomoRounded-Light.otf} \setCJKmonofont{KodomoRounded-Light.otf} \begin{document} \section{これは最初のセクションである} 日本語で \LaTeX の組版を実証するための導入部分。 フォントはまた、数学的な形態および他の環境で使用することができる \vspace{0.5cm} And you can also use Latin characters within your Japanese document. \vspace{1cm} \begin{verbatim} このテキストは、別のフォントを持つことになります This is a verbatim environment with mono-space font \end{verbatim} \end{document}
As you see, to set up a LaTeX document in Japanese is straightforward. Below is a description of each command:
\usepackage{xeCJK}
\setCJKmainfont{AozoraMinchoRegular.ttf}
\setCJKsansfont{KodomoRounded-Light.otf}
\setCJKmonofont{KodomoRounded-Light.otf}
verbatim
environment uses this font.
The CJTK
package can also be used to generate a document with pdfLaTeX. External fonts can not be used, so compiling with XeLaTeX is recommended.
\documentclass{article} \usepackage{CJKutf8} \begin{document} \begin{CJK}{UTF8}{min} \section{これは最初のセクションである} 日本語で \LaTeX の組版を実証するための導入部分。 フォントはまた、数学的な形態および他の環境で使用することができる \end{CJK} \vspace{1cm} \noindent Outside the environment Latin characters may be used. \end{document}
The line \usepackage{CJKutf8}
imports CJKutf8 which enables utf8 encoding for Chinese, Japanese and Korean fonts.
In this case every block of Japanese text must be typed inside a \begin{CJK*}{UTF8}{min}
environment. In this environment UTF8 is the encoding and min is the font to be used. You can also use the JIS encoding with the song font.
For more information see