diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pst-circ/pst-circ-doc.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-circ/pst-circ-doc.tex | 89 |
1 files changed, 39 insertions, 50 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-circ/pst-circ-doc.tex b/Master/texmf-dist/doc/generic/pst-circ/pst-circ-doc.tex index c8ec4aa4448..da0d6b4cb95 100644 --- a/Master/texmf-dist/doc/generic/pst-circ/pst-circ-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-circ/pst-circ-doc.tex @@ -1,4 +1,4 @@ -%% $Id: pst-circ-doc.tex 292 2010-02-13 19:55:55Z herbert $ +%% $Id: pst-circ-doc.tex 370 2010-08-15 08:30:39Z herbert $ \documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings headexclude,footexclude,oneside]{pst-doc} \usepackage[utf8]{inputenc} @@ -98,6 +98,7 @@ of having older versions, go to \url{http://www.CTAN.org/} and load the newest v \begingroup\setlength\emergencystretch{3em} Thanks to: \\ \mbox{Rafal Bartczuk}, +\mbox{Christoph Bersch}, \mbox{Fran\c{c}ois Boone}, \mbox{Jean-C\^ome Charpentier}, \mbox{Patrick Drechsler}, @@ -2794,60 +2795,30 @@ all is finished. \end{LTXexample} - \section{Adding new components} -Adding new components is not simple. As a matter of fact, because of the complex -mechanism of \Lcs{multidipole}, there are multiple steps. Nevertheless, it can take some time\ldots - -If you want to modify the code, you need to know the following -things. For a dipole, you first -need to define the following items: +Adding new components is not simple unless you need only a simple dipole. For dipoles a macro is provided that generates all helping macros for a new component so that you need to write only the actual drawing code. +If you want to add a new dipole component, you only need the following code: \begin{lstlisting}[language=TeX] - \def\component_name{\@ifnextchar[{\pst@component_name}{\pst@component_name[]}} - % - \def\pst@component/_name[#1](#2)(#3)#4{{% - \pst@draw@dipole{#1}{#2}{#3}{#4}\pst@draw@component_name - }\ignorespaces} - % - \def\pst@multidipole@component_name{\@ifnextchar[{\pst@multidipole@component_name@}% - {\pst@multidipole@component_name@[]}} - % - \def\pst@multidipole@component_name@[#1]#2{% - \expandafter\def\csname pst@circ@tmp@\number\pst@circ@count@iii\endcsname{#2}% - {\psset{#1}% - \ifPst@circ@parallel\aftergroup\advance\aftergroup\pst@circ@count@i\aftergroup\m@ne\fi}% - \pst@circ@count@ii=\pst@circ@count@i% - \advance\pst@circ@count@ii\@ne% - \toks0\expandafter{\pst@multidipole@output}% - \edef\pst@multidipole@output{% - \the\toks0% - \pst@multidipole@def@coor% - \noexpand\component_name[#1]% - (! X@\the\pst@circ@count@i\space Y@\the\pst@circ@count@i)% - (! X@\the\pst@circ@count@ii\space Y@\the\pst@circ@count@ii)% - {\noexpand\csname pst@circ@tmp@\number\pst@circ@count@iii\endcsname}% - }% - \pst@multidipole@ - } - % - \def\pst@draw@component_name{% + \newCircDipole{ComponentName}% + \def\pst@draw@ComponentName{% % The PSTricks code for your component % The center of the component is at (0,0) \pnode(component_left_end,0){dipole@1} \pnode(component_right_end,0){dipole@2}} \end{lstlisting} +This code can be placed in the core code or somewhere in the respective document in which case it must be surrounded by \lstinline[language=TeX]{\makeatletter...\makeatother}. -Then, you have to make some changes in the \Lcs{multidipole} core code\dots In the definition +If your new dipole should also work with \Lcs{multidipole} then you have to make some changes in the \Lcs{multidipole} core code. In the definition of \Lcs{pst@multidipole}, look for the last \Lcs{ifx} test \begin{lstlisting}[language=TeX] % ... % Extract from \pst@multidipole - \else\ifx\circledipole#4\let\next\pst@multidipole@circledipole - \else\ifx\LED #4\let\next\pst@multidipole@LED + \else\ifx\OpenDipol #4\let\pscirc@next\pst@multidipole@OpenDipol% 27 + \else\ifx\OpenTripol #4\let\pscirc@next\pst@multidipole@OpenTripol% 28 \else % Put your modification here - \let\next\ignorespaces + \else\let\pscirc@next\ignorespaces \fi\fi\fi % Extract form \pst@multidipole % ... @@ -2856,11 +2827,11 @@ and add (marked with \verb+%%%+) \begin{lstlisting}[language=TeX] % ... % Extract from \pst@multidipole - \else\ifx\circledipole #4\let\next\pst@multidipole@circledipole - \else\ifx\LED #4\let\next\pst@multidipole@LED - \else\ifx\component_name#4\let\next\pst@multidipole@component_name%%% - \else\let\next\ignorespaces - \fi\fi\fi\fi + \else\ifx\OpenDipol #4\let\pscirc@next\pst@multidipole@OpenDipol% 27 + \else\ifx\OpenTripol #4\let\pscirc@next\pst@multidipole@OpenTripol% 28 + \else\ifx\ComponentName#4\let\next\pst@multidipole@ComponentName%%% + \else\let\pscirc@next\ignorespaces + \fi\fi\fi % Extract form \pst@multidipole % ... \end{lstlisting} @@ -2868,17 +2839,35 @@ Do the same in \verb+\pst@multidipole@+ \begin{lstlisting}[language=TeX] % ... % Extract from \pst@multidipole@ - \else\ifx\circledipole#1\let\next\pst@multidipole@circledipole - \else\ifx\LED #1\let\next\pst@multidipole@LED - \else\ifx\component_name#1\let\next\pst@multidipole@component_name%%% - \else\let\next\ignorespaces\pst@multidipole@output - \fi\fi\fi\fi + \else\ifx\OpenDipol#1\let\pscirc@next\pst@multidipole@OpenDipol% 27 + \else\ifx\OpenTripol#1\let\pscirc@next\pst@multidipole@OpenTripol% 28 + \else\ifx\ComponentName#1\let\next\pst@multidipole@ComponentName%%% + \else\let\pscirc@next\ignorespaces\pst@multidipole@output + \fi\fi\fi % Extract form \pst@multidipole@ % ... \end{lstlisting} and that's it! All you have to do then is send your modified \LFile{pst-circ.tex} to me and it will become part of the official release of \LPack{pst-circ}. +\bigskip +\begin{LTXexample}[width=3.5cm] + \begin{pspicture}(3,2) + \newCircDipole{delayline} + \makeatletter + \def\pst@draw@delayline{% + \psset{linewidth=1.5\pslinewidth}% + \psframe(-0.5,-0.3)(0.5,0.3) + \psline[arrows=->](-0.2,-0.5)(0.2,0.5) + \pnode(-0.5,0){dipole@1} + \pnode(0.5,0){dipole@2}}% + \makeatother + \pnode(0,1){A}\pnode(3,1){B} + \delayline(A)(B){delay} + \end{pspicture} +\end{LTXexample} + + \clearpage |