pstricks、dvi->ps->pdf ツールチェーン、および文字の組み合わせ rt に関連する奇妙な問題

pstricks、dvi->ps->pdf ツールチェーン、および文字の組み合わせ rt に関連する奇妙な問題

これは非常に奇妙なバグです。[編集]これはバグではなく、問題は私のコードにありました。

これを小さな実用的な例にまとめるのに 1 時間かかりましたが、それが最小限かどうかはわかりません。

セットアップ: Ubuntu 最新リリース、標準更新 .tex。ファイル:

\documentclass{beamer}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage{pst-plot}
\usepackage{pst-math}
\newcommand{\polarWedge}[3]{%
\pstVerb{%
/t #1 def%
}%
}%
\begin{document}
\begin{frame}
\begin{pspicture*}(-3,-1)(1.5,2.3)%
\polarWedge{0}{1}{t 2 div 1 add}%
\end{pspicture*}
rt
\end{frame}
\end{document}

症状: これは dvi->ps-pdf ツールチェーンでは正しくコンパイルされません。pdflatex ではコンパイルされます。問題は文字の組み合わせ rt にあります。rt を rt または他の文字の組み合わせに変更すると、問題はなくなります。これは私が今までに見た中で最も奇妙なものです (rt 文字の処理方法によるものでしょうか?)

この問題がどの程度再現可能かはわかりませんが、お使いのマシンで同じ問題が発生する場合はお知らせください。


[編集] 問題は解決しました。この問題は Herbert によって正しく特定されました。t が内部変数として使用され、t の再定義によって何かが台無しになるという問題です。Herbert によって提案された解決策も正しいものでした。変数 t を評価するローカル ディクショナリを定義し、そのディクショナリをポップする必要があります。スライドの修正版を投稿します。

これはバグではなく、PostScript に関する私の知識不足の現れであると認めざるを得ません。


[編集]@cfr: いいえ、あなたの最小限の例では、私の例と同じ問題は解決されません。私の例では、pspicture を削除すると、スライドは文字 rt で問題なくコンパイルされます。rt バグは、pspicture を使用する場合にのみ発生します。


@Herbert: はい、問題は文字 t が複数の場所で使用されていることと、文字 t を再定義するために \pstVerb が使用されていることにあると思います。ただし、関数を評価するには文字 t に値を割り当てる必要があります。\pstVerb を使用せずにそれを実行する方法はありますか?


[編集] @cfr: 私が受け取ったエラーは ps2pdf 実行可能ファイルからのものでした。エラー レポートは次のようになります:

プロセスが開始されました: ps2pdf "pstricksProblem".ps

エラー: --restore-- 内の /invalidrestore オペランド スタック: (r) 0.4 --nostringval-- --nostringval-- 実行スタック: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1916 1 3 %oparray_pop 1915 1 3 %oparray_pop 1899 1 3 %oparray_pop 1787 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- 1839 3 4 %oparray_pop --nostringval-- 1823 3 4 %oparray_pop --nostringval-- 辞書スタック: --dict:1175/1684(ro)(G)-- --dict:1/20(G)-- --dict:163/200(L)-- --dict:189/300(L)-- 現在の割り当てモードはローカルです 現在のファイル位置は 133316 です GPL Ghostscript 9.10: 回復不能なエラー、終了コード 1

プロセスはエラーで終了しました


[編集] 質問があったので、元のスライドは次のようになります。

\documentclass{beamer}
\usepackage{etex}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage{auto-pst-pdf}
\usepackage{pst-plot}
\usepackage{pst-math}
\newcommand{\polarWedge}[3]{%
\pstVerb{%
/t #1 def%
/firstX #1 57.29578 mul cos #3 mul def%
/firstY #1 57.29578 mul sin #3 mul def%
}%
\pstVerb{%
/t #2 def%
/secondX #2 57.29578 mul cos #3 mul def%
/secondY #2 57.29578 mul sin #3 mul def%
}%
\pscustom[fillcolor=cyan, fillstyle=solid, linecolor=blue]{%
\psline(0,0)(! firstX firstY)(! secondX secondY)(0,0)%
}%
}%
\newcommand{\drawPolar}[4]{%
\parametricplot[#4]{#1}{#2}{#3 t 57.29578 mul cos mul #3 t 57.29578 mul sin mul}%
}

\begin{document}
\begin{frame}
\begin{pspicture*}(-3,-1)(3.5,3.3)%
\uncover<2->{%
\polarWedge{0}{0.05}{3 t sub}%
}%
\uncover<3->{%
\polarWedge{0.05}{0.1}{3 t sub}%
}%
\uncover<4->{%
\polarWedge{0.1}{0.15}{3 t sub}%
}%
\uncover<5->{%
\polarWedge{0.15}{0.2}{3 t sub}%
}%
\uncover<6->{%
\polarWedge{0.2}{0.25}{3 t sub}%
}%
\uncover<7->{%
\polarWedge{0.25}{0.3}{3 t sub}%
}%
\uncover<8->{%
\polarWedge{0.3}{0.35}{3 t sub}%
}%
\uncover<9->{%
\polarWedge{0.35}{0.4}{3 t sub}%
}%
\drawPolar{0}{2.5}{3 t sub}{linecolor=red, plotpoints=1000}%
\end{pspicture*}
\uncover<1-10>{}
rt
\end{frame}
\end{document}

[編集]私が使用する変数はtと呼ばれています。関数を渡しているからです。

3tサブ

\parametricplot を呼び出す関数の引数として、parametricplot に使用されている変数名は t です。ご希望であれば、引数が関数である関数を作成します。もちろん、私の設定は、変数 "t" がローカル変数であるという仮定に完全に依存しています。これが当てはまることは、文字 r と t が別々である場合に上記のスライドが機能するという事実によって裏付けられています。ただし、文字 r と t が並んでいることの役割は、私にはわかりません。

[編集] スライドの最終修正版。修正は、Herbert のアドバイス (本当にありがとう!) と、PostScript ドキュメントを少し読んだことに基づいて行われました。

\documentclass{beamer}
\usepackage{etex}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage{auto-pst-pdf}
\usepackage{pst-plot}
\usepackage{pst-math}
\newcommand{\polarWedge}[3]{%
\pstVerb{%
/firstX  1 dict begin /t #1 def #1 57.29578 mul cos #3 mul end def%
/firstY  1 dict begin /t #1 def #1 57.29578 mul sin #3 mul end def%
/secondX 1 dict begin /t #2 def #2 57.29578 mul cos #3 mul end def%
/secondY 1 dict begin /t #2 def #2 57.29578 mul sin #3 mul end def%
}%
\pscustom[fillcolor=cyan, fillstyle=solid, linecolor=blue]{%
\psline(0,0)(! firstX firstY)(! secondX secondY)(0,0)%
}%
}%
\newcommand{\drawPolar}[4]{%
\parametricplot[#4]{#1}{#2}{#3 t 57.29578 mul cos mul #3 t 57.29578 mul sin mul}%
}

\begin{document}
\begin{frame}
\begin{pspicture*}(-3,-1)(3.5,3.3)%
\uncover<2->{%
\polarWedge{0}{0.05}{3 t sub}%
}%
\uncover<3->{%
\polarWedge{0.05}{0.1}{3 t sub}%
}%
\uncover<4->{%
\polarWedge{0.1}{0.15}{3 t sub}%
}%
\uncover<5->{%
\polarWedge{0.15}{0.2}{3 t sub}%
}%
\uncover<6->{%
\polarWedge{0.2}{0.25}{3 t sub}%
}%
\uncover<7->{%
\polarWedge{0.25}{0.3}{3 t sub}%
}%
\uncover<8->{%
\polarWedge{0.3}{0.35}{3 t sub}%
}%
\uncover<9->{%
\polarWedge{0.35}{0.4}{3 t sub}%
}%
\drawPolar{0}{2.5}{3 t sub}{linecolor=red, plotpoints=1000}%
\end{pspicture*}
\uncover<1-10>{}
\end{frame}
\end{document}

-トドル・ミレフ

答え1

何を表示したいのか、私にはまったくわかりません。 すでに述べたように、tは によって内部的に使用されbeamer、 によって変数としても使用され\psparametricplotます。 これを再定義するのは危険です。何を見せたいか教えてくださいそして、私たちは役に立つ助けを提供することができます。ただし、ここにあなたの例があります:

\documentclass{beamer}
\usepackage{etex}
\usepackage{pst-plot}
\usepackage{pst-math}
\newcommand\polarWedge[3]{%
  \pstVerb{/t #1 def}
  \pscustom[fillcolor=cyan,fillstyle=solid,linecolor=blue,linewidth=0.2pt]{
    \psline(0,0)(! #1 COS #3 mul #1 SIN #3 mul)
    \parametricplot{#1}{#2}{#3 t COS mul #3 t SIN mul}
    \closepath}}
\newcommand\drawPolar[4]{%
  \parametricplot[#4]{#1}{#2}{#3 t COS mul #3 t SIN mul}%
}

\begin{document}
\begin{frame}
\begin{pspicture*}(-3,-1)(3.5,3.3)%
\multido{\iA=2+1,\rA=0.00+0.05,\rB=0.05+0.05}{16}{%
  \uncover<\iA->{\polarWedge{\rA}{\rB}{3 t sub}}}%
\drawPolar{0}{2.5}{3 t sub}{linecolor=red, plotpoints=100}%
\end{pspicture*}

rt
\end{frame}
\end{document}

最後のスライドのビュー:

ここに画像の説明を入力してください

関連情報