memo.xight.org

日々のメモ

OS X Yosemite + homebrew + TeX環境

Summary

OS X Yosemite で TeX 環境の構築。

homebrew, brewcask で ghostscirpt, imagemagick, mactex をインストール

$ brew install ghostscript imagemagick
$ brew cask install mactex
$ sudo chown -R USERNAME:admin /usr/local/texlive

mactexをアップデート

$ tlmgr update --self --all
tlmgr: package repository ftp://ftp.u-aizu.ac.jp/pub/tex/CTAN/systems/texlive/tlnet
tlmgr: saving backups to /usr/local/texlive/2014/tlpkg/backups
[1/1, ??:??/??:??] update: texlive.infra [297k] (34227 -> 35898) ... done
Restarting tlmgr to complete update ...
tlmgr: package repository ftp://ftp.kddilabs.jp/CTAN/systems/texlive/tlnet
tlmgr: saving backups to /usr/local/texlive/2014/tlpkg/backups
[  1/534] auto-remove: physymb ... done
[  2/534] auto-remove: ps2pkm.universal-darwin ... done
[  3/534] auto-remove: mh ... done
[  4/534] auto-remove: persian-modern ... done
...
...
...

texmf.cnf を作成

$ mkdir /usr/local/texlive/texmf-local/web2c
$ vi /usr/local/texlive/texmf-local/web2c/texmf.cnf

shell_escape_commands = \
bibtex,bibtex8,bibtexu,upbibtex,biber,\
kpsewhich,\
makeindex,mendex,texindy,\
mpost,upmpost,\
repstopdf,epspdf,extractbb

日本語フォント対応

$ mkdir -p /usr/local/texlive/texmf-local/fonts/opentype/hiragino/
$ cd /usr/local/texlive/texmf-local/fonts/opentype/hiragino/
$ ln -fs "/Library/Fonts/ヒラギノ明朝 Pro W3.otf" ./HiraMinPro-W3.otf
$ ln -fs "/Library/Fonts/ヒラギノ明朝 Pro W6.otf" ./HiraMinPro-W6.otf
$ ln -fs "/Library/Fonts/ヒラギノ丸ゴ Pro W4.otf" ./HiraMaruPro-W4.otf
$ ln -fs "/Library/Fonts/ヒラギノ角ゴ Pro W3.otf" ./HiraKakuPro-W3.otf
$ ln -fs "/Library/Fonts/ヒラギノ角ゴ Pro W6.otf" ./HiraKakuPro-W6.otf
$ ln -fs "/Library/Fonts/ヒラギノ角ゴ Std W8.otf" ./HiraKakuStd-W8.otf
$ mktexlsr
mktexlsr: Updating /usr/local/texlive/2014/texmf-config/ls-R...
mktexlsr: Updating /usr/local/texlive/2014/texmf-dist/ls-R...
mktexlsr: Updating /usr/local/texlive/2014/texmf-var/ls-R...
mktexlsr: Updating /usr/local/texlive/texmf-local/ls-R...
mktexlsr: Done.

ヒラギノをPDFに埋め込み

$ updmap-sys --setoption kanjiEmbed hiragino
updmap will read the following updmap.cfg files (in precedence order):
  /usr/local/texlive/2014/texmf-dist/web2c/updmap.cfg
updmap may write changes to the following updmap.cfg file:
  /usr/local/texlive/2014/texmf-config/web2c/updmap.cfg
Creating new config file /usr/local/texlive/2014/texmf-config/web2c/updmap.cfg
dvips output dir: "/usr/local/texlive/2014/texmf-var/fonts/map/dvips/updmap"
pdftex output dir: "/usr/local/texlive/2014/texmf-var/fonts/map/pdftex/updmap"
dvipdfmx output dir: "/usr/local/texlive/2014/texmf-var/fonts/map/dvipdfmx/updmap"
updmap [WARNING]: font manfnt is defined multiple times:
updmap [WARNING]:   mflogo.map (from /usr/local/texlive/2014/texmf-dist/web2c/updmap.cfg)
updmap [WARNING]:   manfnt.map (from /usr/local/texlive/2014/texmf-dist/web2c/updmap.cfg) (used)

updmap is creating new map files
using the following configuration:
  LW35 font names                  : URWkb (/usr/local/texlive/2014/texmf-dist/web2c/updmap.cfg)
  prefer outlines                  : true (/usr/local/texlive/2014/texmf-dist/web2c/updmap.cfg)
  texhash enabled                  : true
  download standard fonts (dvips)  : true (/usr/local/texlive/2014/texmf-dist/web2c/updmap.cfg)
  download standard fonts (pdftex) : true (/usr/local/texlive/2014/texmf-dist/web2c/updmap.cfg)
  kanjiEmbed replacement string    : hiragino (/usr/local/texlive/2014/texmf-config/web2c/updmap.cfg)
  kanjiVariant replacement string  :  (default)
  create a mapfile for pxdvi       : false (default)

Scanning for LW35 support files  [  3 files]
Scanning for MixedMap entries    [ 44 files]
Scanning for KanjiMap entries    [  6 files]
Scanning for Map entries         [235 files]

Generating output for dvipdfmx...
Generating output for ps2pk...
Generating output for dvips...
Generating output for pdftex...

Files generated:
  /usr/local/texlive/2014/texmf-var/fonts/map/dvips/updmap:
	   15796 2015-02-28 23:18:50 builtin35.map
	   21269 2015-02-28 23:18:50 download35.map
	 1390514 2015-02-28 23:18:50 psfonts_pk.map
	 1651147 2015-02-28 23:18:50 psfonts_t1.map
	 1645321 2015-02-28 23:18:50 ps2pk.map
		  14 2015-02-28 23:18:51 psfonts.map -> psfonts_t1.map
  /usr/local/texlive/2014/texmf-var/fonts/map/pdftex/updmap:
	 1645328 2015-02-28 23:18:51 pdftex_dl14.map
	 1643663 2015-02-28 23:18:50 pdftex_ndl14.map
		  15 2015-02-28 23:18:51 pdftex.map -> pdftex_dl14.map
  /usr/local/texlive/2014/texmf-var/fonts/map/dvipdfmx/updmap:
		6588 2015-02-28 23:18:49 kanjix.map

Transcript written on "/usr/local/texlive/2014/texmf-var/web2c/updmap.log".
updmap: Updating ls-R files.

TexShopの削除とbrewcask から最新版をインストール

$ sudo rm /Applications/TeXShop.app
$ brew cask install texshop

TeXShopの環境設定


Sourceタブ

TeXShop Preferences - Sources
[Set Default Values]から "pTeX (ptex2pdf)" を選択
Encoding で Unicode (UTF-8) を選択

Engineタブ

TeXShop Preferences - Engine
pdfTeX の Tex

pdftex --file-line-error --synctex=1

pdfTeX の Latex

pdflatex --file-line-error --synctex=1

TeX + dvips + distiller の Tex

ptex2pdf -e -ot "-synctex=1 -file-line-error"

TeX + dvips + distiller の Latex

ptex2pdf -l -ot "-synctex=1 -file-line-error"

定期的なアップデート

$ tlmgr update --self --all

Reference

h_uenoharaのブログ - 2014-02-02 - OS X MavericksにTeX環境を構築した記録
http://uenohara.hatenablog.jp/entry/2014/02/02/224140