设想

设想

设想

我想要创建一个新的 PSTricks 对象,例如,\myBatLogo[<key-val options>]{}{}...{}这不是内置 PSTricks 对象的重新定义。

这意味着在我的场景中任何如下的重新定义都没有意义。

\newpsobject{myBatLogo}{<built-in PSTrick object>}

问题

如何定义一个新的 PSTrick 对象,而不是对内置 PSTricks 对象的重新定义?它必须接受键值可选参数和强制参数。

答案1

\documentclass{article}
\usepackage{pstricks}
\makeatletter
\def\psBatman{\pst@object{psBatman}}
\def\psBatman@i(#1)#2{%
  \begin@ClosedObj%
  \rput(#1){\psframebox{#2}}
  \end@ClosedObj%
}
\makeatother

\begin{document}
\pspicture(7,7)
\psBatman(1,1){Batman}
\psBatman[fillcolor=red!50,shadow=true,framesep=20pt,framearc=0.3](3,4){\Huge Me}
\psBatman*[linecolor=blue!20,framesep=20pt](6,6){\huge you}
\endpspicture
\end{document}

替代文本

相关内容