我发现使用 PSTricks的文档和示例对以下问题没有帮助:定义(使用\def
OR \edef
?)thetai=80
,,thetaii=220
。thetaiii=285
然后计算(使用\def
OR \edef
)bet=180+thetai
,,alph=thetai+thetaii
。gam=bet - alph
现在\psarc[linestyle=dotted](ni){2.0}{0}{\X}
仅适用于角度bet
,alph
不适用于gam ()
PS->DVI produces
Process started
Error: /undefined
in !
Operand stack: angleB Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1910 1 3 %oparray_pop 1909 1 3 %oparray_pop 1893 1 3 %oparray_pop 1787 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- Dictionary stack: --dict:1164/1684(ro)(G)-- --dict:0/20(G)-- --dict:123/200(L)-- --dict:175/300(L)-- --dict:38/200(L)-- --dict:100/200(L)-- Current allocation mode is local Last OS error: 2 Current file position is 128390 GPL Ghostscript 9.05: Unrecoverable error, exit code 1
Process exited with error(s)
示例代码
\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-circ}
\usepackage{pst-math}
\usepackage{pdfpages}
\usepackage{auto-pst-pdf}
\usepackage{pstricks-add}
\begin{document}
\begin{center}
\begin{pspicture}
[showgrid=false](-5,-5)(5,5)
\def\r{4 }
\pnode(0,0){origin}
\pscircle(origin){\r}
\def\thetai{80.0 }
\def\XYi{!\thetai cos \r mul \thetai sin \r mul }
\pnode(\XYi){ni}
\qline(origin)(ni)
\def\thetaii{220.0 }
\def\XYii{! \thetaii cos \r mul \thetaii sin \r mul }
\pnode(\XYii){nii}
\qline(origin)(nii)
\def\thetaiii{285.0 }
\def\XYiii{! \thetaiii cos \r mul \thetaiii sin \r mul }
\pnode(\XYiii){niii}
\qline(origin)(niii)
\thetaiii
\psline(ni)(nii)(niii)(ni)
\def\bet{!180.0 \thetai add }
\bet
\def\alph{! \thetai\space \thetaii\space add }
\alph
\edef\gam{! \bet\space \alph\space sub }
\gam
\psarc[linestyle=dotted](ni){2.0}{0}{\alph}
\psarc[linestyle=dotted](ni){1.5}{0}{\bet}
\psarc[linestyle=dotted](ni){1.5}{0}{\gam}
\end{pspicture}
\end{center}
\end{document}
答案1
对于角度,使用方式如下:
\def\bet{ 180.0 \thetai add }
\def\alph{ \thetai\space \thetaii\space add }
\edef\gam{ \bet\space \alph\space sub }
\psarc[linestyle=dotted](ni){2.0}{0}{!\alph}
\psarc[linestyle=dotted](ni){1.5}{0}{!\bet}
\psarc[linestyle=dotted](ni){1.5}{0}{!\gam}
否则!
PSTricks 无法提取。这种情况只发生在可以用多种方式定义的角度上。
完整的工作示例:
\documentclass{article}
\usepackage{auto-pst-pdf}
\usepackage{pstricks-add}
\begin{document}
\begin{pspicture}(-5,-5)(5,5)
\def\r{4 }
\pnode(0,0){origin}
\pscircle(origin){\r}
\def\thetai{80.0 }
\def\XYi{!\thetai cos \r mul \thetai sin \r mul }
\pnode(\XYi){ni}
\qline(origin)(ni)
\def\thetaii{220.0 }
\def\XYii{! \thetaii cos \r mul \thetaii sin \r mul }
\pnode(\XYii){nii}
\qline(origin)(nii)
\def\thetaiii{285.0 }
\def\XYiii{! \thetaiii cos \r mul \thetaiii sin \r mul }
\pnode(\XYiii){niii}
\qline(origin)(niii)
\psline(ni)(nii)(niii)(ni)
\def\bet{ 180.0 \thetai add }
\def\alph{ \thetai\space \thetaii\space add }
\edef\gam{ \bet\space \alph\space sub }
\psarc[linestyle=dotted](ni){2.0}{0}{!\alph}
\psarc[linestyle=dotted](ni){1.5}{0}{!\bet}
\psarc[linestyle=dotted](ni){1.5}{0}{!\gam}
\end{pspicture}
\end{document}
答案2
我喜欢重构。
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node}
\pstVerb
{
/radius 4 def
/thetai 80 def
/thetaii 220 def
/thetaiii 285 def
/alpha {thetai thetaii add} def
/beta {180 thetai add} def
/gamma {beta alpha sub} def
}
\begin{document}
\begin{pspicture}(-5,-5)(5,6)
\pnodes
(0,0){origin}
(!radius thetai PtoC){ni}
(!radius thetaii PtoC){nii}
(!radius thetaiii PtoC){niii}
\pscircle(origin){!radius}
\qline(origin)(ni)
\qline(origin)(nii)
\qline(origin)(niii)
\pspolygon(ni)(nii)(niii)
\psarc[linestyle=dotted](ni){2.0}{0}{!alpha}
\psarc[linestyle=dotted](ni){1.5}{0}{!beta}
\psarc[linestyle=dotted](ni){1.5}{0}{!gamma}
\end{pspicture}
\end{document}