From e68a3f22ee4908ca10db5b2471d0ab7da2d81532 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 4 Feb 2013 23:10:24 +0000
Subject: pst-optexp (4feb13)

git-svn-id: svn://tug.org/texlive/trunk@29028 c570f23f-e606-0410-a88d-b1316a301751
---
 .../source/latex/pst-optexp/pst-optexp.dtx         | 491 ++++++++++++++-------
 1 file changed, 326 insertions(+), 165 deletions(-)

(limited to 'Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx')

diff --git a/Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx b/Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx
index 5745c237a83..0e52d1cb7a8 100644
--- a/Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx
+++ b/Master/texmf-dist/source/latex/pst-optexp/pst-optexp.dtx
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2007-2012 by Christoph Bersch <usenet@bersch.net>
+% Copyright (C) 2007-2013 by Christoph Bersch <usenet@bersch.net>
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c
@@ -18,7 +18,7 @@
 %<stylefile>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<stylefile>\ProvidesPackage{pst-optexp}
 %<*stylefile>
-    [2012/09/18 v3.3a Optical experimental setups with PSTricks]
+    [2013/02/03 v3.4 Optical experimental setups with PSTricks]
 %</stylefile>
 %
 %<*driver>
@@ -681,7 +681,7 @@
 %
 % \ifGERMAN
 %   \section{Anforderungen}
-%   \LPack{pst-optexp} Version 3.0 benötigt \LaTeX{} und aktuelle Versionen der
+%   \LPack{pst-optexp} Version 3.4 benötigt \LaTeX{} und aktuelle Versionen der
 %   Pakete \LPack{pst-node}, \LPack{pstricks-add}, \LPack{multido},
 %   \LPack{pst-eucl} und \LPack{environ}.
 %
@@ -693,7 +693,7 @@
 % \fi
 % \ifENGLISH
 %   \section{Requirements}
-%   \LPack{pst-optexp} version 3.0 requires \LaTeX{} and recent versions of
+%   \LPack{pst-optexp} version 3.4 requires \LaTeX{} and recent versions of
 %   \LPack{pst-node}, \LPack{multido}, \LPack{pstricks-add},
 %   \LPack{pst-eucl}, and \LPack{environ}. 
 %
@@ -916,7 +916,7 @@
 %<*ignore>
 %\fi
 \begin{LTXexample}[linerange={1-3,6-6}]
-\begin{pspicture}[showgrid=true](0,-0.3)(3,2.3)
+\begin{pspicture}[showgrid](0,-0.3)(3,2.3)
   \pnode(0,1){A}\pnode(3,1){B}
   \lens(A)(B)
   \psset{style=Refline}\color{Refline}
@@ -930,22 +930,23 @@
 % \ifGERMAN
 % Diese Positionierung kann anhand von unterschiedlichen Parametern, wie
 % z.B. \Lkeyword{abspos} beinflusst werden (siehe dazu
-% \prettyref{sec:positioning} und \prettyref{sec:rotshift}). Die Linse wird nun
-% \opt{0.5} Einheiten entfernt vom Knoten \prm{A} platziert, die Box sitzt am
-% Ende der Referenzlinie $\overline{AB}$.
+% \prettyref{sec:positioning} und \prettyref{sec:rotshift}). Im
+% folgenden Beispiel wird die Linse \opt{0.5} Einheiten vom Knoten
+% \prm{A} entfernt platziert, die Box sitzt am Ende der Referenzlinie
+% $\overline{AB}$.
 % \fi
 % \ifENGLISH
 % This position can be changed with a number of parameters, such as
 % \Lkeyword{abspos} (see \prettyref{sec:positioning} and
-% \prettyref{sec:rotshift}). The lens is positioned \opt{0.5} units apart from
-% node \prm{A}, the box is placed at the end of the reference line
-% $\overline{AB}$.
+% \prettyref{sec:rotshift}). In the next example, the lens is positioned
+% \opt{0.5} units apart from node \prm{A}, the box is placed at the end
+% of the reference line $\overline{AB}$.
 % \fi
 %\iffalse
 %<*ignore>
 %\fi
 \begin{LTXexample}[morekeywords={[21]{abspos, position}}, linerange={1-4,7-7}]
-\begin{pspicture}[showgrid=true](0,-0.3)(3,2.3)
+\begin{pspicture}[showgrid](0,-0.3)(3,2.3)
   \pnode(0,1){A}\pnode(1.5,1){B}
   \lens[abspos=0.5](A)(B)
   \optbox[position=end](A)(B)
@@ -958,7 +959,7 @@
 %\fi 
 %
 % \ifGERMAN Die Komponenten lassen sich allgemein in zwei Kategorien
-% unterteilen: Freistrahl- und Faserkomponenten. Diese unterscheiden sich in
+% unterteilen: Faser- und Freistrahlkomponenten. Diese unterscheiden sich in
 % erster Linie bezüglich ihrer Verbindungsmöglichkeiten: Freistrahlkomponenten
 % können sowohl mit Lichtstrahlen als auch mit Fasern verbunden werden,
 % wohingegen Faserkomponenten nur Faserverbindungen erlauben.
@@ -984,7 +985,7 @@
 %<*ignore>
 %\fi
 \begin{LTXexample}[morekeywords={[21]{labelangle, labelref, labeloffset}}, linerange={1-5,8-8}]
-\begin{pspicture}[showgrid=true](0,-0.3)(3,3.3)
+\begin{pspicture}[showgrid](0,-0.3)(3,3.3)
   \pnode(0,2.5){A}\pnode(2,2.5){B}\pnode(2,1.5){C}
   \mirror[labelangle=-45](A)(B)(C){M}
   \optbox[position=start, labeloffset=0, labelref=relative](C)(B){box}
@@ -1004,7 +1005,7 @@
 % \ifGERMAN
 % Freistrahlkomponenten können mit Lichtstrahlen verbunden werden, deren Weg mit
 % Raytracing berechnet werden kann. Da es sich um ein Paket zum
-% \emph{Skizzieren} experimenteller Aufbauten handelt, werde hier trotz der
+% \emph{Skizzieren} experimenteller Aufbauten handelt, werden hier trotz der
 % realistischen Berechnungen viele Möglichkeiten offen gehalten den Strahlengang
 % zu manipulieren.
 %
@@ -1033,13 +1034,14 @@
 % \iffalse
 %<*ignore>
 % \fi
-\begin{LTXexample}
+\begin{LTXexample}[linerange={1-5,8-8}]
 \begin{pspicture}[showgrid](0,-0.3)(3,2.3)
-  \pnode(1.5,1){A}\pnode(3,1){B}
-  \optbox[position=start](A)(B)
-  \lens[n=2](A)(B)
-  \drawbeam{1}{2}(B)
-  \drawbeam[beampos=0.2, linecolor=red]{1}{2}(B)
+  \pnode(0,1){A}\pnode(3,1){B}
+  \lens[n=2, lensradius=2 2, lensheight=1.5](A)(B)
+  \drawbeam(A){1}(B)
+  \drawbeam[beampos=0.4, linecolor=red](A){1}(B)
+  \psset{style=Refline}\color{Refline}
+  \psdot(A)\uput[-90](A){A}\psdot(B)\uput[90](B){B}
 \end{pspicture}
 \end{LTXexample}
 % \iffalse
@@ -1054,12 +1056,13 @@
 % \iffalse
 %<*ignore>
 % \fi
-\begin{LTXexample}
+\begin{LTXexample}[linerange={1-4,7-7}]
 \begin{pspicture}[showgrid](0,-0.3)(3,2.3)
-  \pnode(1.5,1){A}\pnode(3,1){B}
-  \optbox[position=start](A)(B)
-  \lens[n=2](A)(B)
-  \drawbeam[beamangle=10, ArrowInside=->, arrows=-|, beaminside=false]{1}{2}(B)
+  \pnode(0,1){A}\pnode(3,1){B}
+  \lens[n=2, lens=2 2 1.5](A)(B)
+  \drawbeam[beamangle=10, ArrowInside=->, arrows=-|, beaminside=false](A){1}(B)
+  \psset{style=Refline}\color{Refline}
+  \psdot(A)\uput[90](A){A}\psdot(B)\uput[-90](B){B}
 \end{pspicture}
 \end{LTXexample}
 % \iffalse
@@ -1076,12 +1079,14 @@
 % \iffalse
 %<*ignore>
 % \fi
-\begin{LTXexample}
+\begin{LTXexample}[linerange={1-5,8-8}]
 \begin{pspicture}[showgrid](0,-0.3)(3,2.3)
-  \pnode(1.5,1){A}\pnode(3,1){B}
-  \optbox[position=start](A)(B)
+  \pnode(0.5,1){A}\pnode(3,1){B}
+  \optbox[position=start, optboxsize=0.5 1](A)(B)
   \lens[n=2](A)(B)
-  \drawwidebeam[beamwidth=0.2, fillstyle=solid, fillcolor=green!40]{1}{2}(B)
+  \drawwidebeam[beamwidth=0.2, fillstyle=solid, fillcolor=green!40]{1-2}(B)
+  \psset{style=Refline}\color{Refline}
+  \psdot(A)\uput[45](A){A}\psdot(B)\uput[135](B){B}
 \end{pspicture}
 \end{LTXexample}
 % \iffalse
@@ -1384,7 +1389,7 @@
 % \fi
 % \ifENGLISH
 % The appearance of the beam can be changed via the \Lstyle{Beam} style, and may
-% have a e.g. semitransparent fill pattern.
+% have e.g. a semitransparent fill pattern.
 % \fi
 % \iffalse
 %<*ignore>
@@ -1412,7 +1417,7 @@
 %
 % \ifGERMAN\subsection{Faseraufbau}\fi
 % \ifENGLISH\subsection{Fiber setup}\fi
-% \label{ex:fiber-setup}
+% \label{sec:fiber-setup}
 %
 % \ifGERMAN
 % Dieses Beispiel zeigt, wie ein faseroptischer Aufbau mit automatisch
@@ -1453,7 +1458,7 @@
 % \catcode`\*=13
 % \def*{}%
 \begin{LTXexample}[style=example, linerange={1-5,7-7}]
-*\ON*\begin{pspicture}[showgrid=true](4.7,2)
+*\ON*\begin{pspicture}[showgrid](4.7,2)
   \pnode(0.7,1){A}\pnode(1,1){B}\pnode(2.8,1){C}
   \pnode(4,1.5){D}\pnode(4,0.5){E}*\OFF*
   \psset{optboxwidth=0.7, labelstyle=\scriptsize}
@@ -1476,7 +1481,7 @@
 %<*ignore>
 % \fi
 \begin{LTXexample}[style=example, linerange={1-6,8-8}]
-*\ON*\begin{pspicture}[showgrid=true](4.7,2)
+*\ON*\begin{pspicture}[showgrid](4.7,2)
   \pnode(0.7,1){A}\pnode(1,1){B}\pnode(2.8,1){C}
   \pnode(4,1.5){D}\pnode(4,0.5){E}
   \psset{optboxwidth=0.7, labelstyle=\scriptsize}
@@ -1502,7 +1507,7 @@
 %<*ignore>
 % \fi
 \begin{LTXexample}[style=example, linerange={1-7,9-9}]
-*\ON*\begin{pspicture}[showgrid=true](4.7,2)
+*\ON*\begin{pspicture}[showgrid](4.7,2)
   \pnode(0.7,1){A}\pnode(1,1){B}\pnode(2.8,1){C}
   \pnode(4,1.5){D}\pnode(4,0.5){E}
   \psset{optboxwidth=0.7, labelstyle=\scriptsize}
@@ -1540,7 +1545,7 @@
 % \iffalse
 %<*ignore>
 % \fi
-\begin{LTXexample}[style=example, caption={caption}, linerange={1-9,11-11}]
+\begin{LTXexample}[style=example, caption={caption}, label={ex:fiber-setup}, linerange={1-9,11-11}]
 *\ON*\begin{pspicture}[showgrid](4.7,2)
   \pnode(0.7,1){A}\pnode(1,1){B}\pnode(2.8,1){C}
   \pnode(4,1.5){D}\pnode(4,0.5){E}
@@ -1559,7 +1564,6 @@
 %
 % \ifGERMAN\subsection{Faseraufbau (Alternative)}\fi
 % \ifENGLISH\subsection{Fiber setup (alternative)}\fi
-% \label{ex:fiber-setup-alt}
 %
 % \ifGERMAN
 % Dieses Beispiel ist vom Ergebnis her identisch mit dem vorangegangenen
@@ -4186,9 +4190,16 @@
 % \end{ltxsyntax}
 % 
 % \begin{optionlist}
-% \numitem[0.8]{switchsize}
-% \ifGERMAN Die Seitenlänge des Schalters.\fi
-% \ifENGLISH The side length of the switch.\fi
+% \optitem[0.8]{switchsize}{\prm{num} or \prm{width} \prm{height}}
+% \ifGERMAN 
+% Wird nur eine Zahl angegeben, so ist das die Seitenlänge des
+% Schalters, andernfalls können Breite und Höhe getrennt angegeben
+% werden.
+% \fi
+% \ifENGLISH 
+% A single number defines the side length of the switch, otherwise the
+% height and width can be specified separately.
+% \fi
 %
 % \choitem[opened]{switchstyle}{opened, closed} 
 % \ifGERMAN Der Zustand des Schalters kann geschlossen (\opt{closed}) oder
@@ -4515,8 +4526,16 @@
 % \fi
 % 
 % \choitem[center]{coupleralign}{t, top, b, bottom, c, center}
-% \ifGERMAN Die Ausrichtung des Kopplers bezüglich der Referenzknoten.\fi
-% \ifENGLISH The alignment of the coupler with respect to the reference nodes.\fi
+% \ifGERMAN Die Ausrichtung des Kopplers bezüglich der
+% Referenzknoten. Beachten Sie, dass die Position der Komponentenmitte
+% und damit der Beschriftung von dieser Einstellung abhängt (siehe
+% \ref{sec:centernode}).
+% \fi
+% \ifENGLISH The alignment of the coupler with respect to the reference
+% nodes. Note, that the exact position of the coupler center and
+% accordingly that of the label depends on this setting (see
+% \ref{sec:centernode}).
+% \fi
 % \iffalse
 %<*ignore>
 % \fi
@@ -5273,11 +5292,13 @@
 %   \cmditem{oenodeCenter}{comp}
 % 
 % \ifGERMAN
-% Dieser Knoten liegt, bis auf wenige Ausnahmen (z.B. \Lcs{optdetector}), im
+% Dieser Knoten liegt, bis auf wenige Ausnahmen, wie
+% z.B. \Lcs{optdetector} und \Lcs{optcoupler} (siehe unten), im
 % Mittelpunkt der Komponente.
 % \fi
 % \ifENGLISH
-% This node lays, except for a few components (e.g. \Lcs{optcirculator}), in the
+% This node lays, except for a few components like
+% e.g. \Lcs{optcirculator} and \Lcs{optcoupler} (see below), in the
 % center of the component.
 % \fi
 % \iffalse
@@ -5296,6 +5317,28 @@
 % \iffalse
 %</ignore>
 % \fi
+%
+% \ifGERMAN Bei \Lcs{optcoupler} hängt die Position der Komponentenmitte
+% von den \Lkeyword{coupleralign} Einstellungen ab.
+% \fi
+% \ifENGLISH For \Lcs{optcoupler} the position of the component center
+% depends on the \Lkeyword{coupleralign} settings.
+% \fi
+% \iffalse
+%<*ignore>
+% \fi
+\begin{LTXexample}
+\begin{pspicture}(0,0.3)(3,3)
+  \psset[optexp]{couplersize=0.6 0.4, couplersep=0.2, couplertype=rectangle}
+  \optcoupler(0,3)(0,2)(3,3)(3,2)
+  \psdot(\oenodeCenter{})
+  \optcoupler[coupleralign=b](0,1.5)(0,0.5)(3,1.5)(3,0.5)
+  \psdot(\oenodeCenter{})
+\end{pspicture}
+\end{LTXexample}
+% \iffalse
+%</ignore>
+% \fi
 % \end{ltxsyntax}
 % 
 % \ifGERMAN\section{Beschriftungsknoten}\fi
@@ -6041,20 +6084,26 @@
 % Bei \Lcs{drawbeam} und \Lcs{drawwidebeam} können auch Zahlintervalle verwendet
 % werden. Gültige Intervallangaben sind
 % \begin{description}
-% \item[\parbox{2em}{\texttt{x-y}}] Von \opt{x} bis \opt{y}, ist \opt{x} größer
-%   als \opt{y}, so wird heruntergezählt.
+% \item[\parbox{2em}{\texttt{x-y}}] Von \opt{x} bis \opt{y}, ist \opt{x}
+%   größer als \opt{y}, so wird heruntergezählt. Ist der gesamte
+%   Bereich nicht definiert, dann wird ein Fehler ausgegeben.
 % \item[\parbox{2em}{\texttt{x-}}] Von \opt{x} bis zur letzten Komponente.
-% \item[\parbox{2em}{\texttt{\hphantom{x}-y}}] Von der ersten Komponente bis \opt{y}.
+% \item[\parbox{2em}{\texttt{\hphantom{x}-y}}] Von der ersten Komponente
+%   bis \opt{y}. Ist \opt{y} außerhalb des definierten Bereichs, dann
+%   wird eine Warnung ausgegeben.
 % \item[\parbox{2em}{\texttt{\hphantom{x}-}}] Verbinde alle Komponenten.
 % \end{description}
 % \fi
 % \ifENGLISH For \Lcs{drawbeam} and \Lcs{drawwidebeam} you can also specify a
 % number range. Valid range specifications are
 % \begin{description}
-% \item[\parbox{2em}{\texttt{x-y}}] From \opt{x} to \opt{y}, if \opt{x} is
-%   greater than \opt{y}, the numbers are decremented.
+% \item[\parbox{2em}{\texttt{x-y}}] From \opt{x} to \opt{y}, if \opt{x}
+%   is greater than \opt{y}, the numbers are decremented. If the whole
+%   range is not defined, an error is raised.
 % \item[\parbox{2em}{\texttt{x-}}] From \opt{x} to the last component.
-% \item[\parbox{2em}{\texttt{\hphantom{x}-y}}] From the first component to \opt{y}.
+% \item[\parbox{2em}{\texttt{\hphantom{x}-y}}] From the first component
+%   to \opt{y}. If \opt{y} is outside the valid range, a warning is
+%   raised.
 % \item[\parbox{2em}{\texttt{\hphantom{x}-}}] Connect all components.
 % \end{description}
 % \fi
@@ -9265,9 +9314,9 @@
   \pinhole[position=0.8](D)(E)
   \drawwidebeam[ArrowInsidePos=0.3, beamwidth=0.2, linecolor=white, beamdiv=-7.15](A){1-3}
   \psset{loadbeampoints, savebeampoints=false}%
-  \drawwidebeam[ArrowInsidePos=0.6, beamangle=3, linecolor=blue!60!white]{3-6}
+  \drawwidebeam[ArrowInsidePos=0.6, beamangle=3, linecolor=blue!60!white]{3-5}(E)
   \drawwidebeam[ArrowInsidePos=0.7, linecolor=green!60!white, arrows=->, ArrowInsideMinLength=2]{3-5}(E)
-  \drawwidebeam[ArrowInsidePos=0.8, beamangle=-3, linecolor=red!60!white]{3-6}
+  \drawwidebeam[ArrowInsidePos=0.8, beamangle=-3, linecolor=red!60!white]{3-5}(E)
 \end{optexp}
 \end{pspicture}
 \end{LTXexample}
@@ -10436,6 +10485,13 @@
 % \begin{changelog}
 %\patchcmd{\release}{\setlength{\itemsep}{0pt}}{\setlength{\itemsep}{0pt}\setlength{\parsep}{0pt}}{}{}
 %   ^^A Do not wrap lines inside the \items, otherwise Changes.py does not work properly
+%   \begin{release}{3.4}{2013-02-03}
+%   \item Fixed bugs when using \opt{fillstyle} for some components
+%   \item Extended option \opt{switchsize}\see{cmd:optswitch}
+%   \item Modified coupler center node to be on the base line\see{sec:centernode}
+%   \item Extended error checking for \cs{drawbeam} and \cs{drawfiber}\see{sec:accessobj}
+%   \item Fixed some bugs in the connection code
+%   \end{release}
 %   \begin{release}{3.3a}{2012-09-18}
 %   \item Fixed bug which was exposed by an update of pst-node.
 %   \item Fixed trailing spaces.
@@ -10902,6 +10958,7 @@
 %    \end{macrocode}
 % Labels
 %    \begin{macrocode}
+\newcommand{\oelabel}[1]{#1}%
 \define@key[psset]{optexp}{labelangle}{%
   \pst@checknum{#1}\POE@key@labelangle
 }
@@ -10989,7 +11046,7 @@
       \def\POE@key@extnodealign{#1}%
     \fi
   }%
-  {\PackageError{pst-optexp}{Unknown value '\val' for extnodealign.}}
+  {\PackageError{pst-optexp}{Unknown value '\val' for extnodealign}}
 %    \end{macrocode}
 % This part was copied and adapted from \cs{psset@@ref} from pstricks.tex
 %    \begin{macrocode}
@@ -11059,15 +11116,15 @@
 %    \end{macrocode}
 % Use the old naming scheme which was used in version 2.x.
 %    \begin{macrocode}
-    \edef\POE@str@basicname@default{tempNode}
-    \edef\POE@str@basicname@prefix{}
-    \gdef\POE@str@basicname@sep{Intern}
-    \edef\POE@str@extnode@postfix{ExtNode}
+    \edef\POE@str@basicname@default{tempNode}%
+    \edef\POE@str@basicname@prefix{}%
+    \gdef\POE@str@basicname@sep{Intern}%
+    \edef\POE@str@extnode@postfix{ExtNode}%
   \or
-    \edef\POE@str@basicname@default{@}
-    \edef\POE@str@basicname@prefix{OE@}
-    \gdef\POE@str@basicname@sep{}
-    \edef\POE@str@extnode@postfix{Ext}
+    \edef\POE@str@basicname@default{@}%
+    \edef\POE@str@basicname@prefix{OE@}%
+    \gdef\POE@str@basicname@sep{}%
+    \edef\POE@str@extnode@postfix{Ext}%
   \fi
 }%
 \psset[optexp]{namingscheme=new}%
@@ -11218,7 +11275,7 @@
 \def\POE@psset@@crystalsize#1 #2 #3\@nil{%
   \ifx\\#2\\%
     \PackageWarning{pst-optexp}{%
-      Parameter 'crystalsize' requires two numbers}%
+      Parameter 'crystalsize' requires two numbers.}%
   \fi
   \psset[optexp]{crystalwidth=#1}%
   \psset[optexp]{crystalheight=#2}%
@@ -11257,7 +11314,7 @@
 \def\POE@psset@@optboxsize#1 #2 #3\@nil{%
   \ifx\\#2\\%
     \PackageWarning{pst-optexp}{%
-      Parameter 'optboxsize' requires two numbers}%
+      Parameter 'optboxsize' requires two numbers.}%
   \fi
   \psset[optexp]{optboxwidth=#1, optboxheight=#2}%
 }%
@@ -11292,7 +11349,7 @@
 \def\POE@psset@@platesize#1 #2 #3\@nil{%
   \ifx\\#2\\%
     \PackageWarning{pst-optexp}{%
-      Parameter 'platesize' requires two numbers}%
+      Parameter 'platesize' requires two numbers.}%
   \fi
   \psset[optexp]{platewidth=#1, plateheight=#2}%
 }%
@@ -11314,7 +11371,7 @@
 }%
 \define@choicekey*+[psset]{optexp}{dettype}[\val\nr]{round,diode}%
    {\edef\POE@key@dettype{\val}}
-   {\PackageError{pst-optexp}{Unknown value '\val' for dettype.}}
+   {\PackageError{pst-optexp}{Unknown value '\val' for dettype}}
 \newpsstyle{DetectorStyle}{}
 \psset[optexp]{%
   detsize=0.8,
@@ -11342,7 +11399,7 @@
 \define@choicekey+[psset]{optexp}{poltype}%
   [\val\nr]{parallel,misc,perp,rcirc,lcirc}%
   {\edef\POE@key@poltype{#1}}
-  {\PackageError{pst-optexp}{Unknown value '\val' for poltype.}%
+  {\PackageError{pst-optexp}{Unknown value '\val' for poltype}%
 }
 \psset[optexp]{%
   poltype=parallel,
@@ -11389,7 +11446,7 @@
 \def\POE@psset@@glanthompsonsize#1 #2 #3\@nil{%
   \ifx\\#2\\%
     \PackageWarning{pst-optexp}{%
-      Parameter 'glanthompsonsize' requires two numbers}%
+      Parameter 'glanthompsonsize' requires two numbers.}%
   \fi
   \psset[optexp]{glanthompsonwidth=#1, glanthompsonheight=#2}%
 }%
@@ -11523,7 +11580,7 @@
     \else
       \def\POE@key@gratingalign{#1}%
     \fi}%
-  {\PackageError{pst-optexp}{Unknown value '\val' for gratingalign.}}
+  {\PackageError{pst-optexp}{Unknown value '\val' for gratingalign}}
 \define@boolkey[psset]{optexp}[POE@]{reverse}[true]{}
 \psset[optexp]{%
   gratingcount=10,
@@ -11560,7 +11617,7 @@
 \define@choicekey+[psset]{optexp}{prismalign}[\val\nr]%
   {auto,center}%
   {\def\POE@key@prismalign{#1}}%
-  {\PackageError{pst-optexp}{Unknown value '\val' for prismalign.}}%
+  {\PackageError{pst-optexp}{Unknown value '\val' for prismalign}}%
 \psset[optexp]{%
   prismsize=1,
   prismangle=60,
@@ -11623,7 +11680,7 @@
 \define@choicekey+[psset]{optexp}{polcontroltype}[\val\nr]%
    {linear,triangle}%
    {\def\POE@key@polcontroltype{#1}}%
-   {\PackageError{pst-optexp}{Unknown polcontroltype '\val'}}
+   {\PackageError{pst-optexp}{Unknown value '\val' for polcontroltype}}
 \psset[optexp]{%
   polcontrolsize=0.15,
   polcontroltype=linear
@@ -11697,12 +11754,20 @@
 % Optical switch
 %    \begin{macrocode}
 \define@key[psset]{optexp}{switchsize}{%
-  \pst@checknum{#1}\POE@key@switchsize
-}
+  \pst@expandafter\POE@psset@@switchsize{#1} {} {} {}\@nil
+}%
+\def\POE@psset@@switchsize#1 #2 #3\@nil{%
+  \pst@checknum{#1}\POE@key@switchwidth
+  \ifx\\#2\\%
+    \pst@checknum{#1}\POE@key@switchheight
+  \else
+    \pst@checknum{#2}\POE@key@switchheight
+  \fi
+}%
 \define@choicekey+[psset]{optexp}{switchstyle}%
   [\val\nr]{opened,closed}%
   {\edef\POE@key@switchstyle{#1}}%
-  {\PackageError{pst-optexp}{Unknown value '\val' for switchstyle.}}
+  {\PackageError{pst-optexp}{Unknown value '\val' for switchstyle}}
 \psset[optexp]{%
   switchsize=0.8,
   switchstyle=opened
@@ -11755,8 +11820,6 @@
   \pst@expandafter\POE@psset@@optcircangle{#1} {} {} {}\@nil
 }%
 \def\POE@psset@@optcircangle#1 #2 #3\@nil{%
-  \edef\POE@tempA{#1}%
-  \edef\POE@tempB{#2}%
   \ifx\\#2\\%
     \PackageError{pst-optexp}{optcircangle requires two numbers}%
   \else\ifx\\#1\\%
@@ -11797,7 +11860,7 @@
       \let\POE@key@couplertype\POE@str@couplertype@ellipse
     \fi
   }%
-  {\PackageError{pst-optexp}{Unknown value '\val' for couplertype.}}
+  {\PackageError{pst-optexp}{Unknown value '\val' for couplertype}}
 \define@key[psset]{optexp}{align}{%
   \psset[optexp]{coupleralign=#1}%
   \PackageWarning{pst-optexp}{%
@@ -11816,7 +11879,7 @@
     \else
       \def\POE@key@coupleralign{#1}%
     \fi}%
-  {\PackageError{pst-optexp}{Unknown value '\val' for coupleralign.}}
+  {\PackageError{pst-optexp}{Unknown value '\val' for coupleralign}}
 \psset[optexp]{%
   couplersize=0.2,
   couplersep=0.05,
@@ -11884,7 +11947,7 @@
   \psset[optexp]{n=#1}%
   \PackageWarning{pst-optexp}{%
     Option 'refractiveindex' is deprecated,\MessageBreak
-    use 'n' instead}%
+    use 'n' instead.}%
 }%
 \define@key[psset]{optexp}{n}{%
   \POE@parsealg{n}#1\@nil
@@ -11928,7 +11991,7 @@
       \def\POE@key@savebeampoints{#1}
     \else
       \PackageError{pst-optexp}%
-        {savebeampoints must be a positive integer or 0.}%
+        {savebeampoints must be a positive integer or 0}%
     \fi
     \@expandtwoargs\in@{,\POE@key@savebeampoints,}{,\POE@beamlist,}%
     \ifin@\else
@@ -11950,7 +12013,7 @@
       \def\POE@key@loadbeampoints{#1}%
     \else
       \PackageError{pst-optexp}%
-        {loadbeampoints must be a positive integer or 0.}%
+        {loadbeampoints must be a positive integer or 0}%
     \fi
     \@expandtwoargs\in@{,\POE@key@loadbeampoints,}{,\POE@beamlist,}%
     \ifin@\else
@@ -11995,7 +12058,7 @@
       \def\POE@key@beamalign{#1}%
     \fi
   }%
-  {\PackageError{pst-optexp}{Unknown value '\val' for beamalign.}}
+  {\PackageError{pst-optexp}{Unknown value '\val' for beamalign}}
 \define@key[psset]{optexp}{ArrowInsideMinLength}{%
   \def\POE@key@ArrowInsideMinLength{#1}%
 }%
@@ -12182,10 +12245,10 @@
       \def\POE@key@fiberalign{#1}%
     \fi
   }%
-  {\PackageError{pst-optexp}{Unknown value '\val' for fiberalign.}}%  
+  {\PackageError{pst-optexp}{Unknown value '\val' for fiberalign}}%
 \define@key[psset]{optexp}{fiberstyle}{%
   \@ifundefined{nc#1}%
-    {\PackageError{pst-optexp}{Unknown value '#1' for fiberstyle.}}%
+    {\PackageError{pst-optexp}{Unknown value '#1' for fiberstyle}}%
     {\def\POE@key@fiberstyle{#1}}}
 \psset[optexp]{%
   fiberangleA=0,
@@ -12242,6 +12305,7 @@
     \POE@getcoor#1#2
     \edef\POE@temp{{\pst@coor}}%
   \else
+    \POE@checkcompname{#1#2}%
     \edef\POE@temp{/\oenode{}{#1#2}\space}%
   \fi%
 }%
@@ -12856,12 +12920,27 @@
 \def\POE@getcomprange#1-#2\@nil{%
   \ifx\\#2\\%
     \ifx\\#1\\%
-      % empty option
+%    \end{macrocode}
+% empty option, use the current component ID
+%    \begin{macrocode}
       \edef\POE@firstcomp{\the\POE@cnt}%
       \edef\POE@lastcomp{\the\POE@cnt}%
     \else
+%    \end{macrocode}
+% A single number was given
+%    \begin{macrocode}
       \edef\POE@firstcomp{#1}%
       \edef\POE@lastcomp{#1}%
+%    \end{macrocode}
+% Check if the number is valid, otherwise quit with an error.
+%    \begin{macrocode}
+      \ifodd
+        \ifnum 0<\POE@firstcomp\ifnum\POE@lastcomp>\the\POE@cnt \@ne\else\z@\fi\else\@ne\fi
+        \PackageError{pst-optexp}%
+          {Component ID \POE@firstcomp\space is not valid, 
+           \ifnum\the\POE@cnt=0 no components have been defined\else
+           valid range is from 1 to \the\POE@cnt\fi}
+      \fi
     \fi
   \else
     \ifx\\#1\\%
@@ -12870,20 +12949,36 @@
       \edef\POE@firstcomp{#1}%
     \fi
     \POE@getlastcomp#2%
+    \ifnum\POE@firstcomp>\the\POE@cnt
+      \ifnum\POE@lastcomp>\the\POE@cnt
+        \PackageError{pst-optexp}%
+          {All components \POE@firstcomp-\POE@lastcomp\space out of range}%
+      \fi
+    \fi
+    \ifnum\POE@firstcomp<1
+      \PackageWarning{pst-optexp}%
+        {Component ID \POE@firstcomp\space is not valid, setting to 1.}%
+      \def\POE@firstcomp{1}%
+    \else\ifnum\POE@firstcomp>\the\POE@cnt
+      \PackageWarning{pst-optexp}%
+        {Component ID \POE@firstcomp\space is not valid, setting to \MessageBreak
+         the last defined value (\the\POE@cnt).}%
+      \edef\POE@firstcomp{\the\POE@cnt}%
+    \fi\fi
+    \ifnum\POE@lastcomp>\the\POE@cnt
+      \PackageWarning{pst-optexp}%
+        {Component ID \POE@lastcomp\space is not valid, setting to \MessageBreak
+         the last defined value (\the\POE@cnt).}%
+      \edef\POE@lastcomp{\the\POE@cnt}%
+    \else\ifnum\POE@lastcomp<1
+      \PackageWarning{pst-optexp}%
+        {Component ID \POE@lastcomp\space is not valid, setting to 1.}%
+      \def\POE@lastcomp{1}%
+    \fi\fi
   \fi
-  \ifnum\POE@firstcomp<1
-    \def\POE@firstcomp{1}%
-  \else\ifnum\POE@firstcomp>\the\POE@cnt
-    \edef\POE@firstcomp{\the\POE@cnt}%
-  \fi\fi
-  \ifnum\POE@lastcomp>\the\POE@cnt
-    \edef\POE@lastcomp{\the\POE@cnt}%
-  \else\ifnum\POE@lastcomp<1
-    \def\POE@lastcomp{1}%
-  \fi\fi
-}
+}%
 \def\POE@getlastcomp#1-{%
-  \ifx.#1.%
+  \ifx\\#1\\%
     \edef\POE@lastcomp{\the\POE@cnt}%
   \else
     \ifx\@empty#1\relax
@@ -12892,7 +12987,7 @@
       \edef\POE@lastcomp{#1}%
     \fi
   \fi
-}
+}%
 %    \end{macrocode}
 %
 % \begin{macro}{\POE@getcomps}
@@ -12937,6 +13032,7 @@
       \POE@firstcomp\space\POE@lastcomp\space GetCompRange %
     }%
   \else
+    \POE@checkcompname{#1#2}%
     \POE@getcomp{(\oenode{}{#1#2})}%
   \fi\fi\fi\fi%
   \POE@getcomps@i%
@@ -13249,7 +13345,7 @@
 \def\POE@checkcompname#1{%
   \@expandtwoargs\in@{,#1,}{,\POE@complist,}%
   \ifin@\else
-    \PackageError{pst-optexp}{^^Jcompname '#1' undefined!^^J}
+    \PackageError{pst-optexp}{Component '#1' is undefined}
   \fi
 }%
 %    \end{macrocode}
@@ -13269,18 +13365,18 @@
 \def\oenode#1#2{%
   \POE@str@basicname@prefix%
   \ifx\\#2\\%
-    \ifnum9<1\POE@getlastcompname%
-      \POE@str@basicname@default%
-      \POE@getlastcompname%
-    \else%
-      \POE@getlastcompname%
-      \POE@str@basicname@sep%
-    \fi%
-  \else%
-    \ifnum9<1#2%
-      \POE@str@basicname@default%
+    \ifnum9<1\POE@getlastcompname\space%
+      \POE@str@basicname@default
+      \POE@getlastcompname
+    \else
+      \POE@getlastcompname
+      \POE@str@basicname@sep
+    \fi
+  \else
+    \ifnum9<1#2
+      \POE@str@basicname@default
       #2%
-    \else%
+    \else
       #2\POE@str@basicname@sep%
     \fi%
   \fi%
@@ -13373,7 +13469,7 @@
   \else
     \PackageWarning{pst-optexp}{%
       \string\oenodeIfc\space node argument must be\MessageBreak
-      integer, 'N', or 'C'}
+      integer, 'N', or 'C'.}
   \fi\fi\fi
 }%
 %    \end{macrocode}
@@ -13745,8 +13841,7 @@
     \dipole@iimacro{#2}%
   }{%
     \PackageError{pst-optexp}{%
-      dipole component `#2' already defined
-    }%
+      dipole component '#2' already defined}%
   }%
 \ignorespaces}%
 %    \end{macrocode}
@@ -13782,8 +13877,7 @@
       \fiberdipole@iimacro{#2}%
    }{%
      \PackageError{pst-optexp}{%
-       fiber dipole object `#2' already defined
-     }%
+       fiber dipole object '#2' already defined}%
   }%
 \ignorespaces}%
 %    \end{macrocode}
@@ -13816,8 +13910,7 @@
     \tripole@iimacro{#2}%
   }{%
     \PackageError{pst-optexp}{%
-      tripole object `#2' already defined
-    }%
+      tripole object '#2' already defined}%
   }%
 \ignorespaces}%
 %    \end{macrocode}
@@ -14128,7 +14221,8 @@
       \ifnum\POE@key@fiberboxcountout=1
         \ifdim\POE@key@fiberboxheight pt=0pt
           \PackageError{pst-optexp}{%
-            Cannot determine fiberboxheight automatically}
+            Cannot determine height of 1x1 fiberbox automatically, 
+            use fiberboxheight}%
         \fi
       \fi
     \fi
@@ -14404,14 +14498,14 @@
       {\POE@key@labelangle}%
       {\oenodeCenter{}}%
       {\pnode(0,0){\oenodeLabel{}}%
-       \rput[\POE@key@labelalign](0,0){\POE@key@labelstyle #1}}%
+       \rput[\POE@key@labelalign](0,0){\POE@key@labelstyle\oelabel{#1}}}%
 %    \end{macrocode}
 % Rotate the label node together with the component, but do not rotate the label
 % text itself.
 %    \begin{macrocode}
   \else\ifx\POE@key@labelref\POE@str@labelref@relgrav
     \rput[\POE@key@labelalign](\oenodeLabel{}){%
-      \POE@key@labelstyle #1}%
+      \POE@key@labelstyle\oelabel{#1}}%
 %    \end{macrocode}
 % Rotate label node and label text with the component.
 %    \begin{macrocode}
@@ -14439,14 +14533,14 @@
              {\POE@trefnodeA}{\POE@trefnodeB}%
       \ifx\POE@key@position\@empty
         \ifx\POE@key@abspos\@empty
-          \ncput[nrot=:U,npos=]{\POE@putlabelrelative{#1}}%
+          \ncput[nrot=:U,npos=]{\POE@putlabelrelative{\oelabel{#1}}}%
         \else
           \POE@nlput[nrot=:U](\POE@trefnodeA)(\POE@trefnodeB)%
-            {\POE@key@abspos}{\POE@putlabelrelative{#1}}%
+            {\POE@key@abspos}{\POE@putlabelrelative{\oelabel{#1}}}%
         \fi
       \else
         \ncput[nrot=:U, npos=\POE@key@position]%
-          {\POE@putlabelrelative{#1}}%
+          {\POE@putlabelrelative{\oelabel{#1}}}%
       \fi
     \endgroup
   \fi\fi\fi
@@ -14976,10 +15070,10 @@
                dimen=outer](! \@ht 4 div 0)%
                            (! \@ht -4 div \@ht 2.5 div)
       \ifx\POE@key@extnode\@empty
-        \psbezier(! 0 \@ht 2.5 div)%
-                 (! 0 \@ht 1.5 div)%
-                 (! \@ht 2 div \@ht 2 div)%
-                 (! \@ht 4 div \@ht)
+        \psbezier[fillstyle=none](! 0 \@ht 2.5 div)%
+                                 (! 0 \@ht 1.5 div)%
+                                 (! \@ht 2 div \@ht 2 div)%
+                                 (! \@ht 4 div \@ht)
       \fi
     \else\ifx\POE@key@mirrortype\POE@str@mirrortype@extended
       \psframe[style=ExtendedMirror]%
@@ -15046,7 +15140,7 @@
 % draw the reflective interface
 %    \begin{macrocode}
     \bgroup
-      \psset{linewidth=\POE@key@mirrorlinewidth}
+      \psset{linewidth=\POE@key@mirrorlinewidth, fillstyle=none}
       \begin@OpenObj
         \addto@pscode{\POE@dict{ \@ht \@r rightCurvedIfc \@postcode }}%
       \end@OpenObj
@@ -15393,11 +15487,11 @@
     \pscircle[fillstyle=none](0,0){0.12}
   \fi
   \ifx\POE@key@poltype\POE@str@pol@polrcirc
-    \psellipticarc[arrows=->]%
+    \psellipticarc[fillstyle=none, arrows=->]%
       (0,0)(! \@sz 2 div \@sz){20}{-20}
   \fi
   \ifx\POE@key@poltype\POE@str@pol@pollcirc
-    \psellipticarc[arrows=<-]%
+    \psellipticarc[fillstyle=none, arrows=<-]%
       (0,0)(! \@sz 2 div \@sz){20}{-20}
   \fi
 \ignorespaces}%
@@ -15911,6 +16005,8 @@
 % \begin{macro}{\optmzm@comp}
 %    \begin{macrocode}
 \def\optmzm@comp{%
+  \psframe[dimen=outer](! \POE@dict{@@x neg @@y neg})%
+                       (!\POE@dict{@@x @@y})
   \bgroup
     \ifPOE@usefiberstyle
       \psset{style=Fiber, arrows=-, ArrowInside=-}
@@ -15924,8 +16020,6 @@
            (! \POE@dict{@@x -0.4 mul @@y -0.6 mul})%
            (! \POE@dict{@@x} -0.7 mul 0)%
   \egroup
-  \psframe[dimen=outer](! \POE@dict{@@x neg @@y neg})%
-                       (!\POE@dict{@@x @@y})
 \ignorespaces}%
 %    \end{macrocode}
 % \end{macro}
@@ -16140,7 +16234,10 @@
 % \begin{macro}{\optswitch@ref}
 %    \begin{macrocode}
 \def\optswitch@ref{%
-  \POE@setref{\POE@key@switchsize\space 0.5 mul dup /@@y ED /@@x ED }%
+  \POE@setref{%
+    /@@x \POE@key@switchwidth\space 0.5 mul def
+    /@@y \POE@key@switchheight\space 0.5 mul def
+  }%
 }%
 %    \end{macrocode}
 % \end{macro}
@@ -16148,6 +16245,8 @@
 % \begin{macro}{\optswitch@comp}
 %    \begin{macrocode}
 \def\optswitch@comp{%
+  \psframe[dimen=outer](! \POE@dict{@@x neg @@y neg})%
+                       (! \POE@dict{@@x @@y})%
 %    \end{macrocode}
 % storing the linewidth of the object allows for some aesthetic fine tuning 
 %    \begin{macrocode}
@@ -16177,8 +16276,6 @@
     \pscircle(! \POE@dict{@@x} -0.6 mul 0){\pslinewidth}%
     \psdot[dotsize=3\pslinewidth](! \POE@dict{@@x} 0.6 mul 0)%
   \fi
-  \psframe[dimen=outer](! \POE@dict{@@x neg @@y neg})%
-                       (! \POE@dict{@@x @@y})%
 \ignorespaces}%
 %    \end{macrocode}
 % \end{macro}
@@ -16280,7 +16377,7 @@
     {@@x neg @@y0 \@sep sub}
     {@@x @@y0 \@sep add}
     {@@x @@y0 \@sep sub} }%
-  \pnode(! 0 \POE@dict{@@y0}){\oenodeCenter{}}
+  \pnode(0,0){\oenodeCenter{}}
 }%
 %    \end{macrocode}
 % \end{macro}
@@ -16398,7 +16495,7 @@
     {@@x neg @@y0 \@sep add}
     {@@x neg  @@y0 \@sep sub}
     {@@x 0}}%
-  \pnode(! 0 \POE@dict{@@y0}){\oenodeCenter{}}
+  \pnode(0,0){\oenodeCenter{}}
 }%
 %    \end{macrocode}
 % \end{macro}
@@ -16440,7 +16537,7 @@
     {@@x neg 0}
     {@@x @@y0 \@sep add}
     {@@x @@y0 \@sep sub}}
-  \pnode(! 0 \POE@dict{@@y0}){\oenodeCenter{}}
+  \pnode(0,0){\oenodeCenter{}}
 }%
 %    \end{macrocode}
 % \end{macro}
@@ -16640,7 +16737,16 @@ tx@OptexpDict begin
 %   \opt{pswarning}.
 %    \begin{macrocode}
 /PrintWarning {
-  (Warning: ) exch strcat ==
+  (Warning pst-optexp: ) exch strcat ==
+} bind def
+/CompUnknownWarning {
+  (Component ') exch strcat (' unknown) strcat PrintWarning
+} bind def
+/OneFiberCompWarning {
+  (Found only one fiber component in beam path, drawing no beam) PrintWarning
+} bind def
+/FiberCompWarning {
+  (Found a fiber component in beam path, stopping beam path) PrintWarning
 } bind def
 %    \end{macrocode}
 % \end{macro}
@@ -17607,7 +17713,7 @@ tx@OptexpDict begin
   currentdict /lastVecTmp known {
     lastVecTmp beamangle matrix rotate dtransform ToVec
   } {
-    beamalign relative eq counttomark 2 ge and {
+    counttomark 2 ge beamalign relative eq and {
       2 copy /InVec load TransformInVec
     } {
       /InVec load
@@ -18139,9 +18245,16 @@ tx@OptexpDict begin
 %    \begin{macrocode}
 /isFreeray { 
   cvn load /n known 
-  dup not {
-    (Encountered fiber component in beam path) Warning
-  } if
+} bind def
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{/compIsKnown}
+% Check if a component is known.
+%    \begin{macrocode}
+/compIsKnown {
+  dup type /stringtype eq { cvn } if
+  tx@OptexpDict exch known
 } bind def
 %    \end{macrocode}
 % \end{macro}
@@ -18154,36 +18267,82 @@ tx@OptexpDict begin
 %    \begin{macrocode}
 /PrearrangePlanes {
   (PrearrangePlanes) DebugBegin
-  counttomark /N ED
-  /CompA ED dup /CompB ED
-  CompA isFreeray {
-    CompA isAmbiguous {
-      amb dup CompA
-    } {
-      CompB isAmbiguous {
-        1 CompA GetIfcCenter (C) CompB GetIfcCenter @ABDist
-        (N) CompA GetIfcCenter (C) CompB GetIfcCenter @ABDist
-      } {
-        1 CompA GetIfcCenter 
-        1 CompB GetIfcCenter 
-        (N) CompB GetIfcCenter 
-        true OrderNodes exch pop
-        (N) CompA GetIfcCenter 
-        1 CompB GetIfcCenter 
-        (N) CompB GetIfcCenter 
-        true OrderNodes exch pop
+  counttomark dup 2 lt {
+    dup 0 eq { 
+      (Found no component on stack, drawing no beam) PrintWarning
+    }{
+%    \end{macrocode}
+% Only one component, draw always in ascending order. We must still
+% check in /PushAllPlanesOnStack if the component has only one
+% interface.
+%    \begin{macrocode}
+      exch dup
+      compIsKnown {
+        dup isFreeray {
+          asc exch 3 -1 roll
+        }{
+          OneFiberCompWarning
+          pop
+        } ifelse
+      }{
+        CompUnknownWarning
       } ifelse
-      le { desc } { asc } ifelse dup CompA
     } ifelse
-    counttomark 2 roll
-  } {
-    counttomark 1 sub { pop } repeat
     /N 0 def
+  }{
+%    \end{macrocode}
+% We have a minimum of two components on stack
+%    \begin{macrocode}
+    /N ED
+    /CompA ED dup /CompB ED
+%    \end{macrocode}
+% Check, if the components have been defined
+%    \begin{macrocode}
+    CompA compIsKnown CompB compIsKnown and {
+      CompA isFreeray {
+        CompA isAmbiguous {
+          amb dup CompA
+        } {
+          CompB isAmbiguous {
+            1 CompA GetIfcCenter (C) CompB GetIfcCenter @ABDist
+            (N) CompA GetIfcCenter (C) CompB GetIfcCenter @ABDist
+          } {
+            1 CompA GetIfcCenter 
+            1 CompB GetIfcCenter 
+            (N) CompB GetIfcCenter 
+            true OrderNodes exch pop
+            (N) CompA GetIfcCenter 
+            1 CompB GetIfcCenter 
+            (N) CompB GetIfcCenter 
+            true OrderNodes exch pop
+          } ifelse
+          le { desc } { asc } ifelse dup CompA
+        } ifelse
+        counttomark 2 roll
+      }{
+        FiberCompWarning
+        counttomark 1 sub { pop } repeat
+        /N 0 def
+      } ifelse
+    }{
+%    \end{macrocode}
+% One of the first two components was not defined, do not draw any beam
+%    \begin{macrocode}
+      /N 0 def
+      CompA compIsKnown not {CompA}{CompB} ifelse
+      CompUnknownWarning
+    } ifelse
   } ifelse
   2 1 N {
     /i ED exch /CompB ED
+    CompB compIsKnown not {
+      counttomark i 1 sub 2 mul 1 add sub { pop } repeat
+      CompB CompUnknownWarning
+      exit
+    } if
     CompB isFreeray not {
       counttomark i 1 sub 2 mul 1 add sub { pop } repeat
+      FiberCompWarning
       exit
     } if
     CompB isAmbiguous not {
@@ -18254,7 +18413,8 @@ tx@OptexpDict begin
 % 
 % \begin{macro}{PushAllPlanesOnStack}
 %   \begin{pssyntax}
-%     \PSvar{[} \PSvar{desc|asc} \PSstring{CompN} \PSvar{\ldots} \PSvar{desc|asc} \PSstring{Comp1} \PSop{PushAllPlanesOnStack}
+%     \PSvar{[} \PSvar{desc|asc} \PSstring{CompN} \PSvar{\ldots} \PSvar{desc|asc} \PSstring{Comp1} 
+%     \PSop{PushAllPlanesOnStack}
 %     \PSvar{[} \PSproc{PN \PSstring{CompName} n mode draw?} \PSvar{\ldots{}}
 %   \end{pssyntax}
 %   \begin{psarglist}
@@ -18362,6 +18522,7 @@ tx@OptexpDict begin
     } ifelse
   } for
   DebugEnd
+  counttomark 1 eq { pop } if
 } bind def
 %    \end{macrocode}
 % \end{macro}
-- 
cgit v1.2.3

