# Japanese flashcards

I wanted to make some flashcards for learning japanese. I've found the flashcard class and some japanese output package (ucs, CJK). But they don't seem to work together. I've coded the following as an example:

\PassOptionsToPackage{a4paper}{geometry}
\documentclass[avery5371,frame]{flashcards}

\usepackage[encapsulated]{CJK}
\usepackage{ucs}
\usepackage[utf8]{inputenc}
\usepackage[english,german,brazilian]{babel}
\newcommand{\cjktext}[1]{\begin{CJK}{UTF8}{cyberbit}#1\end{CJK}}

%\cardbackstyle[\small\selectlanguage{english}]{empty}
\cardfrontfoot{\cjktext{日本語}}

\begin{document}

\begin{flashcard}{\cjktext{がくせい}}
1) student
\end{flashcard}
\end{document}


The *.pdf file was build without any errors by pdflatex, but the *.pdf itself doesn't contain any of the japanese character.

Does anyone know how I could fix this, or does perhaps anyone know packages or classes which are more adequate here?

If you're using XeLaTeX, you should be using the xeCJK package instead of CJK. The code is then much simpler:

\PassOptionsToPackage{a4paper}{geometry}
\documentclass[avery5371,frame]{flashcards}

\usepackage[english,german,brazilian]{babel}
\usepackage{xeCJK}
\setCJKmainfont{Hiragino Kaku Gothic Pro}

\cardbackstyle[\small\selectlanguage{english}]{empty}
\cardfrontfoot{日本語}

\begin{document}

\begin{flashcard}{がくせい}
1) student
\end{flashcard}
\end{document}

• I've chanded \setmainfont to \setromanfont, now it workes to my full satisfaction! – beyeran Jan 26 '11 at 19:09

Your example works for me, so I suspect the issue is with the cyberbit font rather than ucs or CJK. Have you set up the cyberbit font for use with LaTeX? Instructions for doing so can be found here.

Alternatively, get the wadalab fonts, and use maru, min or goth instead of cyberbit.

• my LaTeX editor TeXnicCenter cannot show chinese character, what should I do? I am using Miktex 2.9 distro. – xport Jan 8 '11 at 15:50
• @xport, have you installed support for Eastern languages from the Windows setup CDs? Also, TeXnicCenter didn't have good support for UTF-8, I'm not sure if that's still the case with the latest versions. You might want to try TeXworks instead (also included with MikTeX). – LianTze Lim Jan 8 '11 at 16:04
• It hasn't worked for a long time (every new idea was followed by more complications) but now I finally figured it out. I required fontspec,xunicode.xltxtra then I used \newfontsface\kanji{Hiragino Kaku Gothic Pro} (I'm using a mac), and every font is embedded in \kanji{ ... }. I know it's not the nicest solution but at least it finally works. – beyeran Jan 19 '11 at 23:19
• @beyeran, are you using XeLaTeX instead of LaTeX? If so, using xeCJK rather than CJK is the best solution. It calls fontspec and xunicode, plus after selecting a font for use with CJK, you won't need to explicitly mark CJK text in your document. I've added an answer using xeCJK. – LianTze Lim Jan 20 '11 at 1:50