pTeXが使えなくなる→解決

MacPortsをselfupdateしてから、pTeXが使えなくなった。(実は、この認識が、そもそもの間違いだった)

% platex report
warning: Configuration file texmf.cnf not found! Searched these directories:
/opt/local/share/texmf
Trying to proceed...
This is pTeX, Version 3.141592-p3.1.10 (euc) (Web2C 7.5.4)
kpathsea: Running mktexfmt platex.fmt
warning: Configuration file texmf.cnf not found! Searched these directories:
/opt/local/share/texmf
Trying to proceed...
/opt/local/bin/mktexfmt: line 333: /texconfig/tcfmgr: No such file or directory
fmtutil: config file `fmtutil.cnf' not found.
I can't find the format file `platex.fmt'!

もちろん、texmf.cnfもfmtutil.cnfもある。mktexfmtの333行目を見てみることにするか。

% cat -n /opt/local/bin/mktexfmt | head -336|tail -10
   327  # tcfmgr(args)
   328  #   call tcfmgr script
   329  ###############################################################################
   330  tcfmgr()
   331  {
   332    initTexmfMain
   333    "$MT_TEXMFMAIN/texconfig/tcfmgr" "$@"
   334  }
   335
   336  ###############################################################################

この$MT_TEXMFMAINという変数に何もセットされてないってオチなのかな?このmktexfmtを見てみると、こんな行があった。

initTexmfMain()
{
  case $MT_TEXMFMAIN in
    "") MT_TEXMFMAIN=`kpsewhich --var-value=TEXMFMAIN`;;
  esac
  export MT_TEXMFMAIN
}

このkpsewhichがクセモノっぽい。

% kpsewhich --var-value=TEXMFMAIN
warning: Configuration file texmf.cnf not found! Searched these directories:
/opt/local/share/texmf
Trying to proceed...
port provides /opt/local/bin/kpsewhich
/opt/local/bin/kpsewhich is provided by: pTeX

さて、どうしたものか。

問題解決

Googleでkpsewhichを検索してみたところ、以下のような記述を発見。

kpathsearchライブラリの設定ファイルは、 texmf.cnfというファイルです。 通常、$TEXMF/web2cディレクトリに収められています。 環境変数 TEXMFCNF に、texmf.cnfのあるディレクトリを指定すれば、 マルチユーザ環境の場合などで、個人ごとに設定を変更することもできます。
(サイト閉鎖のお知らせ | ASCII Books)

ということは、環境変数TEXMFCNFを適切に設定すればOKそうだ。

% export TEXMFCNF=/opt/local/share/texmf/web2c
% platex report
This is pTeX, Version 3.141592-p3.1.10 (euc) (Web2C 7.5.4)
(./report.tex
pLaTeX2e <2006/11/10>+0 (based on LaTeX2e <2003/12/01> patch level 0)
(/opt/local/share/texmf/ptex/platex/jsclasses/jsarticle.cls
Document Class: jsarticle 2007/10/24 okumura
...
Output written on report.dvi (6 pages, 16860 bytes).
Transcript written on report.log.

ということで、何のことはない環境変数一つの問題だった。さあ、この環境変数を.MacOSX/environment.plistに書いておくか、、、。と、思ったら、こんな記述を.MacOSX/environment.plist内に発見。原因はMacPortsをselfupdateしたことではなく、自分の作業ミスだった。いつ、こんなの書いたっけ?覚えてない、、、。

        TEXMFCNF
        /opt/local/share/texmf

ああ、一日まるまる無駄にしてしまった。