[texhax] newcommand with pstricks

Herbert Voss Herbert.Voss at FU-Berlin.DE
Thu Jun 3 10:02:30 CEST 2010


Am 03.06.2010 00:13, schrieb Germain BOYER:

> Look at this newcommand
> %
> \newcommand{\vect}[1]{\ensuremath{\overrightarrow{#1}}}
> % 
> \newlength{\PSSCALyunit} 
> % 
> \newcommand{\scal}[1]{ 
> \setlength{\PSSCALyunit}{\psyunit} 
> \psset{yunit=1mm , dotsize=0.75mm 0} 
> \hspace*{1.5mm} \psdot(0,0.75) \hspace*{1.5mm} 
> \psset{yunit=\PSSCALyunit} 
> }
> %
> exemple \vect{AB} \scal \vect{AC}
> %
> 
> question : is it possible to write lines like \newlength{\PSSCALyunit} \setlength{\PSSCALyunit}{\psyunit} \psset{yunit=\PSSCALyunit} 
> to save and restore the default value of dotsize and tbarsize ?

\newcommand\scal[1]{{%
  \psset{unit=1cm}
  ...
}}

holds the setting local and there is no need to save and restore the
current unit. Alternatively use \psdot[yunit=...,xunit=...](0,0.75)
which is also a local setting.

Herbert


More information about the texhax mailing list