Quick fix:
\makeatletter
\let\xeCJK@ignorespaces\relax
\makeatother
In xeCJK
2.4.1 (2011/05/20), you can use:
\usepackage[space]{xeCJK}
\renewcommand\CJKglue{}% get proper linebreaking if spaces are provided
or use \CJKspace
to allow spaces between CJK charecters.
Before the new xeCJK
updated to CTAN, you can always get the latest code through SVN:
http://code.google.com/p/ctex-kit/source/checkout
While each of your issues can be addressed in detail, I think the easiest solution for you now is to use XeLaTeX. You can then access any Japanese fonts installed on your operating system.
A minimal example:
\documentclass{memoir}
\usepackage{xeCJK}
\setCJKmainfont{Hiragino Mincho Pro}
\setmainfont{Baskerville}
\usepackage[japanese]{babel}
\renewcommand\chaptername{第}
\addtodef{\afterchapternum}{章}{} % Rather an ugly hack
\begin{document}
\tableofcontents
\chapter{手引}
おはようございます!
\begin{figure}[hbt!]
\centering\Large よろしくお願いします。
\caption{はーい}
\end{figure}
\begin{table}[hbt!]
\centering
\begin{tabular}{c c}
\hline
one & 一\\
two & 二\\
\hline
\end{tabular}
\caption{あれ。}
\end{table}
\section{文章}
何これ?
\end{document}
Remember to process the above code with xelatex
, not pdflatex
.
I was pleasantly surprised to find that there's a japanese
localisation file for babel
, and it works with XeLaTeX! So you'll get "目次" instead of "Contents" for the ToC heading, etc. You will have to install the japanese
package. (Available on TeXLive and hence MacTeX, but not bundled with MikTeX.) However the chapter labels ("Chapter 1") aren't localised, so we'll have to change that ourselves. It takes two commands to do it, since we need the ordinal prefix before the chapter number, and the chapter name after it.
If you prefer to set the localisation strings manually (or if you have problems with \usepackage[japanese]{babel}
:
\renewcommand\contentsname{目次}
\renewcommand\figurename{図}
\renewcommand\tablename{表}
...
See section 18.20 (Words and Phrases) in the memoir
manual, where there is a list of strings that you can localise by \renewcommanding them.
Alternatively, there is the ptex
platform, which is optimised for Japanese typesetting, but I've never tried it out.
Best Answer
Well, you can freely use
\setCJKfamilyfont
to define as many fonts as you need. And you can use\CJKfamily
to change the font. This is quite similar to the way you have used.On the other hand, current
xeCJK
does not have the ability to define different fonts for Chinese, Japanese and Korean individually. In fact, the three languages shares a lot of characters, and it is impossilbe to distinguish which language it is automatically.An alternative solution is, use
fallback
option ofxeCJK
to define a main font (for Chinese & Japanese) and its fallback font (for Korean). For example,However, for serious typesetting, the result using
fallback
font option is questionable. Some glyphs looks quite different among the three countries. A glyph in a Chinese font may be wrong in Korean or Japanese, and vice versa. Thus, a proper way is still change the font manually:Update
For newer
xeCJK
(ver 3.x), you can set different fonts for different sub CJK blocks: