本日、休日を利用して、常用しているメインのノートPCをUbuntu 11.10に移行しました。必要なデータをバックアップしておき、クリーンインストールです。アップグレードしてしまうと、インストール済みのアプリの設定が悪さしてしまう気がするのと、比較的純粋な環境で使いたかったためで、他意はありません。
新規にLinuxをインストールした場合、はじめにインストールするアプリの1つにLaTeXがあるのですが、あえてデフォルトのTeXLiveは使わず、UTF-8に対応しているTeXLive2011を入れてみることにしました。結構、時間と手間がかかりましたので、覚書として残しておきます。
TeXLive2011を利用したTeXworksを使用しているところ:TeXのソースが表示されているウィンドウの左上にある緑色のボタンをクリックするだけで、コンパイルとPDFファイルのプレビューが同時にできる。
● ダウンロード元:Installing TeX Live over the Internet
まず、端末で下記のコマンドを実行し、パッケージを入手して展開します。
$ wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
$ tar zxvf install-tl-unx.tar.gz
あとは、展開してできたディレクトリに移動して、「install-tl」というスクリプトを実行するだけです。といっても、このスクリプトで処理が終了するまでには、相当な時間がかかります。家の環境(すいません、いまだにADSL)では、75分ほどかかりました...orz
$ cd install-tl-20111130
(注意:ディレクトリ名はダウンロードした日付によって異なります)
$ sudo ./install-tl
[sudo] password for (username):(パスワードを入力してリターンします)
ツイート
新規にLinuxをインストールした場合、はじめにインストールするアプリの1つにLaTeXがあるのですが、あえてデフォルトのTeXLiveは使わず、UTF-8に対応しているTeXLive2011を入れてみることにしました。結構、時間と手間がかかりましたので、覚書として残しておきます。

TeXLive2011のインストール
TeXLive2011は、下記のサイトにあるソースファイルからインストールする必要があります。英語のサイトですが、日本語に対応したパッケージも同梱されていますので、心配無用。ただし、今回はwgetで入手しますので、同サイトから直接ダウンロードする必要はありません。● ダウンロード元:Installing TeX Live over the Internet
まず、端末で下記のコマンドを実行し、パッケージを入手して展開します。
$ wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
$ tar zxvf install-tl-unx.tar.gz
あとは、展開してできたディレクトリに移動して、「install-tl」というスクリプトを実行するだけです。といっても、このスクリプトで処理が終了するまでには、相当な時間がかかります。家の環境(すいません、いまだにADSL)では、75分ほどかかりました...orz
$ cd install-tl-20111130
(注意:ディレクトリ名はダウンロードした日付によって異なります)
$ sudo ./install-tl
[sudo] password for (username):(パスワードを入力してリターンします)
以下に、スクリプトの実行で表示される内容の最初と最後の部分だけ抜粋しておきます。
Loading ftp://ftp.riken.go.jp/pub/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb
Installing TeX Live 2011 from: ftp://ftp.riken.go.jp/pub/tex-archive/systems/texlive/tlnet
Platform: i386-linux => 'Intel x86 with GNU/Linux'
Distribution: net (downloading)
Using URL: ftp://ftp.riken.go.jp/pub/tex-archive/systems/texlive/tlnet
Directory for temporary files: /tmp
======================> TeX Live installation procedure <=====================
□ □ □ 中略:相当な量の出力です。2500程度のパッケージが処理されます。 □ □ □
Add /usr/local/texlive/2011/texmf/doc/man to MANPATH, if not dynamically determined.
Add /usr/local/texlive/2011/texmf/doc/info to INFOPATH.
Most importantly, add /usr/local/texlive/2011/bin/i386-linux
to your PATH for current and future sessions.
Welcome to TeX Live!
Logfile: /usr/local/texlive/2011/install-tl.log
$
(ここで、プロンプトに戻れば終了)
続いて、TeXLive専用のパッケージマネージャであるtlmgrを利用してシンボリックリンクを追加しておきます。これにより、/usr/local/binなどにシンボリックリンクが作成され、そこからTeXシステムにアクセスすることができるようになるとともに、管理者権限を要求するTeX関連のコマンド(sudo texhash など)も実行時にフルパスで指定をしなくてもよくなります。また、TeXLiveのディレクトリを環境変数のPATH,MANPATH,INFOPATHに加える必要もありません。
$ sudo /usr/local/texlive/2011/bin/i386-linux/tlmgr path add
リンクを取り除く場合は「path add」の代わりに「path remove」を用います。
はじめに下記のコマンドで国内のCTAN mirror(ここではjaist.ac.jpにしました)のリポジトリを指定しておきます。
$ sudo tlmgr option repository http://ftp.jaist.ac.jp/pub/CTAN/systems/texlive/tlnet/
tlmgr自体をアップデートするには、
$ sudo tlmgr update --self
また、インストールされているTeXLiveをすべてアップデートするには--allオプションを使います。
$ sudo tlmgr update --all
$ sudo apt-get install equivs
equivsのインストールを行うと、下記の21個の依存パッケージが追加インストールされ、「37.2MB」のディスク容量が消費されます。
[equivs depends]
build-essential debhelper dpkg-dev equivs fakeroot
g++ g++-4.6 gettext html2text intltool-debian
libalgorithm-diff-perl libalgorithm-diff-xs-perl
libalgorithm-merge-perl libdpkg-perl libmail-sendmail-perl
libstdc++6-4.6-dev libsys-hostname-long-perl libtimedate-perl
libunistring0 patch po-debconf
続いて、下記の手順でdummyパッケージを準備します。
$ mkdir -p /tmp/tl-equivs
$ cd /tmp/tl-equivs
$ equivs-control texlive-local
ここで、保存されたtexlive-localというファイルを以下の内容に置き換えます。
[texlive-local]
Section: misc
Priority: optional
Standards-Version: 3.9.2
Package: texlive-local
Version: 2011-1~1
Maintainer: you <you@yourdomain.example.org>
Provides: biblatex, biblatex-dw, cm-super, cm-super-minimal, context, dvipng,
feynmf, fragmaster, lacheck, latex-beamer, latex-cjk-all, latex-cjk-chinese,
latex-cjk-chinese-arphic-bkai00mp, latex-cjk-chinese-arphic-bsmi00lp,
latex-cjk-chinese-arphic-gbsn00lp, latex-cjk-chinese-arphic-gkai00mp,
latex-cjk-common, latex-cjk-japanese, latex-cjk-japanese-wadalab,
latex-cjk-korean, latex-cjk-thai, latex-cjk-xcjk, latexmk, latex-sanskrit,
latex-xcolor, lcdf-typetools, lmodern, luatex, musixlyr, musixtex, pgf,
preview-latex-style, prosper, ps2eps, psutils, purifyeps, t1utils, tex4ht,
tex4ht-common, tex-gyre, texlive, texlive-base,
texlive-bibtex-extra, texlive-binaries, texlive-common,
texlive-doc-base, texlive-doc-bg, texlive-doc-cs+sk, texlive-doc-de,
texlive-doc-el, texlive-doc-en, texlive-doc-es, texlive-doc-fi,
texlive-doc-fr, texlive-doc-it, texlive-doc-ja, texlive-doc-ko,
texlive-doc-mn, texlive-doc-nl, texlive-doc-pl, texlive-doc-pt,
texlive-doc-ru, texlive-doc-si, texlive-doc-th, texlive-doc-tr,
texlive-doc-uk, texlive-doc-vi, texlive-doc-zh, texlive-extra-utils,
texlive-fonts-extra, texlive-fonts-extra-doc, texlive-fonts-recommended,
texlive-fonts-recommended-doc, texlive-font-utils, texlive-formats-extra,
texlive-games, texlive-generic-extra, texlive-generic-recommended,
texlive-humanities, texlive-humanities-doc, texlive-lang-african,
texlive-lang-all, texlive-lang-arab, texlive-lang-arabic,
texlive-lang-armenian, texlive-lang-croatian, texlive-lang-cyrillic,
texlive-lang-czechslovak, texlive-lang-danish, texlive-lang-dutch,
texlive-lang-finnish, texlive-lang-french, texlive-lang-german,
texlive-lang-greek, texlive-lang-hebrew, texlive-lang-hungarian,
texlive-lang-indic, texlive-lang-italian, texlive-lang-latin,
texlive-lang-latvian, texlive-lang-lithuanian, texlive-lang-manju,
texlive-lang-mongolian, texlive-lang-norwegian, texlive-lang-other,
texlive-lang-polish, texlive-lang-portuguese, texlive-lang-spanish,
texlive-lang-swedish, texlive-lang-tibetan, texlive-lang-ukenglish,
texlive-lang-vietnamese, texlive-latex3, texlive-latex-base,
texlive-latex-base-doc, texlive-latex-extra, texlive-latex-extra-doc,
texlive-latex-recommended, texlive-latex-recommended-doc, texlive-luatex,
texlive-math-extra, texlive-metapost, texlive-metapost-doc, texlive-music,
texlive-omega, texlive-pictures, texlive-pictures-doc, texlive-plain-extra,
texlive-pstricks, texlive-pstricks-doc, texlive-publishers,
texlive-publishers-doc, texlive-science, texlive-science-doc, texlive-xetex,
texpower, texpower-manual, thailatex, tipa, ttf-freefont, ttf-gfs-artemisia,
ttf-gfs-baskerville, ttf-gfs-bodoni-classic, ttf-gfs-didot,
ttf-gfs-didot-classic, ttf-gfs-gazis, ttf-gfs-neohellenic, ttf-gfs-olga,
ttf-gfs-porson, ttf-gfs-solomos, ttf-gfs-theokritos, ttf-sil-gentium, xindy,
xindy-rules
Architecture: all
Description: My local installation of TeX Live 2011.
A full "vanilla" TeX Live 2011
http://tug.org/texlive/debian#vanilla
下記のコマンドでdummyパッケージを作成します。
$ equivs-build texlive-local
dpkgコマンドで、dummyパッケージをインストールします。
$ sudo dpkg -i texlive-local_2009-1_all.deb
(注意:パッケージ名はダウンロードしたタイミングによって異なる場合があります)
これで、準備が整いましたので、TeXworksをインストールします。
$ sudo apt-get install texworks
[.latexmkrc]
$latex = 'platex -kanji=utf8 -src-specials -interaction=nonstopmode';
$bibtex = 'pbibtex -kanji=utf8';
$dvips = 'dvipsk';
$dvipdf = 'dvipdfmx %O -o %D %S';
$makeindex = 'mendex -U -r -c -s dot.ist';
$dvi_previewer ='xdvi';
$pdf_previewer = 'evince %O %S';
$pdf_mode = 3;
$pdf_update_method = 0;
TeXworksを起動して設定画面を表示させます。
タイプセットのLaTeXmkを選択して、「編集」ボタンをクリックします。また、デフォルトのタイプセットを「LaTeXmk」にしておきます。
LaTeXmkの因数はデフォルトで数行の記述がありますが、$fullnameのみ残して他の行を削除します。
TeXworksの編集画面で、LaTeXmkを指定します。
以上で、TeXLive2011のインストール、および、日本語を含むTeX文書のTeXworksでの編集が可能になるはずです。何か、書き忘れたことがあるかも知れませんので、気づかれたらご指摘ください。
なお、わざわざTeXLive2011を使わなくても、標準のTeXLiveでTeXソースの文字コードをEUC-JPにして保存すれば使えるでしょう。その場合は、もっと楽に導入できると思います。TeXworksの設定は多少参考になるかも知れませんけど。
Loading ftp://ftp.riken.go.jp/pub/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb
Installing TeX Live 2011 from: ftp://ftp.riken.go.jp/pub/tex-archive/systems/texlive/tlnet
Platform: i386-linux => 'Intel x86 with GNU/Linux'
Distribution: net (downloading)
Using URL: ftp://ftp.riken.go.jp/pub/tex-archive/systems/texlive/tlnet
Directory for temporary files: /tmp
======================> TeX Live installation procedure <=====================
□ □ □ 中略:相当な量の出力です。2500程度のパッケージが処理されます。 □ □ □
Add /usr/local/texlive/2011/texmf/doc/man to MANPATH, if not dynamically determined.
Add /usr/local/texlive/2011/texmf/doc/info to INFOPATH.
Most importantly, add /usr/local/texlive/2011/bin/i386-linux
to your PATH for current and future sessions.
Welcome to TeX Live!
Logfile: /usr/local/texlive/2011/install-tl.log
$
(ここで、プロンプトに戻れば終了)
続いて、TeXLive専用のパッケージマネージャであるtlmgrを利用してシンボリックリンクを追加しておきます。これにより、/usr/local/binなどにシンボリックリンクが作成され、そこからTeXシステムにアクセスすることができるようになるとともに、管理者権限を要求するTeX関連のコマンド(sudo texhash など)も実行時にフルパスで指定をしなくてもよくなります。また、TeXLiveのディレクトリを環境変数のPATH,MANPATH,INFOPATHに加える必要もありません。
$ sudo /usr/local/texlive/2011/bin/i386-linux/tlmgr path add
リンクを取り除く場合は「path add」の代わりに「path remove」を用います。
TeXLive2011のアップデート
上記の方法でインストールしたTeXLiveシステムをアップデートするには、同じくtlmgrを利用します。はじめに下記のコマンドで国内のCTAN mirror(ここではjaist.ac.jpにしました)のリポジトリを指定しておきます。
$ sudo tlmgr option repository http://ftp.jaist.ac.jp/pub/CTAN/systems/texlive/tlnet/
tlmgr自体をアップデートするには、
$ sudo tlmgr update --self
また、インストールされているTeXLiveをすべてアップデートするには--allオプションを使います。
$ sudo tlmgr update --all
TeXworksの導入
以上の方法で、最新版のTeXLiveをインストーラから導入して、TeXworksをapt-getでインストールしようとすると、依存関係にあるAPT管理下のTeXLiveパッケージも再度インストールされてしまいます。これを回避するには、equivsを導入して、dummyパッケージをビルドしておく必要があります。$ sudo apt-get install equivs
equivsのインストールを行うと、下記の21個の依存パッケージが追加インストールされ、「37.2MB」のディスク容量が消費されます。
[equivs depends]
build-essential debhelper dpkg-dev equivs fakeroot
g++ g++-4.6 gettext html2text intltool-debian
libalgorithm-diff-perl libalgorithm-diff-xs-perl
libalgorithm-merge-perl libdpkg-perl libmail-sendmail-perl
libstdc++6-4.6-dev libsys-hostname-long-perl libtimedate-perl
libunistring0 patch po-debconf
続いて、下記の手順でdummyパッケージを準備します。
$ mkdir -p /tmp/tl-equivs
$ cd /tmp/tl-equivs
$ equivs-control texlive-local
ここで、保存されたtexlive-localというファイルを以下の内容に置き換えます。
[texlive-local]
Section: misc
Priority: optional
Standards-Version: 3.9.2
Package: texlive-local
Version: 2011-1~1
Maintainer: you <you@yourdomain.example.org>
Provides: biblatex, biblatex-dw, cm-super, cm-super-minimal, context, dvipng,
feynmf, fragmaster, lacheck, latex-beamer, latex-cjk-all, latex-cjk-chinese,
latex-cjk-chinese-arphic-bkai00mp, latex-cjk-chinese-arphic-bsmi00lp,
latex-cjk-chinese-arphic-gbsn00lp, latex-cjk-chinese-arphic-gkai00mp,
latex-cjk-common, latex-cjk-japanese, latex-cjk-japanese-wadalab,
latex-cjk-korean, latex-cjk-thai, latex-cjk-xcjk, latexmk, latex-sanskrit,
latex-xcolor, lcdf-typetools, lmodern, luatex, musixlyr, musixtex, pgf,
preview-latex-style, prosper, ps2eps, psutils, purifyeps, t1utils, tex4ht,
tex4ht-common, tex-gyre, texlive, texlive-base,
texlive-bibtex-extra, texlive-binaries, texlive-common,
texlive-doc-base, texlive-doc-bg, texlive-doc-cs+sk, texlive-doc-de,
texlive-doc-el, texlive-doc-en, texlive-doc-es, texlive-doc-fi,
texlive-doc-fr, texlive-doc-it, texlive-doc-ja, texlive-doc-ko,
texlive-doc-mn, texlive-doc-nl, texlive-doc-pl, texlive-doc-pt,
texlive-doc-ru, texlive-doc-si, texlive-doc-th, texlive-doc-tr,
texlive-doc-uk, texlive-doc-vi, texlive-doc-zh, texlive-extra-utils,
texlive-fonts-extra, texlive-fonts-extra-doc, texlive-fonts-recommended,
texlive-fonts-recommended-doc, texlive-font-utils, texlive-formats-extra,
texlive-games, texlive-generic-extra, texlive-generic-recommended,
texlive-humanities, texlive-humanities-doc, texlive-lang-african,
texlive-lang-all, texlive-lang-arab, texlive-lang-arabic,
texlive-lang-armenian, texlive-lang-croatian, texlive-lang-cyrillic,
texlive-lang-czechslovak, texlive-lang-danish, texlive-lang-dutch,
texlive-lang-finnish, texlive-lang-french, texlive-lang-german,
texlive-lang-greek, texlive-lang-hebrew, texlive-lang-hungarian,
texlive-lang-indic, texlive-lang-italian, texlive-lang-latin,
texlive-lang-latvian, texlive-lang-lithuanian, texlive-lang-manju,
texlive-lang-mongolian, texlive-lang-norwegian, texlive-lang-other,
texlive-lang-polish, texlive-lang-portuguese, texlive-lang-spanish,
texlive-lang-swedish, texlive-lang-tibetan, texlive-lang-ukenglish,
texlive-lang-vietnamese, texlive-latex3, texlive-latex-base,
texlive-latex-base-doc, texlive-latex-extra, texlive-latex-extra-doc,
texlive-latex-recommended, texlive-latex-recommended-doc, texlive-luatex,
texlive-math-extra, texlive-metapost, texlive-metapost-doc, texlive-music,
texlive-omega, texlive-pictures, texlive-pictures-doc, texlive-plain-extra,
texlive-pstricks, texlive-pstricks-doc, texlive-publishers,
texlive-publishers-doc, texlive-science, texlive-science-doc, texlive-xetex,
texpower, texpower-manual, thailatex, tipa, ttf-freefont, ttf-gfs-artemisia,
ttf-gfs-baskerville, ttf-gfs-bodoni-classic, ttf-gfs-didot,
ttf-gfs-didot-classic, ttf-gfs-gazis, ttf-gfs-neohellenic, ttf-gfs-olga,
ttf-gfs-porson, ttf-gfs-solomos, ttf-gfs-theokritos, ttf-sil-gentium, xindy,
xindy-rules
Architecture: all
Description: My local installation of TeX Live 2011.
A full "vanilla" TeX Live 2011
http://tug.org/texlive/debian#vanilla
下記のコマンドでdummyパッケージを作成します。
$ equivs-build texlive-local
dpkgコマンドで、dummyパッケージをインストールします。
$ sudo dpkg -i texlive-local_2009-1_all.deb
(注意:パッケージ名はダウンロードしたタイミングによって異なる場合があります)
これで、準備が整いましたので、TeXworksをインストールします。
$ sudo apt-get install texworks
TeXworksの設定
このままでは、日本語TeXのplatexコマンドが使われないため、コンパイルに失敗します。そこで、次のような内容のLaTeXmkの設定ファイル(~/.latexmkrc)を作成し、タイプセットとして「LaTeXmk」を利用します。[.latexmkrc]
$latex = 'platex -kanji=utf8 -src-specials -interaction=nonstopmode';
$bibtex = 'pbibtex -kanji=utf8';
$dvips = 'dvipsk';
$dvipdf = 'dvipdfmx %O -o %D %S';
$makeindex = 'mendex -U -r -c -s dot.ist';
$dvi_previewer ='xdvi';
$pdf_previewer = 'evince %O %S';
$pdf_mode = 3;
$pdf_update_method = 0;




以上で、TeXLive2011のインストール、および、日本語を含むTeX文書のTeXworksでの編集が可能になるはずです。何か、書き忘れたことがあるかも知れませんので、気づかれたらご指摘ください。
なお、わざわざTeXLive2011を使わなくても、標準のTeXLiveでTeXソースの文字コードをEUC-JPにして保存すれば使えるでしょう。その場合は、もっと楽に導入できると思います。TeXworksの設定は多少参考になるかも知れませんけど。
ツイート
先日もTeXインストールのことでご指導たまわりありがとうございました。<teXlive 2012>と共に、TeXworksも使用できるようにするため、調べていてこの記事に巡り会いました。
早速、記載の手順にしたがってTeXLive2012 & TeXworksをインストールを実行したところ、TeXworksのインストールまではうまく行ったようです。実行手順:(ほとんど貴ブログ記事の再掲ですが):http://madahiru.blog81.fc2.com/blog-entry-395.html に書きました。
●現状・・しかし、TeXworksでは英文はOKなのですが、日本語文はプリビューできません。エラーメッセージ(ログの表示)は・・
============
** WARNING ** Failed to load AGL file "pdfglyphlist.txt"...
** WARNING ** Failed to load AGL file "glyphlist.txt"...
[1
** ERROR ** Unable to find TFM file "jis".
Output file removed.
Collected error summary (may duplicate other messages):
dvipdf: Command for 'dvipdf' gave return code 256
Latexmk: Use the -f option to force complete processing.
Latexmk: Errors, so I did not complete making targets
=============
TeXworksの「タイプセットボタン」をクリックすると日本語文ex1.dviファイルは生成されていますが、ビュウー画面が出てきません。このdviファイルを端末コマンドで処理すると、pdfファイルが生成できて日本語も表示されます。
なお、TeXworksを使わないで、texlive2012によるコマンド処理では、日本文も問題なくpdf表示されます。