[pstricks] New macro addtopsstyle

Boris Veytsman borisv at lk.net
Fri Sep 7 17:28:07 CEST 2007


CB> Date: Fri, 07 Sep 2007 16:51:32 +0200
CB> From: Christoph Bersch <christoph at bersch.net>


CB> The following code seems to work, but it uses the LaTeX macro 
CB> \g at addto@macro. As I plan to include this into a PSTricks package, the 
CB> question is, if I should rewrite it in plain TeX (don't know how), or if 
CB> use of a LaTeX macro is ok.

pstricks.tex has the following code:

-------------------------------------------------------------------
\expandafter\ifx\csname @latexerr\endcsname\relax
\long\def\@ifundefined#1#2#3{\expandafter\ifx\csname
  #1\endcsname\relax#2\else#3\fi}
\def\@namedef#1{\expandafter\def\csname #1\endcsname}
\def\@nameuse#1{\csname #1\endcsname}
\def\@eha{%
  Your command was ignored.^^J
  Type \space I <command> <return> \space to replace
  it with another command,^^J
  or \space <return> \space to continue without it.}
\def\@spaces{\space\space\space\space}
\def\typeout#1{\immediate\write\@unused{#1}}
\alloc at 7\write\chardef\sixt@@n\@unused
\def\@empty{}
\def\@gobble#1{}
\def\@nnil{\@nil}
\def\@ifnextchar#1#2#3{%
\let\@tempe#1\def\@tempa{#2}\def\@tempb{#3}\futurelet\@tempc\@ifnch}
\def\@ifnch{%
  \ifx\@tempc\@sptoken
    \let\@tempd\@xifnch
  \else
    \ifx\@tempc\@tempe \let\@tempd\@tempa \else \let\@tempd\@tempb \fi
  \fi
  \@tempd}
\begingroup
\def\:{\global\let\@sptoken= } \:
\def\:{\@xifnch} \expandafter\gdef\: {\futurelet\@tempc\@ifnch}
\endgroup
\fi
----------------------------------------------------------------

Basically it means that if latex is NOT loaded, pstricks defines some
LaTeX macros itself.  You can use these macros.

\g at addto@macro is not in the list, but you can easily add it in the
same way: 

\expandafter\ifx\csname @latexerr\endcsname\relax
\toksdef\toks@=0
\long\def\g at addto@macro#1#2{%
  \begingroup
    \toks@\expandafter{#1#2}%
    \xdef#1{\the\toks@}%
  \endgroup}
\fi

-- 
Good luck

-Boris

"Pull the trigger and you're garbage."
		-- Lady Blue



More information about the PSTricks mailing list