1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ログイン不可ユーザでplatexコマンドが使えない時の対応

Posted at

#状況
apacheで動いてるphpからシェルスクリプト実行して,platexとdvipdfmxでpdfを生成するプログラムで,pdfが生成されずエラーになってた.

#問題
こんなメッセージが出て.texのコンパイルが通らずに終了していた.

This is pTeXk, Version 3.141592-p3.1.10 (euc) (Web2C 7.5.6)
 %&-line parsing enabled.
I can't find the format file `platex.fmt'!

しかしながらrootとかで直接platex叩いたり,シェルスクリプト実行したりすると問題なくpdfが生成できる.

#原因
エラーメッセージの通り,パスの通っているところにplatex.fmtがない.

##なんで無いのか
texの設定ファイル(texmf.cnf)を見てみる
/usr/share/texmf/web2c/texmf.cnf

どうやらユーザのホームディレクトリ以下にパスが通っている.
rootのホームディレクトリを見ると,確かに置いているらしい.
なので,ログイン可のrootではコンパイル通るけど,apacheはログイン不可=ホームディレクトリないのでコンパイル通らない.

% TEXMFSYSCONFIG, where texconfig-sys stores configuration data.
% With teTeX-3.0 or later, this must be set.
% For sharing this tree with $TEXMFMAIN:
%   TEXMFSYSCONFIG = $TEXMFMAIN
% For using a separate tree:
%   TEXMFSYSCONFIG = $SELFAUTOPARENT/texmf-config
TEXMFSYSCONFIG = /etc/texmf

% User texmf trees are allowed as follows.
% This used to be HOMETEXMF.
TEXMFHOME = $HOME/texmf

% TEXMFVAR, where texconfig stores variable runtime data.
% With teTeX-3.0 or later, this must be set.
% For sharing this tree with $TEXMFMAIN:
%   TEXMFVAR = $TEXMFMAIN
% For using a separate tree:
%   TEXMFVAR = $HOME/.texmf-var  # teTeX 3.0 default
TEXMFVAR = $HOME/.texlive2007/texmf-var

% TEXMFCONFIG, where texconfig stores configuration data.
% With teTeX-3.0 or later, this must be set.
% For sharing this tree with $TEXMFMAIN:
%   TEXMFCONFIG = $TEXMFMAIN
% For using a separate tree:
%   TEXMFCONFIG = $HOME/.texmf-config  # teTeX 3.0 default
% For using a separate tree:
%   TEXMFCONFIG = $SELFAUTOPARENT/texmf-config
TEXMFCONFIG = $HOME/.texlive2007/texmf-config

% Now, list all the texmf trees. If you have multiple trees you can
% use shell brace notation, like this:
%   TEXMF = {$TEXMFHOME,!!$TEXMFLOCAL,!!$TEXMFMAIN}
% The braces are necessary.
%
% For texconfig to work properly, TEXMFCONFIG and TEXMFVAR should be named
% explicitly and before all other trees.
TEXMF = {$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFLOCAL,!!$TEXMFMAIN,!!$TEXMFDIST}

#対処法
パスが通っているところにplatex.fmtを置けばOK.

まず,どこにあるのか探す.

[root@localhost ~]# locate platex.fmt
/home/********/.texlive2007/texmf-var/web2c/ptex/platex.fmt
/root/.texlive2007/texmf-var/web2c/ptex/platex.fmt

あったので,パスが通っているところにコピー
TEXMFSYSCONFIG = /etc/texmfらしいので

[root@localhost web2c]$ cp ~/.texlive2007/texmf-var/web2c/ptex/platex.fmt /etc/texmf/web2c/

解決.

#参考
http://akita-nct.jp/yamamoto/comp/latex/settings/settings.html
http://www.latex-community.org/forum/viewtopic.php?f=12&t=2023

1
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?