[pstricks] psset and absolute lengths

Herbert Voss Jana.Voss at t-online.de
Wed Apr 9 16:47:17 CEST 2003


Richard Hensh schrieb:
> I'm trying to define my own tick marks. I've successfully created macros
> to do the job but I have a problem when I scale (using \psset).

maybe this helps

Herbert

\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-key}
\usepackage{multido}
\makeatletter
\define at key{psset}{ticklength}{%
         \edef\psk at ticklength{#1}%
}
\psset{ticklength=0.5}
\def\xTick(#1){%
	\SpecialCoor
	\pst at getcoor{#1}\pst at tempa
	\psline(!%
  		\pst at tempa exch \pst at number\psxunit div
		exch \pst at number\psxunit div \psk at ticklength\space sub)(!%
  		\pst at tempa exch \pst at number\psyunit div
		exch \pst at number\psxunit div \psk at ticklength\space add)
	\NormalCoor
}
\makeatother
\begin{document}
\psset{unit=1cm}
\begin{pspicture}(5,5)
	\psline(0,2)(5,2)
	\psset{linecolor=red,ticklength=1}
	\multido{\no=0+1}{6}{\xTick(\no,2)}
	\psset{linecolor=blue,ticklength=0.5}
	\multido{\no=0+1}{6}{\xTick(\no,2)}
\end{pspicture}
\end{document}



More information about the PSTricks mailing list