東山n条より

京都在住情報系学生のメモ。

MacOS1.8.2 で YaTex + GNU Emacs24.2 の環境を整える

卒論を書くために Mac OSX 1.8.2 (Mountain Lion) で,YaTex(やてふ) + TeXShop + GNU Emacs24.2 で Tex を書くための環境を整えました。

1.platex をインストールする。

Macports を使ってplatexをインストールします。

sudo port install ghostscript-fonts-hiragino  
sudo port -d install pTeX +utf8 +motif  

時間がかかりますが、うまくいけば /opt/local/bin に platex がインストールされます。

2.GNU Emacs24 をインストールする。

GNU Emacs For Mac OS X で GNU Emacs24 .dmg をダウンロード + インストールする。
shell 上で emacs を立ち上げたい場合は,.bashrc 等に下記を加える。

alias emacs='/Applications/Emacs.app/Contents/MacOS/Emacs -nw'

3.YaTex の環境設定をする。

YaTexのサイト から,YaTexを落として解凍して makefile のCarbonEmacs の部分を

EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
PREFIX=/Applications/Emacs.app/Contents/Resources
EMACSDIR=${PREFIX}

と書き換えてから,解凍したフォルダで make install する。

sudo make install
sudo make install-info

あとは,~/.emacs.d/init.el など elispのPATHが通っている所に下記を加える。

;; yatex-mode
(setq auto-mode-alist
      (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
(setq tex-command (expand-file-name "~/Library/TeXShop/bin/platex2pdf-utf8"))

4.TexShop のインストール

TexShopのサイトから,TexShop を落として解凍する。 デフォルトでは,~/Library/TexShop/bin/ptex2pdf-utf8, ~/Library/TexShop/bin/platex2pdf-utf8 はないので,ここを参考にファイルを作成する。

cp ~/Library/TeXShop/bin/ptex2pdf-euc ~/Library/TeXShop/bin/ptex2pdf-utf8
cp ~/Library/TeXShop/bin/platex2pdf-euc ~/Library/TeXShop/bin/platex2pdf-utf8

あとはここここを参考に,TexShop の環境設定をする。

以上でTexShoptexファイルを開いてから,emacstex ファイルを編集している時に

C-c t j

をすれば自動的にpdfビューワーが更新されるようになります。