hoge diary - February 24, 2007

[TeX関連] Beamer + iniptex の怪

Beamer というプレゼンテーション用文書を作成するためのスタイルファイルを使ってプレゼン資料を書いてみようと思い,Vim を使いつつ Whizzytex のようにプレビューしながら表示するためのシェルスクリプトを書くことにしました.

prosperPowerdot スタイルに対応したスクリプトは既にありますが (これらはまだ配布していません),Beamer に対してはそのままでは使えないようです.

調べてみると,iniptex で取得したフォーマットを使ってタイプセットした結果の DVI ファイルが正しくない様子です.調べるための実験に用意した LaTeX ソースは以下の通り.ここではこのファイルを仮に test.tex とします.

\documentclass{beamer}

\begin{document}
\begin{frame}
  \frametitle{hoge}
  text

  \begin{itemize}
    \item 1
    \item 2
    \item 3
    \begin{itemize}
      \item 3-1
      \item 3-2
      \item 3-3
    \end{itemize}
  \end{itemize}
\end{frame}
\end{document}

これを platex を用いて普通にタイプセットすると DVI ファイルが生成されます.

% platex test.tex
This is pTeX, Version 3.14159-p3.1.5 (euc) (Web2C 7.4.5)
(./test.tex
pLaTeX2e <2005/01/04>+0 (based on LaTeX2e <2001/06/01> patch level 0)
(/usr/share/texmf/tex/latex/beamer/base/beamer.cls
(/usr/share/texmf/tex/latex/beamer/base/beamerbasercs.sty)
Document Class: beamer 2004/10/07 release version 3.00 A class for typesetting
presentations (rcs-revision 1.54)
(中略)

LaTeX Font Warning: Font shape `OT1/cmss/m/n' in size <4> not available
(Font)              size <5> substituted on input line 37.

[1] (./test.aux)

LaTeX Font Warning: Size substitutions with differences
(Font)              up to 1.0pt have occurred.

 )
Output written on test.dvi (1 page, 9180 bytes).
Transcript written on test.log.
%

次に,iniptex を使ってフォーマットを行い,そこで得たフォーマットを使ってタイプセットします.ここでは,この一連の処理を「2 段階タイプセット」と呼ぶことにします.では,まず最初にフォーマットを行います.フォーマットを行うためには,元のソースからプリアンブルだけを抜き出し,最後に \dump コマンドの呼び出しを書いたソースを initex で処理するだけです.変更したソースファイルは以下の通り.実にシンプルです.ここではこのファイルを test2.tex とします.

\documentclass{beamer}
\dump

これを iniptex で処理します.以下の例では iniptex の代わりに platex -ini を使用しています.

% platex -ini '&platex' test2.tex
This is pTeX, Version 3.14159-p3.1.5 (euc) (Web2C 7.4.5) (INITEX)
(./test2.tex
pLaTeX2e <2005/01/04>+0 (based on LaTeX2e <2001/06/01> patch level 0)
(/usr/share/texmf/tex/latex/beamer/base/beamer.cls
(/usr/share/texmf/tex/latex/beamer/base/beamerbasercs.sty)
Document Class: beamer 2004/10/07 release version 3.00 A class for typesetting
presentations (rcs-revision 1.54)
(中略)
Beginning to dump on file test2.fmt
 (format=test2 2007.2.24)
10634 strings of total length 163209
182871 memory locations dumped; current usage is 332&178411
9232 multiletter control sequences
(中略)
No pages of output.
Transcript written on test2.log.
%

フォーマットが終わったので,得られたフォーマットファイルを使って本文だけのソース(test3.tex, 中身は省略)をタイプセットします.

% platex '&test3' test3.tex
This is pTeX, Version 3.14159-p3.1.5 (euc) (Web2C 7.4.5)
(./test3.tex
pLaTeX2e <2005/01/04>+0 (based on LaTeX2e <2001/06/01> patch level 0)
No file test3.aux.
(/usr/share/texmf/tex/latex/hyperref/nameref.sty)
No file test3.nav.
(/usr/share/texmf/tex/latex/amsfonts/umsa.fd)
(/usr/share/texmf/tex/latex/amsfonts/umsb.fd)

LaTeX Font Warning: Font shape `OT1/cmss/m/n' in size <4> not available
(Font)              size <5> substituted on input line 32.

[1] (./test3.aux)

LaTeX Font Warning: Size substitutions with differences
(Font)              up to 1.0pt have occurred.

 )
Output written on test3.dvi (1 page, 4112 bytes).
Transcript written on test3.log.
%

続いて,得られたそれぞれの DVI ファイルを dvips(k) を使って PostScript に変換し,ESP GhostScript 7.07 でレンダリングしてみます.その結果,2 段階でタイプセットした方はレンダリングに失敗します.

% dvips test.dvi
This is dvips(k) 5.92b p1.6a Copyright 2004 ASCII Corp.(www-ptex@ascii.co.jp)
based on dvips(k) 5.92b Copyright 2002 Radical Eye Software (www.radicaleye.com)
' TeX output 2007.02.24:1837' -> test.ps
<texc.pro><special.pro><color.pro>. [1]
% gs -sDEVICE=x11 -dSAFER -dBATCH -dNOPAUSE -q test.ps               ←正常に表示
% dvips test3.dvi
This is dvips(k) 5.92b p1.6a Copyright 2004 ASCII Corp.(www-ptex@ascii.co.jp)
based on dvips(k) 5.92b Copyright 2002 Radical Eye Software (www.radicaleye.com)
' TeX output 2007.02.24:1856' -> test3.ps
<texc.pro><special.pro><color.pro>. [1]
% gs -sDEVICE=x11 -dSAFER -dBATCH -dNOPAUSE -q test3.ps
Error: /undefined in pgfo                                   ←エラー
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   1   3   %oparray_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1050/1417(ro)(G)--   --dict:0/20(G)--   --dict:69/200(L)--   --dict:195/300(L)--
Current allocation mode is local
Current file position is 17348
ESP Ghostscript 7.07.1: Unrecoverable error, exit code 1

最初にこのエラーに遭遇したときは,なんでやねん,と思わずツッコんでしまいました.2 段階タイプセットしても同じ DVI ファイルが得られると思っていたからです.

両方の PostScript ファイルを見比べると,確かに 2 段階タイプセットした方には pgfo の定義がありません.いずれの場合でも,prosperPowerdot を用いた場合は PostScript ファイルに pgfo の定義が含まれていないので,Beamer 固有の問題と考えているわけですが,これはどうやって解決すればよいのか...

考えている解決策は次の 2 通り.

  • Beamer 使用時は 2 段階タイプセットを行わない.
  • 2 段階タイプセットを行った上で,pgfo およびその他の必要な定義をシェルスクリプト側で自動的に PostScript ファイルに書き加える.

上の 2 つはどちらもかなり安直ですから,今はもう少し pgfo について調べてみることにします.

コメント

名前(何でも可):

テキスト(http:// を含む内容は投稿できません):

トラックバック

トラックバック URI: https://www.pakunet.jp/hoge/trackback/2007022401

トラックバックはありません.


Valid XHTML 1.1! Valid CSS!
© 2004-2009 ぱくちゃん.
Last modified: Thu Nov 01 01:17:16 JST 2007