Japanese characters in a latex \section{} cause an error

cjk, latex, unicode

Solution

Sorry to post this as an answer rather than a comment to your answer; I don't have enough rep yet to comment. (EDIT: Now I have enough rep to comment, but I'm not sorry anymore. Thanks Will.)

Your solution of replacing

\section{[Japanese Text]}

with

\section{\texorpdfstring{[Japanese Text]}{}}

suggests that you're using the `hyperref` package. When you use the `hyperref` package, any sort of not-totally-boring text (e.g. math) within `\section` causes a problem because `\section` is having trouble generating pdf bookmarks. `\texorpdfstring` allows you to specify how you want the section title to appear in the pdf bookmark. For example, I might write

\section{Calculation of \texorpdfstring{$H_2(\mathcal{X})$}{H\_2(X)}}

if I want the section title to be "Calculation of $H_2(\mathcal{X})$" but I want the pdf bookmark to be "Calculation of H_2(X)".

Problem

I am working on getting Japanese documents created with latex. I have installed the latest version of texlive-2008 which includes CJK. In my document I have the following: ``` \documentclass{class} \usepackage{CJK} \begin{document} \begin{CJK*}{UTF8}{min} \title{[Japanese Characters here 1]} \maketitle \section{[Japanese Characters here 2]} [Japanese Characters here 3] \end{CJK*} \end{document} ``` In the above code there are 3 locations Japanese characters are used. 1 + 3 work fine whereas 2, which contains Japanese characters in a \section{} fails with the following error. ``` ! Argument of \@sect has an extra }. ``` After some research it turns out this error manifests when you’ve put a fragile command inside a moving argument. A moving argument because section can be moved to a contents page for example. Does anyone know how to get this to work and why latex thinks Japanese characters are "fragile".

Original source