memo.xight.org

日々のメモ

macOS High Sierra + homebrew + MacTeX

Summary

macOS 10.13 High Sierra で TeX 環境の構築。

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

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

mactexをアップデート

$ tlmgr update --self --all

texmf.cnf を作成

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

texmf.cnf

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

日本語フォント対応

$ git clone https://github.com/texjporg/cjk-gs-support.git
$ cd cjk-gs-support
$ ./cjk-gs-integrate-macos.pl --cleanup
cjk-gs-integrate: reading font database ...
cjk-gs-integrate [WARNING]: Cannot find cjkgs-morisawa-extra.dat, skipping!
cjk-gs-integrate: searching for Ghostscript resource
cjk-gs-integrate: going to clean up /usr/local/share/ghostscript/9.23/Resource
cjk-gs-integrate: cleaning up all links, snippets and cidfmap.local ...
cjk-gs-integrate: removing cidfmap.local from cidfmap file ...
cjk-gs-integrate: removing snippets and cidfmap.aliases for font aliases ...
cjk-gs-integrate: removing cidfmap.aliases from cidfmap file ...
cjk-gs-integrate: finished
$ ./cjk-gs-integrate-macos.pl --link-texmf --fontdef-add=./database/cjkgs-macos-highsierra.dat --force
cjk-gs-integrate: reading font database ...
cjk-gs-integrate [WARNING]: Cannot find cjkgs-morisawa-extra.dat, skipping!
cjk-gs-integrate: checking for files ...
cjk-gs-integrate: searching for Ghostscript resource
cjk-gs-integrate: output is going to /usr/local/share/ghostscript/9.23/Resource
cjk-gs-integrate: generating links and snippets for CID fonts ...
cjk-gs-integrate: generating links, snippets and cidfmap.local for non-CID fonts ...
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/batang.ttc due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/Dengb.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/Dengl.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/Deng.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/gulim.ttc due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/HGRGE.TTC due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/HGRSMP.TTF due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/HGRME.TTC due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/HGRSGU.TTC due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/msgothic.ttc due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/msmincho.ttc due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/malgunsl.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/malgunbd.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/malgun.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/meiryo.ttc due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/meiryob.ttc due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/msjhbd.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/msjh.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/msyh.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/msyhbd.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/msyhl.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/mingliu.ttc due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/STHUPO.TTF due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/STLITI.TTF due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/STXINGKA.TTF due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/STXINWEI.TTF due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/STZHONGS.TTF due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/simhei.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/simsun.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/YuGothM.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/yumindb.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/yuminl.ttf due to --force!
cjk-gs-integrate: Removing link /usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/yumin.ttf due to --force!
cjk-gs-integrate: adding cidfmap.local to cidfmap file ...
cjk-gs-integrate: generating snippets and cidfmap.aliases for font aliases ...
cjk-gs-integrate: adding cidfmap.aliases to cidfmap file ...
cjk-gs-integrate: finished

dvipdfmxのためのmapファイルを作成する


$ git clone https://github.com/texjporg/jfontmaps.git
$ cd jfontmaps
$ kpsewhich -var-value=TEXMFHOME
/Users/username/Library/texmf
$ make
$ make install
mkdir -p /Users/username/Library/texmf/doc/fonts/ptex-fontmaps
cp ./README /Users/username/Library/texmf/doc/fonts/ptex-fontmaps/
mkdir -p /Users/username/Library/texmf/fonts/cmap/ptex-fontmaps
cp cmap/* /Users/username/Library/texmf/fonts/cmap/ptex-fontmaps/
mkdir -p /Users/username/Library/texmf/fonts/map/dvipdfmx/ptex-fontmaps
cp -r maps /Users/username/Library/texmf/fonts/map/dvipdfmx/ptex-fontmaps/
mkdir -p /Users/username/Library/texmf/fonts/misc/ptex-fontmaps
cp database/*.dat /Users/username/Library/texmf/fonts/misc/ptex-fontmaps/
mkdir -p /Users/username/Library/texmf/scripts/ptex-fontmaps
ls script/* | grep -v updmap-otf.sh | xargs -I % cp % /Users/username/Library/texmf/scripts/ptex-fontmaps/
mkdir -p /Users/username/Library/texmf/source/ptex-fontmaps/script
cp script/updmap-otf.sh /Users/username/Library/texmf/source/ptex-fontmaps/script
mkdir -p /Users/username/Library/texmf/source/ptex-fontmaps/tools
cp tools/* /Users/username/Library/texmf/source/ptex-fontmaps/tools/
$ mktexlsr
mktexlsr: Updating /usr/local/texlive/2018/texmf-config/ls-R...
mktexlsr: Updating /usr/local/texlive/2018/texmf-dist/ls-R...
mktexlsr: Updating /usr/local/texlive/2018/texmf-var/ls-R...
mktexlsr: Updating /usr/local/texlive/texmf-local/ls-R...
mktexlsr: Done.

ヒラギノをPDFに埋め込み

$ kanji-config-updmap-sys --jis2004 hiragino-highsierra-pron
Setting up ... ptex-hiragino-highsierra-pron.map
Creating new config file /usr/local/texlive/2018/texmf-config/web2c/updmap.cfg
updmap will read the following updmap.cfg files (in precedence order):
  /usr/local/texlive/2018/texmf-config/web2c/updmap.cfg
  /usr/local/texlive/2018/texmf-dist/web2c/updmap.cfg
updmap may write changes to the following updmap.cfg file:
  /usr/local/texlive/2018/texmf-config/web2c/updmap.cfg
dvips output dir: "/usr/local/texlive/2018/texmf-var/fonts/map/dvips/updmap"
pdftex output dir: "/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap"
dvipdfmx output dir: "/usr/local/texlive/2018/texmf-var/fonts/map/dvipdfmx/updmap"

updmap is creating new map files
using the following configuration:
  LW35 font names                  : URWkb (/usr/local/texlive/2018/texmf-dist/web2c/updmap.cfg)
  prefer outlines                  : true (/usr/local/texlive/2018/texmf-dist/web2c/updmap.cfg)
  texhash enabled                  : true
  download standard fonts (dvips)  : true (/usr/local/texlive/2018/texmf-dist/web2c/updmap.cfg)
  download standard fonts (pdftex) : true (/usr/local/texlive/2018/texmf-dist/web2c/updmap.cfg)
  jaEmbed replacement string       : hiragino-highsierra-pron (/usr/local/texlive/2018/texmf-config/web2c/updmap.cfg)
  jaVariant replacement string     : <empty> (/usr/local/texlive/2018/texmf-config/web2c/updmap.cfg)
  scEmbed replacement string       : arphic (/usr/local/texlive/2018/texmf-dist/web2c/updmap.cfg)
  tcEmbed replacement string       : arphic (/usr/local/texlive/2018/texmf-dist/web2c/updmap.cfg)
  koEmbed replacement string       : baekmuk (/usr/local/texlive/2018/texmf-dist/web2c/updmap.cfg)
  create a mapfile for pxdvi       : false (default)

Scanning for LW35 support files  [  3 files]
Scanning for MixedMap entries    [ 44 files]
Scanning for KanjiMap entries    [ 11 files]
Scanning for Map entries         [272 files]

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

Files generated:
  /usr/local/texlive/2018/texmf-var/fonts/map/dvips/updmap:
	   15796 2018-05-07 16:22:20 builtin35.map
	   21269 2018-05-07 16:22:20 download35.map
	 2477037 2018-05-07 16:22:21 psfonts_pk.map
	 2737932 2018-05-07 16:22:21 psfonts_t1.map
	 2731344 2018-05-07 16:22:20 ps2pk.map
		  14 2018-05-07 16:22:22 psfonts.map -> psfonts_t1.map
  /usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap:
	 2731351 2018-05-07 16:22:22 pdftex_dl14.map
	 2729686 2018-05-07 16:22:22 pdftex_ndl14.map
		  15 2018-05-07 16:22:22 pdftex.map -> pdftex_dl14.map
  /usr/local/texlive/2018/texmf-var/fonts/map/dvipdfmx/updmap:
	   10906 2018-05-07 16:22:20 kanjix.map

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

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

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

TeXShopの環境設定

TeXShop Preferences - Sources - Set Default Values から "upTeX (ptex2pdf)" を選択

定期的なアップデート

$ tlmgr update --self --all

uplatex用テンプレート

\documentclass[report,12pt,uplatex]{jsarticle}
\begin{document}
\section{セクション}
内容内容内容
\end{document}

Reference

TeX Wiki - macOS 10.13 High Sierra / macOS 10.12 Sierra / OS X 10.11 El Capitan への対応
https://texwiki.texjp.org/?TeX%20Live%2FMac#elcapitan