×

[edit] ShareLaTeX guides

[edit] LaTeX Basics

[edit] Mathematics

[edit] Figures and tables

[edit] References and Citations

[edit] Languages

[edit] Document structure

[edit] Formatting

[edit] Fonts

[edit] Presentations

[edit] Commands

[edit] Field specific

[edit] Class files

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

[edit] Introduction

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}

JapaneseEx1.png

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.

  Open an example in ShareLaTeX

[edit] CJK with XeLaTeX

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}

JapaneseEx3.png

As you see, to set up a LaTeX document in Japanese is straightforward. Below is a description of each command:

\usepackage{xeCJK}
This includes the package xeCJK which allows to use Chinese, Japanese and Korean fonts in a document to be compiled with XeLaTeX.
\setCJKmainfont{AozoraMinchoRegular.ttf}
The main font of this document. You can either download a font and put it in your current working directory or use one of the fonts already installed in your system.
\setCJKsansfont{KodomoRounded-Light.otf}
Font to be used in elements that require the sans family font.
\setCJKmonofont{KodomoRounded-Light.otf}
Font to be used in elements that require the monospace family font. In the example the text inside the verbatim environment uses this font.

  Open an example in ShareLaTeX

[edit] CJK with pdfLaTeX

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}

JapaneseEx2.png

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.

  Open an example in ShareLaTeX

[edit] Further reading

For more information see