[pstricks] correct display (circuits and optic)

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Mon May 19 15:00:23 CEST 2003


Patrick Drechsler schrieb:
> 
> --> more a zigzag line instead of a coil.

understood. Same is possible without pst-coil, if you
define your own zigzag (see docs)

Herbert

\documentclass{article}
\usepackage{pst-circ}
\usepackage{pst-coil}
%
\makeatletter
\newif\ifPst at circ@variable
\define at key{psset}{variable}[false]{\@nameuse{Pst at circ@variable#1}}
\newif\ifPst at circ@zigzag
\define at key{psset}{zigzag}[false]{\@nameuse{Pst at circ@zigzag#1}}
\psset{zigzag=false}
%
\let\pst at draw@resistorOld\pst at draw@resistor
\def\pst at draw@resistor{%
    \ifPst at circ@zigzag%
        \pnode(-1,0){dipole at 1}
        \pnode(1,0){dipole at 2}
	\pszigzag[coilarm=0.1,coilwidth=0.1,coilwidth=0.5](-1,0)(1,0)
    \else
       \pst at draw@resistorOld
    \fi
    \ifPst at circ@variable%
      \psline{->}(-0.5,-0.55)(0.5,0.55)%
    \fi
}
\makeatother
%
\begin {document}
\begin{pspicture}(-2,-1)(2,1)
    \psgrid[subgriddiv=0, griddots=5]
    \pnode(-2,0){A}
    \pnode(2,0){B}
    \resistor[variable=true,zigzag=true](A)(B){$R$}
\end{pspicture}
\end{document}




More information about the PSTricks mailing list