[Tex/LaTex] A couple of questions about Japanese in Title and Chapter; CJK parameters; best fonts, installing; memoir

cjkfont-encodingsfontsmemoir

I'm trying to produce a report using memoir and CJK and seem to keep running into a wall. I was hoping someone on here uses CJK and can point me in the right direction.

First, if I want the entire document to be in Japanese, I can use the \begin{CJK} and \end{CJK} tags immediately after and before the \begin{document} and \end{document} tags respectively, right? The problem is that while I can get Japanese text into the body this way, pdfLaTeX throws an error if I put it in the chapter or title fields. Any ideas why?

Secondly, according to CJK.txt there are three parameters, [<fontencoding>], {<encoding>}, and {<family>}. I'm on Mac OS X and just want to type the Japanese characters directly into my .tex document using the built-in Japanese support (I believe it's called Kotoeri). What encoding and fontencoding settings should I use? The only one I'm having any luck with is UTF-8. Also, "fontencoding" is wrapped in square brackets in the CJK.txt document, but shouldn't they be curly braces? Or do the square brackets indicate it's an optional parameter?

Thirdly, what's a good font family to use, and where should I put the files once I've downloaded them? This example uses the "min" family, but the characters look really sloppy – I'd prefer something that looks more like MS Mincho or Hiragino Mincho Pro. If I have these fonts on my computer (i.e., in Font Book), is that enough for LaTeX to use them, or do I need to download separate font packages for use with LaTeX? If those fonts are accessible, is it enough to enter "Hiragino", for instance, in the "family" parameter of the \begin{CJK} tag, or do I need to do something special?

Finally, have you heard of any incompatibility between the memoir package and CJK?

I had no idea using Japanese in LaTeX was so much work. I guess I'm used to the luxury of a word processor.

Thank you very much for taking the time to look.

Best Answer

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.

Related Question