Japanese Latex on Mac in texshop, including Beamer

agosto 31, 2010

Option 1) Use CJK pakage (CJKutf8 for UTF-8 encoding) and use normal latex

¥usepackage[10pt]{type1ec} % use only 10pt fonts
¥usepackage[T1]{fontenc}
¥usepackage{CJKutf8}
¥usepackage[german, russian, vietnam, USenglish]{babel}
¥usepackage[overlap, CJK]{ruby}
¥usepackage{CJKulem}
¥renewcommand{¥rubysep}{-0.2ex}
¥newenvironment{Japanese}{%
¥CJKfamily{min}%
¥CJKtilde
¥CJKnospace}{}
¥begin{document}
¥begin{CJK}{UTF8}{}
¥begin{Japanese}
これは日本語の文章
¥end{Japanese}
¥end{CJK}
¥end{document}

A latex code

Option 2) Use ptex (platex) *Recommended

Install by Macports:
sudo port install pTeX +hiragino +otf +utf8 +motif +macosx

In texshop->configuration, change “Profile” (a Drop menu at the bottom) to pTeX (EUC).
Save a tex file in EUC encoding.

I had to modify the file “/Users/carlos/Library/TeXShop/bin/platex2pdf-euc” to change path to “opt” instead of “usr”

If fontspec is needed:
sudo tlmgr update –self
sudo tlmgr install fontspec

%¥documentclass[twocolumn,11pt]{jarticle} %In case two column layout
¥documentclass[a4j]{jarticle}
¥usepackage{graphicx} %for including graphics
¥usepackage{nidanfloat}
¥usepackage{url}
¥title{タイトル}
¥author{ 僕の名前 }
¥date{2010年}
¥renewcommand{¥refname}{References}
¥begin{document}
¥maketitle
¥section{テスト}
これはテストです。
¥end{document}

A latex code

To use Beamer with platex, I had to reinstall the caption package in CTAN (Download all the .ins and .dtx files and type “platex caption.ins” in the terminal; copy to current directory). The following templete from here was useful:

\documentclass[14pt,dvipdfm]{beamer}
% pdfの栞の字化けを防ぐ
% \AtBeginDvi{\special{pdf:tounicode EUC-UCS2}}
% テーマ
\usetheme{AnnArbor}
% navi. symbolsは目立たないが,dvipdfmxを使うと機能しないので非表示に
\setbeamertemplate{navigation symbols}{}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
% フォントはお好みで
\usepackage{txfonts}
\mathversion{bold}
\renewcommand{\familydefault}{\sfdefault}
\renewcommand{\kanjifamilydefault}{\gtdefault}
\setbeamerfont{title}{size=\large,series=\bfseries}
\setbeamerfont{frametitle}{size=\large,series=\bfseries}
\setbeamertemplate{frametitle}[default][center]
\usefonttheme{professionalfonts}
%
\title{PowerPoint{\color{red}なしで}
プレゼンテーション}
\author{かさい ますみ}
\institute{弘前大学}
\date{2005年12月吉日}
\begin{document}
\frame{\titlepage}
\end{document}

To include furigana (small kana above the kanji), use furikana.sty

Y copied all files to /opt/local/share/Library/texmf/ptex/platex/base and ran sudo mktexlsr
Include
\usepackage{furikana}
in your document.
use the “kana” command: ¥kana{漢}{かん}¥kana{字}{じ}

This made me a problem in beamer (an @ appeared in the background), so I had to use the following marco (found here) instead:
%
% macro ルビ usage: \ruby{漢}{かん}\ruby{字}{じ}
%
\def\ruby#1#2{%
\leavevmode
\setbox0=\hbox{#1}\setbox1=\hbox{\tiny#2}%
\ifdim\wd0>\wd1 \dimen0=\wd0 \else \dimen0=\wd1 \fi
\hbox{\kanjiskip=\fill
\vbox{\hbox to \dimen0{\tiny \hfil#2\hfil}%
\nointerlineskip
\hbox to \dimen0{\hfil#1\hfil}}}}

Advertisement

Deja un comentario

Fill in your details below or click an icon to log in:

Logo de WordPress.com

You are commenting using your WordPress.com account. Log Out / Cambiar )

Twitter picture

You are commenting using your Twitter account. Log Out / Cambiar )

Facebook photo

You are commenting using your Facebook account. Log Out / Cambiar )

Connecting to %s

Seguir

Get every new post delivered to your Inbox.