2

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}
%\cardfrontstyle[\selectlanguage{german}\Large]{headings}
\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?

2 Answers 2

4

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}
\setmainfont{Myriad Pro}      % set your favorite Latin-based font here

\cardbackstyle[\small\selectlanguage{english}]{empty}
\cardfrontstyle[\selectlanguage{german}\Large]{headings}
\cardfrontfoot{日本語}

\begin{document}

\begin{flashcard}{がくせい}
1) student
\end{flashcard}
\end{document}
1
  • I've chanded \setmainfont to \setromanfont, now it workes to my full satisfaction!
    – beyeran
    Jan 26, 2011 at 19:09
2

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.

4
  • my LaTeX editor TeXnicCenter cannot show chinese character, what should I do? I am using Miktex 2.9 distro. Jan 8, 2011 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).
    – imnothere
    Jan 8, 2011 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, 2011 at 23:19
  • 1
    @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.
    – imnothere
    Jan 20, 2011 at 1:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .