Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm writing a Japanese dictionary using the CJKutf8 package in LaTeX. I wrote a few macros to make entries and everything works fine except setting headers with fancyhdr.

Using a macro:

\newcommand{\J}[1]{\begin{CJK}{UTF8}{song}#1\end{CJK}}

I type Japanese in Unicode, but in

\markboth{\J{#1}}{\J{#1}}

it doesn't compile and strange errors occur.

This is a working example:

\documentclass[twocolumn]{book}
\usepackage[T1,OT4]{fontenc}
\usepackage{CJKutf8}
\usepackage{hanging}
\usepackage{ragged2e}
\usepackage{fancyhdr}
\usepackage{fix2col}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\textbf{\rightmark\ -- \leftmark}}
\fancyhead[LO,RE]{\textsf{\textbf{\thepage}}}
\newcommand{\J}[1]{\begin{CJK}{UTF8}{song}#1\end{CJK}}
\newcommand{\E}[4]{\hangpara{3em}{1}\textbf{\J{#2・}}\J{#1}\ #3\ \textit{#4}\J{\markboth{#2}{#2}\cleardoublepage\par}}
\begin{document}
\E{愛}{あい}{miłość}{cn}
\E{青い}{あおい}{niebieski; \emph{rz.} zielony}{ia}
\E{青信号}{あおしんごう}{zielone światło na sygnalizatorze}{mn}
\end{document}

Of course I don't want to make every entry on a separate page so when I remove \cleardoublepage it it does not compile.

How can I make a header with Japanese words in it?

share|improve this question
    
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces and leave a blank line before them, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). –  Caramdir Jun 25 '12 at 16:45
    
Please add a minimal working example (MWE) that illustrates your problem. –  egreg Jun 25 '12 at 16:49

1 Answer 1

Using your code, you may see these error:

name = cyberb53, rootname = cyberb, pointsize = 53
mktexmf: empty or non-existent rootfile!

...

In fact, the TeX file is fine, but you don't have proper fonts installed for CJK bundle.

The simplest solution is to change

\begin{CJK}{UTF8}{song}

to

\begin{CJK}{UTF8}{min}

And note that song CJKfamily is actually for Chinese rather than Japanese.

There are also many other solutions and I won't explain much. See also How to write Japanese with LaTeX?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.