summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pst-optexp
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-07-22 22:53:45 +0000
committerKarl Berry <karl@freefriends.org>2012-07-22 22:53:45 +0000
commitfe821b3e418e038551ff9a32e79a35c0c74799cc (patch)
tree9c14a1c4083ec9354f0b0162c38c23f1e35d0425 /Master/texmf-dist/tex/latex/pst-optexp
parent8552ae7941203f1a1cf1779b74b219b9b838a7e3 (diff)
pst-optexp 3.1 (18jul12)
git-svn-id: svn://tug.org/texlive/trunk@27097 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pst-optexp')
-rw-r--r--Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty266
1 files changed, 240 insertions, 26 deletions
diff --git a/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty b/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty
index 015c381ec49..3228e22060e 100644
--- a/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty
+++ b/Master/texmf-dist/tex/latex/pst-optexp/pst-optexp.sty
@@ -9,7 +9,7 @@
%% This is a generated file.
%%
%% Project: pst-optexp
-%% Version: 3.0 (2012/07/09)
+%% Version: 3.1 (2012/07/17)
%%
%% Copyright (C) 2007-2012 by Christoph Bersch <usenet@bersch.net>
%%
@@ -31,7 +31,8 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{pst-optexp}
- [2012/07/09 v3.0 Optical experimental setups with PSTricks]
+ [2012/07/17 v3.1 Optical experimental setups with PSTricks]
+
\RequirePackage{pstricks}
\RequirePackage{pst-xkey}
\RequirePackage{pst-node}
@@ -987,6 +988,49 @@
coupleralign=center,
couplertype=elliptic
}%
+\define@key[psset]{optexp}{fiberboxheight}{%
+ \pst@checknum{#1}\POE@key@fiberboxheight
+}%
+\define@key[psset]{optexp}{fiberboxwidth}{%
+ \pst@checknum{#1}\POE@key@fiberboxwidth
+}%
+\define@key[psset]{optexp}{fiberboxsize}{%
+ \pst@expandafter\POE@psset@@fiberboxsize{#1} {} {} {}\@nil
+}%
+\def\POE@psset@@fiberboxsize#1 #2 #3\@nil{%
+ \psset[optexp]{fiberboxwidth=#1}
+ \ifx\\#2\\
+ \psset[optexp]{fiberboxheight=0}%
+ \else
+ \psset[optexp]{fiberboxheight=#2}%
+ \fi
+}%
+\define@key[psset]{optexp}{fiberboxsepin}{%
+ \def\POE@key@fiberboxsepin{#1}
+}%
+\define@key[psset]{optexp}{fiberboxsepout}{%
+ \def\POE@key@fiberboxsepout{#1}%
+}%
+\define@key[psset]{optexp}{fiberboxcount}{%
+ \pst@expandafter\POE@psset@@fiberboxcount#1\@nil
+}%
+\def\POE@psset@@fiberboxcount#1x#2\@nil{%
+ \ifx\\#1\\
+ \def\POE@key@fiberboxcountin{1}%
+ \else
+ \def\POE@key@fiberboxcountin{#1}%
+ \fi
+ \ifx\\#2\\
+ \def\POE@key@fiberboxcountout{1}%
+ \else
+ \def\POE@key@fiberboxcountout{#2}
+ \fi
+}%
+\psset[optexp]{%
+ fiberboxsize=1,
+ fiberboxsepin=0.2,
+ fiberboxsepout=0.2,
+ fiberboxcount=2x2}
\define@boolkey[psset]{optexp}[POE@]{beam}[true]{}
\define@key[psset]{optexp}{refractiveindex}{%
\psset[optexp]{n=#1}%
@@ -1322,21 +1366,41 @@
\@ifnextchar[%]
{\drawfiber@i}{\drawfiber@i[]}%
}%
-\def\drawfiber@i[#1]#2{%
+\def\drawfiber@i[#1]{%
\addafter@par{#1}%
- \def\POE@tempe{#2}%
- \@ifnextchar\bgroup{\drawfiber@ii}{}%
-}%
-\def\drawfiber@ii#1{%
- \expandafter\drawfiber@iii\expandafter{\POE@tempe}{#1}%
- \def\POE@tempe{#1}%
- \@ifnextchar\bgroup{\drawfiber@ii}{}%
-}%
-\def\drawfiber@iii#1#2{%
+ \drawfiber@ii}
+
+\def\drawfiber@ii{%
+ \@ifnextchar(%)
+ {\drawfiber@iii}%
+ {\@ifnextchar\bgroup{\drawfiber@iv}{}}%
+}%
+\def\drawfiber@iii(#1){\drawfiber@iv{(#1)}}%
+\def\drawfiber@iv#1{%
+ \def\POE@tempe{#1}\drawfiber@ii@
+}%
+\def\drawfiber@ii@{%
+ \@ifnextchar(%)
+ {\drawfiber@iii@}%
+ {\@ifnextchar\bgroup{\drawfiber@iv@}{}}%
+}%
+\def\drawfiber@iii@(#1){\drawfiber@iv@{(#1)}}%
+\def\drawfiber@iv@#1{%
+ \expandafter\drawfiber@v\expandafter{\POE@tempe}{#1}%
+ \def\POE@tempe{#1}\drawfiber@ii@}%
+\def\drawfiber@v#1#2{%
\begingroup
\let\psk@angleA\relax
\let\psk@angleB\relax
\use@par
+ \let\POE@angleA\psk@angleA
+ \let\POE@angleB\psk@angleB
+ \ifx\psk@angleA\relax
+ \def\psk@angleA{0 }%3
+ \fi
+ \ifx\psk@angleB\relax
+ \def\psk@angleB{0 }%
+ \fi
\def\POE@tempa{#1}
\ifx\POE@tempa\@empty
\edef\POE@comps{/\oenode{}{}\space}
@@ -1379,7 +1443,7 @@
\fi\fi
\pst@getcoor{@@A}\POE@tempa
\pst@getcoor{@@B}\POE@tempb
- \ifx\psk@angleA\relax
+ \ifx\POE@angleA\relax
\ifx\POE@key@fiberalign\POE@str@absolute
\psset{angleA=\POE@key@fiberangleA}%
\else
@@ -1390,7 +1454,7 @@
}%
\fi
\fi
- \ifx\psk@angleB\relax
+ \ifx\POE@angleB\relax
\ifx\POE@key@fiberalign\POE@str@absolute
\psset{angleB=\POE@key@fiberangleB}%
\else
@@ -1795,16 +1859,21 @@
\def\POE@aftercomps{#2}%
\fi
\def\POE@comps{}%
- \POE@@getcomps%
+ \POE@getcomps@i%
}%
-\def\POE@@getcomps{%
- \@ifnextchar\bgroup{\POE@@@getcomps}{\POE@aftercomps}%
+\def\POE@getcomps@i{%
+ \@ifnextchar(%)
+ {\POE@getplanenode@i}%
+ {\POE@getcomps@ii}
}%
-\def\POE@@@getcomps#1{%
+\def\POE@getcomps@ii{%
+ \@ifnextchar\bgroup{\POE@getcomps@iii}{\POE@aftercomps}%
+}%
+\def\POE@getcomps@iii#1{%
\def\POE@temp{#1\@empty}%
- \expandafter\POE@@@@getcomps\POE@temp\@nil
+ \expandafter\POE@getcomps@iv\POE@temp\@nil
}%
-\def\POE@@@@getcomps#1#2\@nil{%
+\def\POE@getcomps@iv#1#2\@nil{%
\edef\POE@temp{#1}%
\ifx\POE@temp\@empty
\POE@getcomp{(\oenode{}{})}%
@@ -1825,7 +1894,7 @@
\else
\POE@getcomp{(\oenode{}{#1#2})}%
\fi\fi\fi\fi%
- \POE@@getcomps%
+ \POE@getcomps@i%
}%
\def\POE@getplanenode(#1){%
\pst@@getcoor{#1}%
@@ -1841,6 +1910,7 @@
\POE@getcomp{{\pst@coor} }%
\fi
}%
+\def\POE@getplanenode@i(#1){\POE@getplanenode(#1)\POE@getcomps@i}%
\def\POE@getcomp#1{%
\ifx\POE@comps\@empty
\edef\POE@tempc{#1}%
@@ -2415,10 +2485,15 @@
}%
\ignorespaces}%
\def\optcoupler{\pst@object{optcoupler}}%
-\def\optcoupler@i(#1)(#2)(#3)(#4){%
+\def\optcoupler@i(#1)(#2){%
+ \@ifnextchar(%)
+ {\optcoupler@@i@(#1)(#2)}%
+ {\optcoupler@@i@(#1)(#1)(#2)(#2)}%
+}%
+\def\optcoupler@@i@(#1)(#2)(#3)(#4){%
\@ifnextchar\bgroup%
- {\@nameuse{optcoupler@i@}(#1)(#2)(#3)(#4)}%
- {\@nameuse{optcoupler@i@}(#1)(#2)(#3)(#4){}}%
+ {\optcoupler@i@(#1)(#2)(#3)(#4)}%
+ {\optcoupler@i@(#1)(#2)(#3)(#4){}}%
}%
\def\optcoupler@i@(#1)(#2)(#3)(#4)#5{%
\begin@OptexpFiberObj
@@ -2475,7 +2550,12 @@
}%
\fiberdipole@iimacro{optcoupler}%
\def\wdmsplitter{\pst@object{wdmsplitter}}%
-\def\wdmsplitter@i(#1)(#2)(#3){%
+\def\wdmsplitter@i(#1)(#2){%
+ \@ifnextchar(%)
+ {\wdmsplitter@@i@(#1)(#2)}%
+ {\wdmsplitter@@i@(#1)(#2)(#2)}%
+}%
+\def\wdmsplitter@@i@(#1)(#2)(#3){%
\@ifnextchar\bgroup%
{\wdmsplitter@i@(#1)(#2)(#3)}%
{\wdmsplitter@i@(#1)(#2)(#3){}}%
@@ -2522,7 +2602,12 @@
}%
\fiberdipole@iimacro{wdmsplitter}%
\def\wdmcoupler{\pst@object{wdmcoupler}}%
-\def\wdmcoupler@i(#1)(#2)(#3){%
+\def\wdmcoupler@i(#1)(#2){%
+ \@ifnextchar(%)
+ {\wdmcoupler@@i@(#1)(#2)}%
+ {\wdmcoupler@@i@(#1)(#1)(#2)}%
+}%
+\def\wdmcoupler@@i@(#1)(#2)(#3){%
\@ifnextchar\bgroup%
{\wdmcoupler@i@(#1)(#2)(#3)}%
{\wdmcoupler@i@(#1)(#2)(#3){}}%
@@ -2617,6 +2702,98 @@
\end@OptexpObj
}%
\fiberdipole@iimacro{optcirculator}%
+\def\fiberbox{\pst@object{fiberbox}}%
+\def\fiberbox@i(#1)(#2){%
+ \@ifnextchar(%)
+ {\fiberbox@@i@(#1)(#2)}%
+ {\fiberbox@@i@(#1)(#2)()()}%
+}%
+\def\fiberbox@@i@(#1)(#2)(#3)(#4){%
+ \@ifnextchar\bgroup%
+ {\fiberbox@i@(#1)(#2)(#3)(#4)}%
+ {\fiberbox@i@(#1)(#2)(#3)(#4){}}%
+}%
+\def\fiberbox@i@(#1)(#2)(#3)(#4)#5{%
+ \begin@OptexpFiberObj
+ \ifnum\POE@key@fiberboxcountin=1
+ \ifnum\POE@key@fiberboxcountout=1
+ \ifdim\POE@key@fiberboxheight pt=0pt
+ \PackageError{pst-optexp}{%
+ Cannot determine fiberboxheight automatically}
+ \fi
+ \fi
+ \fi
+ \ifPOE@backlayer
+ \ifx\\#3#4\\
+ \POE@regNodes{#1}{#2}
+ \POE@Verb{/@@inht 0 def /@@outht 0 def}%
+ \else
+ \pst@getcoor{#1}\POE@tempa%
+ \pst@getcoor{#2}\POE@tempb%
+ \pst@getcoor{#3}\POE@tempc%
+ \pst@getcoor{#4}\POE@tempd%
+ \pnode(!\POE@tempa \POE@tempb
+ \POE@dict{VecAdd 0.5 VecScale}
+ \tx@UserCoor){\oenodeRefA{}}
+ \pnode(!\POE@tempc \POE@tempd
+ \POE@dict{VecAdd 0.5 VecScale}
+ \tx@UserCoor){\oenodeRefB{}}
+ \POE@Verb{%
+ /N@\oenodeRefA{} @GetCenter
+ /N@\oenodeRefB{} @GetCenter @ABVect NormalizeVec
+ 90 matrix rotate dtransform 2 copy
+ \pst@nodedict
+ /GetCenterOrig /GetCenter load def
+ /GetCenter { begin X Y end } def
+ \POE@tempa \POE@tempb @ABVect
+ \tx@UserCoor DotProd abs 3 1 roll
+ \POE@tempc \POE@tempd @ABVect
+ \tx@UserCoor DotProd abs
+ /GetCenter /GetCenterOrig load def
+ end
+ /@@outht ED /@@inht ED
+ }%
+ \fi
+ \fi
+ \POE@drawcomponent[fiberbox]{#5}\fiberbox@ii
+ \ifPOE@backlayer
+ \ifx\\#3#4\\
+ \ifPOE@fiberpreset@
+ \ifnum\POE@key@fiberboxcountin=1
+ \ifPOE@fiberpresetin@
+ \drawfiber@{FiberIn}{(#1)}{\POE@key@compname}
+ \fi
+ \fi
+ \ifnum\POE@key@fiberboxcountout=1
+ \ifPOE@fiberpresetout@
+ \drawfiber@{FiberOut}{\POE@key@compname}{(#2)}
+ \fi
+ \fi
+ \fi
+ \else
+ \ifPOE@fiberpreset@
+ \ifPOE@fiberpresetin@
+ \ifPOE@fiberpresetin@top
+ \drawfiber@{FiberIn1}{(#1)}{\POE@key@compname}
+ \fi
+ \ifPOE@fiberpresetin@bottom
+ \drawfiber@{FiberIn2}{(#2)}{\POE@key@compname}
+ \fi
+ \fi
+ \ifPOE@fiberpresetout@
+ \ifPOE@fiberpresetout@top
+ \drawfiber@{FiberOut1}{\POE@key@compname}{(#3)}
+ \fi
+ \ifPOE@fiberpresetout@bottom
+ \drawfiber@{FiberOut2}{\POE@key@compname}{(#4)}
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \end@OptexpObj
+}%
+\fiberdipole@iimacro{fiberbox}%
\def\POE@calcNodes#1#2#3{{%
\pst@getcoor{#1}\POE@tempa%
\pst@getcoor{#2}\POE@tempb%
@@ -2840,6 +3017,7 @@
\@ifnextchar\bgroup{\fibercollimator@v}{\fibercollimator@v{}}%
}%
\def\fibercollimator@v#1{%
+ \addbefore@par{allowbeaminside=false}%
\begin@OptexpFiberObj
\ifPOE@backlayer
\POE@regNodes{\POE@tempa}{\POE@tempb}%
@@ -3938,6 +4116,42 @@
(! \POE@dict{@@x 0.2 mul @@y 1.3 mul \@arrowshift VecAdd})
\endgroup
\ignorespaces}%
+\def\fiberbox@ref{%
+ \POE@setref{%
+ /@@x \POE@key@fiberboxwidth\space 0.5 mul def
+ @@inht 0 eq @@outht 0 eq and {
+ /@@inht \POE@key@fiberboxcountin\space\POE@key@fiberboxsepin\space mul def
+ /@@outht \POE@key@fiberboxcountout\space\POE@key@fiberboxsepout\space mul def
+ } if
+ @@inht \POE@key@fiberboxcountin\space dup 1 add 3 1 roll div mul
+ @@outht \POE@key@fiberboxcountout\space dup 1 add 3 1 roll div mul
+ max
+ \POE@key@fiberboxheight\space dup @@inht @@outht max gt {
+ exch
+ } if pop 0.5 mul /@@y exch def
+ }%
+}%
+\def\fiberbox@nodes{%
+ \newOptexpFiberComp{%
+ 0 1 \POE@key@fiberboxcountin\space 1 sub {
+ \POE@key@fiberboxcountin\space 1 sub 0.5 mul dup 3 -1 roll sub exch
+ 0 gt {
+ @@inht \POE@key@fiberboxcountin\space 1 sub div mul
+ } if
+ @@x neg exch ToVec
+ } for
+ 0 1 \POE@key@fiberboxcountout\space 1 sub {
+ \POE@key@fiberboxcountout\space 1 sub 0.5 mul dup 3 -1 roll sub exch
+ 0 gt {
+ @@outht \POE@key@fiberboxcountout\space 1 sub div mul
+ } if
+ @@x exch ToVec
+ } for
+ }
+}%
+\def\fiberbox@comp{%
+ \psframe[dimen=outer](!\POE@dict{@@x neg @@y neg})(!\POE@dict{@@x @@y})
+}%
\def\optcoupler@nodes{%
\edef\@sep{\POE@key@couplersep\space 0.5 mul }%
\newOptexpFiberComp{%