The following code snippet does not work.
\documentclass{article}
\usepackage{pstricks}
\newcommand\Left{-1}
\newcommand\Right{1}
\newcommand\Bottom{-1}
\newcommand\Top{1}
\newenvironment{\PsPicture}[1][]
{\begin{pspicture}[#1](\Left,\Bottom)(\Right,\Top)\ignorespaces}
{\end{pspicture}}
\newcommand\GetCoordinates{(\Left,\Bottom)(\Right,\Top)}
\begin{document}
\begin{PsPicture}[showgrid]
\end{PsPicture}
\newpage
\begin{pspicture}[showgrid]\GetCoordinates
\end{pspicture}
\end{document}
The code above is a simplified scenario that was extracted from my own document class. The idea is to avoid calling (\Left,\Bottom)(\Right,\Top)
such as in
\pspicture(\Left,\Bottom)(\Right,\Top)
- or
\psframe(\Left,\Bottom)(\Right,\Top)
My first attempt is creating a new environment to encapsulate \pspicture
, it does not work.
The second attempt is creating a new command to return (\Left,\Bottom)(\Right,\Top)
so hopefully it can be passed to any PSTricks macros that need (\Left,\Bottom)(\Right,\Top)
, it does not work as well.
How to fix it?
To make it clearer, I add the following code snippet
\begin{PsPicture}[showgrid]
\psframe\GetCoordinates
\end{PsPicture}
that takes advantage of \GetCoordinates
so I can save some keystrokes rather than typing (\Left,\Bottom)(\Right,\Top)
that is very tedious.