[OS X TeX] creating a ps object
Herbert Voss
Herbert.Voss at fu-berlin.de
Thu Jun 12 05:34:02 EDT 2025
Am 11.06.25 um 22:00 schrieb Nitecki, Zbigniew H.:
> I want to tile a large rectangular area with tiles. All the tiles are
> (congruent) squares filled with a specific color and with some curves
> drawn on them. They come in more than one variety, but there are
> enough of each variety that
> I want to create “tile” templates (for thesevarieties, with color and
> the specific curve defined by parameters)
> and use multirput to do the tiling.
>
> I’m looking for a way to define a graphical object which is
> self-contained, perhaps with a few parameters that
> need to be filled in, which can then be treated like other
> system-defined objects (e.g. pscircles, pslines)—specifically which
> can be rput anywhere in a larger picture, with some internal
> coordinates which get treated
> as relative coordinates. I thought \newpsobject could work, but that
> is only for adding bells and whistles to
> already defined objects.
>
> Any suggestons?
Here comes a starter ...
Herbert
\documentclass{article}
\usepackage{pstricks,pst-plot}
\makeatletter
\def\foo{\@ifnextchar[\foo at i{\foo at i[]}}
\def\foo at i[#1]#2#3#4{%
\begingroup
\if$#1$\else\psset{#1}\fi
\psframebox{%
\begin{pspicture}(-2.25,-2.5)(2.25,2.5)
\rput(0,2.25){\textbf{#2}}
\rput(0,0){%
\begin{pspicture*}(-2,-2)(2,2)
\psgrid(0,0)(-2,-2)(2,2)
#3
\end{pspicture*}}%
\rput(0,-2.25){#4}
\end{pspicture}}
\endgroup
}
\begin{document}
\foo{Demo 1}%
{\psplot[linewidth=1.5pt,algebraic]{-1.5}{1.5}{x^2}}%
{A quadratic function}
\foo{Demo 2}%
{\psplot[linewidth=1.25pt,linecolor=red,algebraic]{-1.5}{1.5}{x^3}}%
{A cubicic function}
\foo[unit=1.5]{Demo 3}%
{\psline[linewidth=2pt,linestyle=dashed](-2,-2)(2,2)}%
{A dashed line}
\end{document}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto 2025-06-12 um 11.32.34.png
Type: image/png
Size: 69180 bytes
Desc: not available
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20250612/ecc5d194/attachment.png>
More information about the MacOSX-TeX
mailing list