memo.xight.org

日々のメモ

カテゴリ : TeX

1ページ目 / 全2ページ

TeX + 日本語フォント

Summary

macOS付属の non-freeなフォントをLaTeXで使うためのツールやファイルは、TeX Live本体にはなく、TLContribにある

TLContribリポジトリの追加

% tlmgr repository add https://contrib.texlive.info/current tlcontrib
tlmgr: added repository with tag tlcontrib: https://contrib.texlive.info/current

% tlmgr pinning add tlcontrib '*'
tlmgr: package repositories
        main = http://mirror.ctan.org/systems/texlive/tlnet (verified)
        tlcontrib = http://contrib.texlive.info/current (verified)
tlmgr: new pinning data for tlcontrib: *

% curl -fsSL https://www.preining.info/rsa.asc | tlmgr key add -
tlmgr: key successfully imported

% tlmgr repository status
tlmgr: package repositories
        main = http://mirror.ctan.org/systems/texlive/tlnet (verified)
        tlcontrib = http://contrib.texlive.info/current (verified)
main https://ftp.kddilabs.jp/CTAN/systems/texlive/tlnet/tlpkg/texlive.tlpdb verified
tlcontrib http://contrib.texlive.info/current/tlpkg/texlive.tlpdb verified

% tlmgr install japanese-otf-nonfree japanese-otf-uptex-nonfree ptex-fontmaps-macos cjk-gs-integrate-macos

% cjk-gs-integrate --link-texmf --cleanup --force
cjk-gs-integrate: reading font database ...
cjk-gs-integrate: searching for Ghostscript resource
cjk-gs-integrate: going to clean up /opt/homebrew/share/ghostscript/9.54.0/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: running mktexlsr ...
mktexlsr: Updating /usr/local/texlive/2021/texmf-config/ls-R...
mktexlsr: Updating /usr/local/texlive/2021/texmf-dist/ls-R...
mktexlsr: Updating /usr/local/texlive/2021/texmf-var/ls-R...
mktexlsr: Updating /usr/local/texlive/texmf-local/ls-R...
mktexlsr: Done.
cjk-gs-integrate: finished

% cjk-gs-integrate-macos --link-texmf --force
cjk-gs-integrate [WARNING]: Our built-in database does not support recent
cjk-gs-integrate [WARNING]: versions of Mac OS (10.8 Mountain Lion or later)!
cjk-gs-integrate [WARNING]: If you want to use Hiragino fonts bundled with
cjk-gs-integrate [WARNING]: your OS, obtain external database file and
cjk-gs-integrate [WARNING]: specify it with --fontdef-add option!
cjk-gs-integrate [WARNING]: I'll continue with my built-in database ...
cjk-gs-integrate: reading font database ...
cjk-gs-integrate: checking for files ...
cjk-gs-integrate: searching for Ghostscript resource
cjk-gs-integrate: output is going to /opt/homebrew/share/ghostscript/9.54.0/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: 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: running mktexlsr ...
mktexlsr: Updating /usr/local/texlive/2021/texmf-config/ls-R...
mktexlsr: Updating /usr/local/texlive/2021/texmf-dist/ls-R...
mktexlsr: Updating /usr/local/texlive/2021/texmf-var/ls-R...
mktexlsr: Updating /usr/local/texlive/texmf-local/ls-R...
mktexlsr: Done.
cjk-gs-integrate: finished

% mktexlsr
mktexlsr: Updating /usr/local/texlive/2021/texmf-config/ls-R...
mktexlsr: Updating /usr/local/texlive/2021/texmf-dist/ls-R...
mktexlsr: Updating /usr/local/texlive/2021/texmf-var/ls-R...
mktexlsr: Updating /usr/local/texlive/texmf-local/ls-R...
mktexlsr: Done.


% kanji-config-updmap-sys status
CURRENT family for ja: ipaex (variant: <empty>)
Standby family : ipa
Standby family : ms
Standby family : yu-win10


via

つーさにブログ - 2020-05-12 - macOSでLaTeX環境 (install-tlを使って)
https://tsuu32.hatenablog.com/entry/2020/05/12/190000

明治大学 - 桂田 祐史 - 2 MacTeX 2021を待つ …M1対応バージョン やって来ました!
http://nalab.mind.meiji.ac.jp/~mk/knowhow-2021/node2.html

Apple Silicon + MacTeX

Summary

$ wget http://www.tug.org/mactex/MacTeX-2020-Universal.pkg
$ pkgutil --expand MacTeX-2020-Universal.pkg mactex
$ pax -rz -f mactex/MacTeX-2020-Universal-Start.pkg/Payload
$ mv usr/local/texlive/2020/bin/custom /usr/local/texlive/2020/bin/


/usr/local/texlive/2020/bin/custom に PATH を通す

path=(
	$path
	/usr/local/texlive/2020/bin/custom(N-/)
)


確認

$ which tex
/usr/local/texlive/2020/bin/custom/tex
$ lipo -archs $(which tex)
x86_64 arm64


Reference

MacTeX - About ARM
http://www.tug.org/mactex/aboutarm.html

via

奥村 晴彦 先生 - macOS - M1 Mac
https://oku.edu.mie-u.ac.jp/~okumura/macosx/m1.html

macOS Catalina + homebrew + MacTeX (TeXLive2020)

Summary

macOS 10.15.4 Catalina で TeX 環境 (TeXLive2020) の構築。

homebrew caskで mactex をインストール

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

mactexをアップデート

$ tlmgr update --self --all

ミラーのリポジトリを指定

$ tlmgr option repository "ftp://ftp.tug.org/texlive/tlnet"
tlmgr: setting default package repository to ftp://ftp.tug.org/texlive/tlnet
tlmgr: updating /usr/local/texlive/2020/tlpkg/texlive.tlpdb

macOS Mojave + homebrew + MacTeX (TeXLive2019)

Summary

macOS 10.14 Mojave で TeX 環境 (TeXLive2019) の構築。

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

tlmgr: The TeX Live versions supported by the repository
http://ftp.jaist.ac.jp/pub/CTAN/systems/texlive/tlnet
  (2016--2018)
do not include the version of the local installation
  (2019).

ミラーのリポジトリが2019に対応していなかったので、本家のリポジトリを参照

$ tlmgr option repository "ftp://ftp.tug.org/texlive/tlnet"
tlmgr: setting default package repository to ftp://ftp.tug.org/texlive/tlnet

ミラーのリポジトリを指定

$ tlmgr option repository "http://mirror.ctan.org/systems/texlive/tlnet"
tlmgr: setting default package repository to http://mirror.ctan.org/systems/texlive/tlnet

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

tlmgr で gnupg not available

Summary

tlmgr update --self --all を実行したらエラー.
GnuPGをインストールして解決.

% tlmgr update --self --all
tlmgr: package repository ftp://ftp.kddilabs.jp/CTAN/systems/texlive/tlnet (not verified: gnupg not available)
tlmgr: saving backups to /usr/local/texlive/2016/tlpkg/backups

% tlmgr update --self --all
tlmgr: package repository ftp://ftp.u-aizu.ac.jp/pub/tex/CTAN/systems/texlive/tlnet (not verified: gnupg not available)
tlmgr: saving backups to /usr/local/texlive/2016/tlpkg/backups

% tlmgr key list
gnupg is not found or not set up, cannot continue with action `key'
tlmgr: An error has occurred. See above messages. Exiting.


% brew install gnupg2

% tlmgr key list
/usr/local/texlive/2016/tlpkg/gpg/pubring.gpg
---------------------------------------------
pub   2048R/06BAB6BC 2016-03-19
uid       [ultimate] TeX Live Distribution <tex-live@tug.org>
sub   2048R/B001980F 2016-03-19
sub   2048R/19438C70 2016-03-19 [expires: 2017-09-10]

% tlmgr update --self --all
tlmgr: package repository ftp://ftp.u-aizu.ac.jp/pub/tex/CTAN/systems/texlive/tlnet (verified)
tlmgr: saving backups to /usr/local/texlive/2016/tlpkg/backups

OS X El Capitan + homebrew + TeX環境

Summary

OS X 10.11 El Capitan で 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

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

日本語フォント対応

$ cd /usr/local/texlive/2015/texmf-dist/scripts/cjk-gs-integrate
$ ./cjk-gs-integrate.pl --link-texmf --force
$ mktexlsr
mktexlsr: Updating /usr/local/texlive/2015/texmf-config/ls-R...
mktexlsr: Updating /usr/local/texlive/2015/texmf-dist/ls-R...
mktexlsr: Updating /usr/local/texlive/2015/texmf-var/ls-R...
mktexlsr: Updating /usr/local/texlive/texmf-local/ls-R...
mktexlsr: Done.

ヒラギノをPDFに埋め込み

$ updmap-sys --setoption kanjiEmbed hiragino-elcapitan
updmap will read the following updmap.cfg files (in precedence order):
  /usr/local/texlive/2015/texmf-config/web2c/updmap.cfg
  /usr/local/texlive/2015/texmf-dist/web2c/updmap.cfg
updmap may write changes to the following updmap.cfg file:
  /usr/local/texlive/2015/texmf-config/web2c/updmap.cfg
dvips output dir: "/usr/local/texlive/2015/texmf-var/fonts/map/dvips/updmap"
pdftex output dir: "/usr/local/texlive/2015/texmf-var/fonts/map/pdftex/updmap"
dvipdfmx output dir: "/usr/local/texlive/2015/texmf-var/fonts/map/dvipdfmx/updmap"

updmap is creating new map files
using the following configuration:
  LW35 font names                  : URWkb (/usr/local/texlive/2015/texmf-dist/web2c/updmap.cfg)
  prefer outlines                  : true (/usr/local/texlive/2015/texmf-dist/web2c/updmap.cfg)
  texhash enabled                  : true
  download standard fonts (dvips)  : true (/usr/local/texlive/2015/texmf-dist/web2c/updmap.cfg)
  download standard fonts (pdftex) : true (/usr/local/texlive/2015/texmf-dist/web2c/updmap.cfg)
  kanjiEmbed replacement string    : hiragino (/usr/local/texlive/2015/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         [248 files]

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

Files generated:
  /usr/local/texlive/2015/texmf-var/fonts/map/dvips/updmap:
	   15796 2016-02-20 23:39:55 builtin35.map
	   21269 2016-02-20 23:39:55 download35.map
	 1607557 2016-02-20 23:39:56 psfonts_pk.map
	 1868452 2016-02-20 23:39:56 psfonts_t1.map
	 1862662 2016-02-20 23:39:55 ps2pk.map
		  14 2016-02-20 23:39:56 psfonts.map -> psfonts_t1.map
  /usr/local/texlive/2015/texmf-var/fonts/map/pdftex/updmap:
	 1862669 2016-02-20 23:39:56 pdftex_dl14.map
	 1861004 2016-02-20 23:39:56 pdftex_ndl14.map
		  15 2016-02-20 23:39:56 pdftex.map -> pdftex_dl14.map
  /usr/local/texlive/2015/texmf-var/fonts/map/dvipdfmx/updmap:
		6592 2016-02-20 23:39:55 kanjix.map

Transcript written on "/usr/local/texlive/2015/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

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

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

LaTeX でウォーターマーク (透かし)

Summary

書類の背景に薄い文字(透かし,ウォーターマーク)を印刷したい.

Source

\begin{document}の前に以下を記入.

\usepackage{graphicx}
\usepackage{fancybox}
\usepackage{color}
\fancyput(-0.7in,-9.5in){
	\color[rgb]{0.85,0.85,0.85}{
		\rotatebox{50}{
			\scalebox{10}{CONFIDENTIAL}
		}
	}
}

Sample

\documentclass{jarticle}
\usepackage{graphicx}
\usepackage{fancybox}
\usepackage{color}
\fancyput(-0.7in,-9.5in){
	\color[rgb]{0.85,0.85,0.85}{
		\rotatebox{50}{
			\scalebox{10}{CONFIDENTIAL}
		}
	}
}

\title{タイトル}
\author{佐藤 克己}
\date{2005年12月30日}

\begin{document}
\maketitle

\section{サンプル}

\end{document}

結果

クリックして拡大

PDF | TeX

Reference

Hiki@Acapulco - (Tex)dmesh
http://acapulco.dyndns.org/hiki/hiki.cgi?%28Tex%29dmesh

via

swk's log - 2005-12-23
http://www.kagami.org/diary/2005-12-23-1.html

jsarticle と jsbook - pLaTeX2e 新ドキュメントクラス

インストール

  http://oku.edu.mie-u.ac.jp/~okumura/jsclasses/jsclasses-041103.zip
  を解凍して
  /usr/local/share/texmf/ptex/platex/js/
  にコピー

使用法

  従来 jarticle としていた部分を jsarticle に,jbook としていた部分を jsbook に直す

\documentclass{jsarticle}
\begin{document}
.
.
.
\end{document}

Reference

  pLaTeX2e 新ドキュメントクラス
  http://oku.edu.mie-u.ac.jp/~okumura/jsclasses/

TeX をコンパイルして dviout で閲覧する秀丸マクロ

ソース (秀丸マクロヘルプのサンプルより)

$platex  = "C:\\tex\\bin\\platex.exe";
$dviout  = "C:\\dviout\\dviout.exe";

// 現在のファイル名を取得
$texfile = basename2;
$dvifile = basename2;

// ファイル名はそのままで拡張子を `tex' から `dvi' に変更
#f_len =strlen($dvifile );          // ファイル名の文字数を取得

#cnt =#f_len -1;                    // カウンター変数の初期化
while(#cnt >0 ){
    $str =midstr($dvifile,#cnt,1 ); // 右側から一文字ずつ抜き出し「$str」に代入
    if($str ==".")break;            // もし拡張子の前に付く「.」だったらwhile文を抜ける
    #cnt =#cnt -1;                  // 「.」が無くてもカウンター変数が0になるとwhile文を抜ける
}
//ファイル名から拡張子のない名前を抜き出し `.dvi' を付加
$dvifile =leftstr($dvifile,#cnt )+".dvi";

runsync2 $platex + " " + $texfile;
run      $dviout + " " + $dvifile;

Windows で TeX のインストール

前提

TeX インストール先 C:\tex
Ghostscript インストール先 C:\gs
GSview インストール先 C:\ghostgum
dviout インストール先 C:\dviout
- 手順
1. 必要なファイルを持ってくる
   W32TeX (Web2C 7.5.3)
   ftp://akagi.ms.u-tokyo.ac.jp/pub/TeX/win32/
   AFPL Ghostscript 8.14
   ftp://akagi.ms.u-tokyo.ac.jp/pub/TeX/win32-gs/gs814w32full.zip
   GSview 4.6
   ftp://ftp.u-aizu.ac.jp/pub/tex/CTAN/support/ghostscript/ghostgum/gsv46w32.exe
   dviout
   ftp://akagi.ms.u-tokyo.ac.jp/pub/TeX/dviout/current_in_Japanese

2. インストール先ディレクトリに texinst753.zip を解凍

3. インストール先ディレクトリで

texinst753.exe 必要なファイルがあるディレクトリ


4. AFPL Ghostscript 8.14
   古い Version の Ghostscript と GSview がインストールされている場合は アンインストールする.
   gs814w32full.zip を解凍 して setupgs.exe を実行

5. GSview 4.6 のインストール
   gsv46w32.exe を実行

6. Ghostscript で 日本語が使用できるように設定変更
   C:\gs\gs8.14\lib\cidfmap を変更
   以下の部分のコメントを外す

/Ryumin-Light << /FileType /TrueType
/Path (msmincho.ttc)
/SubfontID 0 /CSI [(Japan1) 4] >> ;

/GothicBBB-Medium << /FileType /TrueType
/Path (msgothic.ttc)
/SubfontID 0 /CSI [(Japan1) 4] >> ;

7. GSview の設定を変更
   [Option] - [Advanced Configure...] - [Ghostscript Options:] に以下を付け加える

-dWINKANJI

   ちなみに現在のオプションは以下

-dNOPLATFONTS -sFONTPATH="c:\psfonts" -dWINKANJI

8. 環境変数の変更

path=%path%;c:\tex\bin;c:\gs\gs8.14\bin;c:\gs\gs8.14\lib

9. dviout のインストール
   tex315w.zip を解凍して dviout.exe を実行

10. Install fundamental parameters(Font resolution and Paper size)

dpi 300
Paper size A4

11. Register the location of Font files
   [Guess] - [Yes] をクリックして
   TEXROOT と TEXPK を埋める.
   以下のようになった.
TEXROOT C:\tex\share\texmf\fonts
TEXPK ^r\pk\cx\\^s.^dpk;^r\tfm\ptex\^s.tfm;^r\pk\modeless\\^s.^dpk;^r\vf\\^s.vf

12. Register Programs
   Relate DVI file (.dvi to dviout for Windows にチェック
   拡張子がdvi のファイルをdvioutと関連付ける.
   For font generation on demand, push [gen:] to set it
   [gen:] をクリック
   For PostScript, push [gsx:] to set GhostScript
   [gsx:] をクリック
gen: `C:\tex\bin\mktexpk.exe --dpi ^d --bdpi ^D --mag ^M ^s
gsx: C:\gs\gs8.14\bin\gswin32c.exe

13. dviout の設定を確認
    [Option] - [Setup Parameters...] - [Font]タブ
TEXROOT C:\tex\share\texmf\fonts
TEXPK ^r\pk\cx\\^s.^dpk;^r\tfm\ptex\^s.tfm;^r\pk\modeless\\^s.^dpk;^r\vf\\^s.vf
TEXFONTS ^r\tfm\\

    [Option] - [Setup Parameters...] - [Font2]タブ
gen `C:\tex\bin\mktexpk.exe --dpi ^d --bdpi ^D --mag ^M ^s
ftt ^x\map\ttfonts.map
TEXSUBF ^r\sfd\\;^r\..\ttf2pk\\;^r\..\ttf2tfm\\

    [Option] - [Setup Parameters...] - [Graphic]タブ
gsx: C:\gs\gs8.14\bin\gswin32c.exe
spi: Susie Plug-in のディレクトリ

14. EPS 画像以外のBMP/JPG/PNG/EMFなどの画像を取り込むための設定
    dviout の設定ファイルを TeX のディレクトリにコピー
コピー元 コピー先
C:\dviout\graphic\latex2e\dviout.def c:\tex\share\texmf\tex\latex\graphics
C:\dviout\graphic\latex2e\color.cfg c:\tex\share\texmf\tex\latex\config
C:\dviout\graphic\latex2e\graphic.cfg c:\tex\share\texmf\tex\latex\config
Installation of dviout (Windows95/98/Me/NT/2000/XP)には書いてあったが,
    すでに TeX のインストールディレクトリに存在したので上書きせず.

Reference

  TeX Wiki - インストール(Windows)
  http://oku.edu.mie-u.ac.jp/~okumura/texwiki/?%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%28Windows%29
  Installation of TeX system (Windows 95/98/Me/NT/2000/XP)
  http://akagi.ms.u-tokyo.ac.jp/texinst98.html
  Installation of dviout (Windows95/98/Me/NT/2000/XP)
  http://akagi.ms.u-tokyo.ac.jp/tex_dvioutw.html
  Susieの部屋
  http://www.digitalpad.co.jp/~takechin/
  渡辺 裕朗 - ソフトウエア - ifPNG.spi (PNG用プラグイン)
  http://www.asahi-net.or.jp/~DS8H-WTNB/software/

TexPoint

Summary

  Texで指定された出力をPowerPointの図として簡単に貼ることができる機能を PowerPointに付加する

注意

  [TexPoint add-in] - [Symbol fonts] をインストールすると元のtexシステムが壊れて,根号などのフォントがおかしくなるらしい.

TeXPointを自動インストールすると,BaKoMaフォントのファイルがいくつかインストールされ,pathが通されます.
このときインストールされるBaKoMaフォントと,TeX導入時にインストールされたBaKoMaフォントが (ファイルサイズなど) 微妙に異なっているのが原因のようです (?)
TeXPointをアンインストールして,dvioutの表示は正常になりました.

  \surd記号が上にずれる,\le記号が表示されない
  Re: \surd記号が上にずれる,\le記号が表示されない--解決

Reference

  TexPoint - A Latex add-in for Powerpoint
  http://raw.cs.berkeley.edu/texpoint/
  TexPointの紹介
  http://www.riam.kyushu-u.ac.jp/fluid/texpoint.html

部分的に行間を変更する方法

宣言

\newenvironment{minilinespace}{
	\baselineskip = 1mm
}

verbatim環境の行間の場合の宣言

\newenvironment{minilinespace}{
	\verbatimbaselineskip = 1mm
}

使用例

\begin{minilinespace}
[行間を変えたい内容]
\end{minilinespace}

追記

  電子情報通信学会のverbatim環境の行間を変更するために必要だった

Reference

  TEX: 部分的に行間を変える方法 @sarunoie
  http://www.mlab.t.u-tokyo.ac.jp/~saru/archives/000032.php

章番号を付けない方法

章番号を付けるべきでない章

  謝辞 (Acknowledgement)
  付録 (Appendix)
  索引 (Index)

方法

\section*{謝辞}
\chapter*{謝辞}