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 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?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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}
share|improve this answer
    
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.

share|improve this answer
    
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
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. –  LianTze Lim Jan 20 '11 at 1:50

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.