Discussion:
[Cjk] CJKutf8 + beamer
Rémi Coulom
2009-01-04 11:44:34 UTC
Permalink
Hi,

I managed to get CJKutf8 to work with beamer after a long struggle, so I
thought I would share my solution in case anyone is interested. It is
probably not the most elegant solution, but it worked for me.

I read that thread:
http://www.mail-archive.com/cjk at ffii.org/msg00913.html
I did not manage to get it to work with the trick that Werner suggested.
But, with the hint that the problem was in the .nav file, I managed to
fix my problem with a sed script to process that file. Here it is:

sed -i 's/\(\\headcommand {\\sectionentry
{.}{\)\([^}]*\)\(}{.}{\)\([^}]*\)\(.*\)/\1\\begin{CJK*}{UTF8}{min}\2\\end{CJK*}\3\\begin{CJK*}{UTF8}{min}\4\\end{CJK*}\5/'
CriticalityInJapanese.nav

You should replace the CJK options with yours, as well as the .nav file
name. This script must be run before pdflatex.

I also had to be careful with the short title of the document:
\title[\begin{CJK*}{UTF8}{min}??????????????????\end
{CJK*}] {????????: ??????????????????????
??????}

Also the option hyperref={unicode} is necessary. The header of my file is:

\documentclass[hyperref={unicode}]{beamer}
\usetheme{Warsaw}
\setbeamertemplate{navigation symbols}{}
\usepackage{CJKutf8}

I hope this helps. Suggestion for a better solution are welcome. I tried
XeTeX, but it did not work because it could not process my figures (they
crashed dvipdfm).

R?mi
Hongsheng Zhao
2009-01-04 14:18:00 UTC
Permalink
Post by Rémi Coulom
Hi,
I managed to get CJKutf8 to work with beamer after a long struggle, so I
thought I would share my solution in case anyone is interested. It is
probably not the most elegant solution, but it worked for me.
http://www.mail-archive.com/cjk at ffii.org/msg00913.html
I did not manage to get it to work with the trick that Werner suggested.
But, with the hint that the problem was in the .nav file, I managed to
sed -i 's/\(\\headcommand {\\sectionentry
{.}{\)\([^}]*\)\(}{.}{\)\([^}]*\)\(.*\)/\1\\begin{CJK*}{UTF8}{min}\2\\end{CJK*}\3\\begin{CJK*}{UTF8}{min}\4\\end{CJK*}\5/'
CriticalityInJapanese.nav
You should replace the CJK options with yours, as well as the .nav file
name. This script must be run before pdflatex.
\title[\begin{CJK*}{UTF8}{min}??????????????????\end
{CJK*}] {????????: ??????????????????????
??????}
\documentclass[hyperref={unicode}]{beamer}
\usetheme{Warsaw}
\setbeamertemplate{navigation symbols}{}
\usepackage{CJKutf8}
I hope this helps. Suggestion for a better solution are welcome. I tried
XeTeX, but it did not work because it could not process my figures (they
crashed dvipdfm).
A good idea. Thanks for your sharing. I cann't give any enhancements on this trick,
but perhaps Werner can.

Regards,
--
Hongsheng Zhao <zhaohscas at yahoo.com.cn>
Xinjiang Technical Institute of Physics and Chemistry
Chinese Academy of Sciences
GnuPG DSA: 0xD108493
2009-1-4
Werner LEMBERG
2009-01-05 15:56:14 UTC
Permalink
Post by Rémi Coulom
I managed to get CJKutf8 to work with beamer after a long struggle,
so I thought I would share my solution in case anyone is interested.
It is probably not the most elegant solution, but it worked for me.
http://www.mail-archive.com/cjk at ffii.org/msg00913.html I did not
manage to get it to work with the trick that Werner suggested.
Well, the beamer class handles .nav files differently, thus my
educated guess was wrong, sorry.

However, after some trial, I've found the really simple solution: Just
open and close the CJK environment within \AtBeginDocument and
\AtEndDocument, respectively. Example is below.

I'll document it.


Werner


======================================================================


\documentclass[CJKutf8]{beamer}

\usepackage{CJKutf8}

\usetheme{Darmstadt}

\AtBeginDocument{%
\begin{CJK}{UTF8}{gbsn}}
\AtEndDocument{%
\end{CJK}}

\begin{document}
\title{??}
\author{??}
\date{\today}
\frame{\titlepage}
\section[Outline]{}
\frame{\tableofcontents}
\section{???}
\frame{%
\frametitle{??}
????}
\end{document}
Rémi Coulom
2009-01-05 16:53:50 UTC
Permalink
Post by Werner LEMBERG
Post by Rémi Coulom
I managed to get CJKutf8 to work with beamer after a long struggle,
so I thought I would share my solution in case anyone is interested.
It is probably not the most elegant solution, but it worked for me.
http://www.mail-archive.com/cjk at ffii.org/msg00913.html I did not
manage to get it to work with the trick that Werner suggested.
Well, the beamer class handles .nav files differently, thus my
educated guess was wrong, sorry.
However, after some trial, I've found the really simple solution: Just
open and close the CJK environment within \AtBeginDocument and
\AtEndDocument, respectively. Example is below.
I'll document it.
Werner
Thank you very much. It works for me. Still, I had to add the
hyperref={unicode} option to the beamer package. Without this option,
text for sections in Acrobat Reader's navigation pane is broken.

I read the beamer manual, and found no "CJKutf8" option. It seems that
the beamer package will accept any option name you pass to it without
complaining. I suppose that if such an option existed, it would set
hyperref={unicode}. The only option in the manual is CJK. I tried with
and without that option, and noticed no difference.

R?mi
Hongsheng Zhao
2009-01-06 03:07:05 UTC
Permalink
Post by Rémi Coulom
Thank you very much. It works for me. Still, I had to add the
hyperref={unicode} option to the beamer package. Without this option,
text for sections in Acrobat Reader's navigation pane is broken.
I read the beamer manual, and found no "CJKutf8" option. It seems that
the beamer package will accept any option name you pass to it without
complaining. I suppose that if such an option existed, it would set
hyperref={unicode}. The only option in the manual is CJK. I tried with
and without that option, and noticed no difference.
The most possible reason is that the CJKutf8 package is more recent
than the beamer's latest version and furthermore the author of beamer
isn't a Chinese so we shouldn't have unduly high expectations that
the beamer class can consider too many about the Chinese typesetting
by using CJK package correctly.

In my opinion, the CJKutf8 is a workaround of CJK package for utf8
encoded CJK environment, nevertheless it essentially belong a
subclass of CJK. So presumably the beamer class treat it the same as the CJK
option. But the CJKutf8 will only work with the tex files encoded in
utf8, so the unicode option for hyperref must be declared explicitly.

Regards,
--
Hongsheng Zhao <zhaohscas at yahoo.com.cn>
Xinjiang Technical Institute of Physics and Chemistry
Chinese Academy of Sciences
GnuPG DSA: 0xD108493
2009-1-6
Loading...