The pst-circ2 package

capacitor. SetAutoLabelIndex capacitor. ResetAutoLabelIndex capacitor. ShowAutoLabel capacitor. ShowIntensity capacitor. ShowVoltage capacitor. AutoLabel.
196KB taille 6 téléchargements 272 vues
The pst-circ2 package Christophe Jorssen http:// Abstract This package is a totally rewritten version of the pst-circ package and offers more flexible macros for defining and setting keys or dipoles.

Contents 1 Introduction

2

2 Base Dipole Library

2

3 Base Multipole Library

4

4.2.3 4.2.4

Voltage . . . . . . . . . Polarization . . . . . . .

5 Parallel and multiple dipoles 4 Parameters 4.1 List of all key=val parameters 4.2 Examples of parameter use . . 4.2.1 Labels . . . . . . . . . . 4.2.2 Intensity . . . . . . . . .

11 12 12

6 Implementation 13 6.1 pst-circ2.tex . . . . . . . . . 13 6.2 pst-circ2.sty . . . . . . . . . 29 6.3 pst-circ2.lib . . . . . . . . . 30

6 6 10 10 11

Acknowledgements

1

35

2

1

BASE DIPOLE LIBRARY

Introduction

To write this new package, I nearly started from scratch. I decided to keep nothing but the drawing of the components. Consequently, a lot of changes appear. Due to all these changes, it was not possible to make pst-circ2 compatible with pst-circ. pst-circ2 heavily relies on recent packages such as xkeyval [?], pstricks-add [?] and pst-eucl [?]. So it is very important to upgrade your distribution before using pst-circ2 to get up-to-date versions of these packages.

2

Base Dipole Library E1 \battery[Style=default](A)(B)

C1 \capacitor[Style=default](A)(B)

C2 \capacitor[Style=chemical](A)(B)

C3 \capacitor[Style=elektorchemical](A)(B)

C4 \capacitor[Style=elektor](A)(B)

L1 \coil[Style=default](A)(B)

L2 \coil[Style=curved](A)(B)

L3 \coil[Style=elektor](A)(B)

L4 \coil[Style=elektorcurved](A)(B)

2

2

BASE DIPOLE LIBRARY

L5 \coil[Style=rectangle](A)(B)

D1 \diode[Style=default](A)(B)

D2 \diode[Style=triac](A)(B)

D3 \diode[Style=thyristor](A)(B)

D4 \diode[Style=GTO](A)(B)

η1 \Icc[Style=default](A)(B)

L1 \lamp[Style=default](A)(B)

D1 \LED[Style=default](A)(B)

D1 \photodiode[Style=default](A)(B)

R1 \photoresistor[Style=default](A)(B)

R1 \resistor[Style=default](A)(B)

R2 \resistor[Style=zigzag](A)(B)

3

3

BASE MULTIPOLE LIBRARY

K1 \switchOn[Style=default](A)(B)

K1 \switchOff[Style=default](A)(B)

E1 +



\Ucc[Style=default](A)(B)

E2 \Ucc[Style=arrow](A)(B)

3

Base Multipole Library

\GenericTripoleA[Style=default](0,0)

\GenericTripoleB[Style=default](0,0)

\GenericQuadrupole[Style=default](0,0)

\transformer[Style=default](0,0)

4

3

+ −

\OpAmp[Style=default](0,0)









BASE MULTIPOLE LIBRARY



\OpAmp[Style=french-+](0,0)

+

+

\OpAmp[Style=french+-](0,0)



\transistor[Style=default](0,0)

\transistor[Style=NPNCircled](0,0)

\transistor[Style=PNP](0,0)

\transistor[Style=PNPCircled](0,0)

\phototransistor[Style=default](0,0)

5

4

PARAMETERS

\phototransistor[Style=NPNCircled](0,0)

\phototransistor[Style=NPNCircledNoBase](0,0)

\phototransistor[Style=NPNNoBase](0,0)

4 4.1

Parameters List of all key=val parameters

Key Polarization AutoLabel LabelOffset SetAutoLabelIndex VoltageOffset ResetAutoLabelIndex ShowAutoLabel ShowIntensity ShowVoltage IntensityArrowColor IntensityLabel Label LabelRot Style VoltageArrowColor VoltageLabel Intensity Voltage InterA InterB wire.ShowIntensity Intersec Rot battery.SetAutoLabelIndex battery.ResetAutoLabelIndex battery.ShowAutoLabel battery.ShowIntensity battery.ShowVoltage

Type Default choice [none] ordinary ordinary ordinary ordinary ordinary true ordinary true ordinary true ordinary true command command command command command command command choice [none] choice [none] command command boolean true boolean true command ordinary ordinary boolean true boolean true boolean true Continued on next page 6

4.1 List of all key=val parameters

Continued from previous page Key battery.AutoLabel battery.LabelOffset battery.VoltageOffset battery.Polarization capacitor.SetAutoLabelIndex capacitor.ResetAutoLabelIndex capacitor.ShowAutoLabel capacitor.ShowIntensity capacitor.ShowVoltage capacitor.AutoLabel capacitor.LabelOffset capacitor.VoltageOffset capacitor.Polarization coil.SetAutoLabelIndex coil.ResetAutoLabelIndex coil.ShowAutoLabel coil.ShowIntensity coil.ShowVoltage coil.AutoLabel coil.LabelOffset coil.VoltageOffset diode.SetAutoLabelIndex diode.ResetAutoLabelIndex diode.ShowAutoLabel diode.ShowIntensity diode.ShowVoltage diode.AutoLabel diode.LabelOffset diode.VoltageOffset diode.Polarization Icc.SetAutoLabelIndex Icc.ResetAutoLabelIndex Icc.ShowAutoLabel Icc.ShowIntensity Icc.ShowVoltage Icc.AutoLabel Icc.LabelOffset Icc.VoltageOffset Icc.Polarization lamp.SetAutoLabelIndex lamp.ResetAutoLabelIndex lamp.ShowAutoLabel lamp.ShowIntensity lamp.ShowVoltage lamp.AutoLabel lamp.LabelOffset lamp.VoltageOffset LED.SetAutoLabelIndex LED.ResetAutoLabelIndex LED.ShowAutoLabel LED.ShowIntensity LED.ShowVoltage LED.AutoLabel LED.LabelOffset LED.VoltageOffset

4

Type Default command command command choice [none] ordinary ordinary boolean true boolean true boolean true command command command choice [none] ordinary ordinary boolean true boolean true boolean true command command command ordinary ordinary boolean true boolean true boolean true command command command choice [none] ordinary ordinary boolean true boolean true boolean true command command command choice [none] ordinary ordinary boolean true boolean true boolean true command command command ordinary ordinary boolean true boolean true boolean true command command command Continued on next page 7

PARAMETERS

4.1 List of all key=val parameters

4

Continued from previous page Key Type Default photodiode.SetAutoLabelIndex ordinary photodiode.ResetAutoLabelIndex ordinary photodiode.ShowAutoLabel boolean true photodiode.ShowIntensity boolean true photodiode.ShowVoltage boolean true photodiode.AutoLabel command photodiode.LabelOffset command photodiode.VoltageOffset command photoresistor.SetAutoLabelIndex ordinary photoresistor.ResetAutoLabelIndex ordinary photoresistor.ShowAutoLabel boolean true photoresistor.ShowIntensity boolean true photoresistor.ShowVoltage boolean true photoresistor.AutoLabel command photoresistor.LabelOffset command photoresistor.VoltageOffset command resistor.SetAutoLabelIndex ordinary resistor.ResetAutoLabelIndex ordinary resistor.ShowAutoLabel boolean true resistor.ShowIntensity boolean true resistor.ShowVoltage boolean true resistor.AutoLabel command resistor.LabelOffset command resistor.VoltageOffset command switchOn.SetAutoLabelIndex ordinary switchOn.ResetAutoLabelIndex ordinary switchOn.ShowAutoLabel boolean true switchOn.ShowIntensity boolean true switchOn.ShowVoltage boolean true switchOn.AutoLabel command switchOn.LabelOffset command switchOn.VoltageOffset command switchOff.SetAutoLabelIndex ordinary switchOff.ResetAutoLabelIndex ordinary switchOff.ShowAutoLabel boolean true switchOff.ShowIntensity boolean true switchOff.ShowVoltage boolean true switchOff.AutoLabel command switchOff.LabelOffset command switchOff.VoltageOffset command Ucc.SetAutoLabelIndex ordinary Ucc.ResetAutoLabelIndex ordinary Ucc.ShowAutoLabel boolean true Ucc.ShowIntensity boolean true Ucc.ShowVoltage boolean true Ucc.AutoLabel command Ucc.LabelOffset command Ucc.VoltageOffset command Ucc.Polarization choice [none] GenericTripoleA.AutoWire boolean true GenericTripoleA.ShowPolesLabel boolean true GenericTripoleA.ShowP1Label boolean true GenericTripoleA.ShowP2Label boolean true GenericTripoleA.ShowP3Label boolean true GenericTripoleA.P1Label command Continued on next page 8

PARAMETERS

4.1 List of all key=val parameters

4

Continued from previous page Key Type Default GenericTripoleA.P2Label command GenericTripoleA.P3Label command GenericTripoleA.Name command GenericTripoleA.Label command GenericTripoleB.AutoWire boolean true GenericTripoleB.ShowPolesLabel boolean true GenericTripoleB.ShowP1Label boolean true GenericTripoleB.ShowP2Label boolean true GenericTripoleB.ShowP3Label boolean true GenericTripoleB.P1Label command GenericTripoleB.P2Label command GenericTripoleB.P3Label command GenericTripoleB.Name command GenericTripoleB.Label command GenericQuadrupole.AutoWire boolean true GenericQuadrupole.ShowPolesLabel boolean true GenericQuadrupole.ShowP1Label boolean true GenericQuadrupole.ShowP2Label boolean true GenericQuadrupole.ShowP3Label boolean true GenericQuadrupole.ShowP4Label boolean true GenericQuadrupole.P1Label command GenericQuadrupole.P2Label command GenericQuadrupole.P3Label command GenericQuadrupole.P4Label command GenericQuadrupole.Name command GenericQuadrupole.Label command transformer.AutoWire boolean true transformer.ShowPolesLabel boolean true transformer.ShowP1Label boolean true transformer.ShowP2Label boolean true transformer.ShowP3Label boolean true transformer.ShowP4Label boolean true transformer.P1Label command transformer.P2Label command transformer.P3Label command transformer.P4Label command transformer.Name command transformer.Label command OpAmp.AutoWire boolean true OpAmp.ShowPolesLabel boolean true OpAmp.ShowP1Label boolean true OpAmp.ShowP2Label boolean true OpAmp.ShowP3Label boolean true OpAmp.P1Label command OpAmp.P2Label command OpAmp.P3Label command OpAmp.Name command OpAmp.Label command transistor.AutoWire boolean true transistor.ShowPolesLabel boolean true transistor.ShowP1Label boolean true transistor.ShowP2Label boolean true transistor.ShowP3Label boolean true transistor.P1Label command transistor.P2Label command Continued on next page 9

PARAMETERS

4.2 Examples of parameter use

4

Continued from previous page Key transistor.P3Label transistor.Name transistor.Label phototransistor.AutoWire phototransistor.ShowPolesLabel phototransistor.ShowP1Label phototransistor.ShowP2Label phototransistor.ShowP3Label phototransistor.P1Label phototransistor.P2Label phototransistor.P3Label phototransistor.Name phototransistor.Label HArmPara HArmAPara HArmBPara VArmPara

4.2 4.2.1

Type command command command boolean boolean boolean boolean boolean command command command command command ordinary ordinary ordinary ordinary

PARAMETERS

Default

true true true true true

[none] [none] [none] [none]

Examples of parameter use Labels r22

r1

R1

ρ

R2

3

R2

\begin{pspicture}(4,4) \resistor[ ResetAutoLabelIndex](0,0)(0,3) \resistor(0,0)(4,0) \psset{ resistor.AutoLabel=r, resistor.ResetAutoLabelIndex} \resistor(4,0)(4,3) \resistor[ SetAutoLabelIndex=22](0,3)(4,3) \resistor[ ShowAutoLabel=false, Label =$\rho$](0,0)(4,3) \end{pspicture}

\begin{pspicture}(4,4) \resistor[ LabelOffset=0](0,0)(4,3) \end{pspicture}

Note that the AutoLabelIndex is not reset from a pspicture to an other. If you want this behaviour, you can use the \PSTCpicture / \endPSTCpicture (for TEX users) or the \begin{PSTCpicture} / \end{PSTCpicture} (for LATEX users) combination. This environment works exactly as the pspicture one.

R1

\begin{PSTCpicture}(4,4) \resistor(0,0)(4,3) \end{PSTCpicture}

10

4.2 Examples of parameter use

4.2.2

4

PARAMETERS

Intensity R6 R5 R4

i

R3

i

R2

i

i

\begin{PSTCpicture}(0,-.5)(4,5.5) \psset[pst-circ2]{resistor.LabelOffset=0} \resistor[ ShowIntensity](0,0)(4,0) \resistor[ Intensity=>D](0,1)(4,1) \resistor[Intensity=](0,3)(4,3) \resistor[Intensity=DD. \csname ifPSTCb@#1.ShowIntensity\endcsname \ifnum\PSTC@IntensityLabelPos=\m@ne \psset[pst-circ2]{Intensity=>D}% \fi \fi

133 134 135 136 137

\PSTC@DipoleWire is defined by the key Intensity. \PSTC@DipoleWire% \csname ifPSTCb@#1.ShowIntensity\endcsname \ifnum\PSTC@IntensityLabelPos=\z@ \pcline[linestyle=none](PSTC@D1@)(PSTC@D1) \else \pcline[linestyle=none](PSTC@D2)(PSTC@D2@) \fi \naput[nrot=\PSTCk@LabelRot]{\PSTCk@IntensityLabel} \fi

138 139 140 141 142 143 144 145 146 147

}

148

\def\PSTC@setVoltage#1{% \csname ifPSTCb@#1.ShowVoltage\endcsname \ifx\PSTCk@Voltage\@empty \psset[pst-circ2]{Voltage=D,,D](PSTC@D1@)(PSTC@D1) \psline(PSTC@D2)(PSTC@D2@)}% \def\PSTC@IntensityLabelPos{\z@}% \or \def\PSTC@DipoleWire{% \psline[ArrowInside=-](PSTC@D2)(PSTC@D2@)}% \def\PSTC@IntensityLabelPos{\@ne}% \or \def\PSTC@DipoleWire{% \psline(PSTC@D1@)(PSTC@D1) \psline[ArrowInside=-,](0.25,-0.22)} \PSTCDNode(-0.5,0){+} \PSTCDNode(0.5,0){-} } \DeclareNewDipole[AutoLabel=R]{resistor}{% \psframe[linewidth=1.5\pslinewidth](-0.5,-0.25)(0.5,0.25) \PSTCDNode(-0.5,0){+} \PSTCDNode(0.5,0){-} } \DeclareNewDipole[Style=zigzag]{resistor}{% \multips(-0.75,0)(0.5,0){3}% {\psline[linewidth=1.5\pslinewidth](0,0)(0.125,0.25)(0.375,-0.25)(0.5,0)}% \PSTCDNode(-0.75,0){+} \PSTCDNode(0.75,0){-} } \DeclareNewDipole[AutoLabel=K]{switchOn}{% \qdisk(-0.5,0){1.5pt} \qdisk(0.5,0){1.5pt} \psline[arrows=-,linewidth=2\pslinewidth](-0.5,0.05)(0.5,0.05) \PSTCDNode(-0.5,0){+} \PSTCDNode(0.5,0){-} } \DeclareNewDipole[AutoLabel=K]{switchOff}{% \psline[arrows=-,linewidth=2\pslinewidth](-0.5,0)(0.5,0.5) \psarcn[arrowinset=0]{->}(-0.5,0){0.75}{45}{-45} \pscircle[fillstyle=solid](-0.5,0){0.07} \qdisk(0.5,0){1.5pt} \PSTCDNode(-0.55,0){+} \PSTCDNode(0.5,0){-} } \DeclareNewDipole[AutoLabel=E,Polarized]{Ucc}{% \psline(-0.5,0)(0.5,0) \pscircle[linewidth=1.5\pslinewidth](0,0){0.5} \uput[135](-0.5,0){$+$} \uput[45](0.5,0){$-$} \PSTCDNode(-0.5,0){+} \PSTCDNode(0.5,0){-} } \DeclareNewDipole[AutoLabel=E,Polarized,Style=arrow]{Ucc}{% \psline[linewidth=2\pslinewidth]{,ArrowInsidePos=.75](.5;105|0,-.15)(.5;-60) \psline(.5;105|0,.15)(.5;60) \PSTCMPNode(-.5,0){B} \PSTCMPNode(.5;-60){E}

33

6.3 pst-circ2.lib

1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228

6 IMPLEMENTATION

\PSTCMPNode(.5;60){C}} \DeclareNewMultipole[Style=NPNCircled]{transistor}{% \pscircle(0,0){0.5} \psline[linewidth=1.5\pslinewidth](.5;105)(.5;-105) \psline(-.5,0)(.5;105|0,0) \psline[ArrowInside=->,ArrowInsidePos=.75](.5;105|0,-.15)(.5;-60) \psline(.5;105|0,.15)(.5;60) \PSTCMPNode(-.5,0){B} \PSTCMPNode(.5;-60){E} \PSTCMPNode(.5;60){C}} \DeclareNewMultipole[Style=PNP]{transistor}{% \psline[linewidth=1.5\pslinewidth](.5;105)(.5;-105) \psline(-.5,0)(.5;105|0,0) \psline(.5;105|0,-.15)(.5;-60) \psline[ArrowInside=-}(0.22,-0.25)} \PSTCMPNode(-.5,0){B} \PSTCMPNode(.5;-60){E} \PSTCMPNode(.5;60){C}} \DeclareNewMultipole[Style=NPNCircled]{phototransistor}{% \pscircle(0,0){0.5} \psline[linewidth=1.5\pslinewidth](.5;105)(.5;-105) \psline(-.5,0)(.5;105|0,0) \psline[ArrowInside=->,ArrowInsidePos=.75](.5;105|0,-.15)(.5;-60) \psline(.5;105|0,.15)(.5;60) \multips(-0.65,0.65)(0.2,.075){2}{\psline{->}(0.22,-0.25)} \PSTCMPNode(-.5,0){B} \PSTCMPNode(.5;-60){E} \PSTCMPNode(.5;60){C}} \DeclareNewMultipole[Style=NPNCircledNoBase]{phototransistor}{% \pscircle(0,0){0.5} \psline[linewidth=1.5\pslinewidth](.5;105)(.5;-105) \psline[ArrowInside=->,ArrowInsidePos=.75](.5;105|0,-.15)(.5;-60) \psline(.5;105|0,.15)(.5;60) \multips(-0.65,0.65)(0.2,.075){2}{\psline{->}(0.22,-0.25)} \PSTCMPNode(.5;-60){E} \PSTCMPNode(.5;60){C}} \DeclareNewMultipole[Style=NPNNoBase]{phototransistor}{% \psline[linewidth=1.5\pslinewidth](.5;105)(.5;-105) \psline[ArrowInside=->,ArrowInsidePos=.75](.5;105|0,-.15)(.5;-60) \psline(.5;105|0,.15)(.5;60) \multips(-0.65,0.65)(0.2,.075){2}{\psline{->}(0.22,-0.25)} \PSTCMPNode(.5;-60){E} \PSTCMPNode(.5;60){C}} h/libraryi

34

6.3 pst-circ2.lib

6 IMPLEMENTATION

Acknowledgements The author is grateful to Hendri Adriaens, Jean-Cˆ ome Charpentier, Josselin Noirel and Herbert Voß.

35