summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/sseq
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/sseq')
-rw-r--r--Master/texmf-dist/tex/latex/sseq/sseq.sty1486
1 files changed, 948 insertions, 538 deletions
diff --git a/Master/texmf-dist/tex/latex/sseq/sseq.sty b/Master/texmf-dist/tex/latex/sseq/sseq.sty
index 17ae3957ccd..c57d7549b78 100644
--- a/Master/texmf-dist/tex/latex/sseq/sseq.sty
+++ b/Master/texmf-dist/tex/latex/sseq/sseq.sty
@@ -23,86 +23,81 @@
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{sseq}
+\ProvidesPackage{sseq}[2009/04/09 ver 2.0]
\RequirePackage{ifthen,calc,pifont}
+\RequirePackage{pgf}[2006/01/01]
+\RequirePackage{xkeyval}
+\usepgflibrary{snakes}
-\newboolean{usesps}
-\setboolean{usesps}{true}
\newboolean{usescolor}
\setboolean{usescolor}{true}
\newboolean{debug}
\setboolean{debug}{false}
-\DeclareOption{ps}{\setboolean{usesps}{true}}
-\DeclareOption{nops}{\setboolean{usesps}{false}}
+\DeclareOption{ps}{\errmessage{sseq: ps/nops is deprecated}}
+\DeclareOption{nops}{\errmessage{sseq: ps/nops is deprecated}}
+\DeclareOption{dvips}{\errmessage{sseq: deprecated option dvips ignored}}
+\DeclareOption{xdvi}{\errmessage{sseq: deprecated option xdvi ignored}}
\DeclareOption{color}{\setboolean{usescolor}{true}}
\DeclareOption{nocolor}{\setboolean{usescolor}{false}}
\DeclareOption{debug}{\setboolean{debug}{true}}
-\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{xy}}
\ProcessOptions
-\ifx\xyloaded\undefined \RequirePackage[curve,frame]{xy} \fi
-
-\ifthenelse{\boolean{usesps}}{\xyrequire{ps}}{}
-\ifthenelse{\boolean{usescolor}}{\xyrequire{color}}{}
-
-\newsavebox{\sseqcircledone}
-\newsavebox{\sseqcircledtwo}
-\newsavebox{\sseqcircledthree}
-\newsavebox{\sseqcircledfour}
-\newsavebox{\sseqcircledfive}
-\newsavebox{\sseqcircledsix}
-\newsavebox{\sseqcircledseven}
-\newsavebox{\sseqcircledeight}
-\newsavebox{\sseqcirclednine}
-\sbox{\sseqcircledone}{\ding{192}}
-\sbox{\sseqcircledtwo}{\ding{193}}
-\sbox{\sseqcircledthree}{\ding{194}}
-\sbox{\sseqcircledfour}{\ding{195}}
-\sbox{\sseqcircledfive}{\ding{196}}
-\sbox{\sseqcircledsix}{\ding{197}}
-\sbox{\sseqcircledseven}{\ding{198}}
-\sbox{\sseqcircledeight}{\ding{199}}
-\sbox{\sseqcirclednine}{\ding{200}}
-\newboolean{sseqhasfinishedpos}
-\setboolean{sseqhasfinishedpos}{true}
+
+\def\sseq@currentname{}
+\def\sseq@previousname{}
+
\newboolean{sseqhasopenconn}
\setboolean{sseqhasopenconn}{false}
\newboolean{sseqclip}
\setboolean{sseqclip}{true}
-\newboolean{sseqprevclip}\setboolean{sseqprevclip}{false}
-\newboolean{sseqcurrclip}\setboolean{sseqcurrclip}{false}
\def\sseqconncommand{}
+\def\sseq@connbuffer{}
+\def\sseq@currarrowstart{}
+\def\sseq@currarrowend{}
+
+\newif\ifsseq@connreverse
\ifthenelse{\boolean{usescolor}}
{
- \newxyColor{sseqgr}{0.65}{gray}{}
- \newxycolor{ssred}{Red}
- \newxycolor{ssblack}{Black}
+ \definecolor{sseqgr}{gray}{0.65}
+ \definecolor{sslightgr}{gray}{0.8}
+ \definecolor{ssred}{rgb}{1,0,0}
+ \definecolor{ssblack}{rgb}{0,0,0}
}{}
\newcommand{\ssconncolor}{ssblack}
\newcommand{\sslabelcolor}{ssblack}
\newcommand{\ssplacecolor}{ssblack}
-\def\ssoldconncolor{ssblack}
+
+\def\sseqpacking{\sspacksmart}
%% ^^A Initialization
\newcount\sseqxstart \sseqxstart=0
\newcount\sseqystart \sseqystart=0
-\newcount\sseqxstep \sseqxstep=2
-\newcount\sseqystep \sseqystep=2
-\newdimen\sseqentrysize \sseqentrysize=0.4cm
+\newcount\sseqxstep
+\newcount\sseqystep
+\newdimen\sseqentrysize
+\newdimen\sseq@xgap
+\newdimen\sseq@ygap
+\newdimen\sseq@xleak
+\newdimen\sseq@yleak
+\newdimen\ss@currsep \ss@currsep=\pgfshapeinnerxsep
+\newdimen\ss@size
+\newdimen\sseq@gridstrokethickness
+
+\newsavebox\sseq@labelbox
+
\newif\ifssclipped
+\newif\ifcurroutofrange
\newtoks\sseqcmdlist
\sseqcmdlist={}
\def\currprefix{}
-\def\sseqcurrentname{}
-
\long\def\ntimes#1#2{
\ifnum#1>0
#2
@@ -113,36 +108,147 @@
\fi
}
-\newif\ifforcondition
+\long\def\for #1=#2\to#3\do#4\od{#1=#2 \sseq@for #1\to #3\do #4\od}
+\long\def\sseq@for #1\to #2\do #3\od{%
+ \ifnum #1>#2 \else
+ #3\relax
+ \advance #1 by 1
+ \def\tempcmd{\sseq@for #1\to #2\do #3\od}%
+ \expandafter\tempcmd
+ \fi
+}
+
+\def\@eval#1#2{%
+ \edef\tempcmd{\noexpand#1#2}%
+ \tempcmd
+}
+\def\range@endmarker{END}
+\def\range@parseandnormalize#1#2#3{\def#1{}\range@parseandnormalizeinnerloop{#1}{#2}{-10000}#3,END,}
+\def\range@parseandnormalizeinnerloop#1#2#3#4,{%
+ \def\temp{#4}%
+ \ifx\temp\range@endmarker
+ \edef #1{#1END;END,}%
+ \else
+ \def\tempoutercmd{\range@parseinnerpart{#1}{#2}{#3}#4...END...}%
+ \expandafter\tempoutercmd
+ \fi
+}
+\def\range@parseinnerpart#1#2#3#4...#5...{%
+ \def\temp{#5}
+ \ifx\temp\range@endmarker
+ \count0=#2
+ \advance\count0 by #4
+ \advance\count0 by -1
+ \edef\tempcmd{\noexpand\range@parseinnerpart{\noexpand#1}{#2}{#3}#2...\number\count0...END...}
+ \else
+ \count0=#3
+ \count1=#4
+ \count2=#5
+ \ifnum\count1<\count0
+ \PackageError{sseq}{Illegal stepping in range}{In a range a...b,c...d, c has to be >= b+2. In your case, b+2=#3 and c=#4. I'll replace c by #3.}
+ \count1=#3
+ \fi
+ \ifnum\count2<\count1
+ \PackageError{sseq}{Illegal range}{In a range a...b, b has to be at least as big as a. In your case, a=\number\count1 and b=#5. I'll replace b by \number\count1.}
+ \count2=\count1
+ \fi
+ \count0=\count2
+ \advance\count0 by 2
+ \edef#1{#1\number\count1;\number\count2,}
+ \edef\tempcmd{\noexpand\range@parsegobbleend{\noexpand#1}{#2}{\number\count0}}
+ \fi
+ \tempcmd
+}
+\def\range@parsegobbleend#1#2#3#4...{%
+\range@parseandnormalizeinnerloop{#1}{#2}{#3}%
+}
+\newif\ifrangebreak
+\def\range@loop#1#2;#3,{
+ \rangebreakfalse
+ \def\temp{#2}
+ \def\tempcmd{}
+ \ifx\temp\range@endmarker\else
+ #1{#2}{#3}
+ \advance\sseqj by 1
+ \ifrangebreak
+ \def\tempcmd{\range@gobbletoend}
+ \else
+ \def\tempcmd{\range@loop{#1}}
+ \fi
+ \fi
+ \tempcmd
+}
+\newif\ifoutofrange
+\def\range@getabsoluteposition#1#2#3#4#5;#6,{
+ \outofrangefalse
+ \def\temp{#5}
+ \def\tempcmd{}
+ \count0=#1
+ \ifx\temp\range@endmarker
+ \outofrangetrue
+ \else % ^^A now #4 contains the current min and #5 the current max
+ \ifnum\count0<#5
+ \outofrangetrue
+ \def\tempcmd{\range@gobbletoend}
+ \else
+ \ifnum\count0>#6
+ \count0=#6
+ \advance\count0 by 1
+ \count1=#5
+ \multiply\count1 by -1
+ \advance\count0 by \count1
+ \dimen0=#2
+ \multiply\dimen0 by \count0
+ \advance\dimen0 by #4
+ \advance\dimen0 by #3
+ \edef\tempcmd{\noexpand\range@getabsoluteposition{#1}{#2}{#3}{\number\dimen0sp}}
+ \else
+ \count1=#5
+ \multiply\count1 by -1
+ \advance\count0 by \count1
+ \dimen0=#2
+ \multiply\dimen0 by \count0
+ \advance\dimen0 by #4
+ \def\tempcmd{\range@gobbletoend}
+ \fi
+ \fi
+ \fi
+ \tempcmd
+}
+\def\range@gobbletoend#1END,{}
-\long\def\for#1=#2\to#3\do#4\od{
-#1=#2
-\loop
-\ifnum#1>#3\forconditionfalse\else\forconditiontrue\fi
-\ifforcondition
- #4
- \advance #1 by 1
- \repeat
+\def\ss@getcoords#1#2{
+ \edef\tempcmd{\noexpand\range@getabsoluteposition{#1}{\number\sseqentrysize sp}{\number\sseq@xgap sp}{0pt}}
+ \expandafter\tempcmd\sseq@xrange
+ \sseqx=\dimen0
+ \edef\tempcmd{\noexpand\range@getabsoluteposition{#2}{\number\sseqentrysize sp}{\number\sseq@ygap sp}{0pt}}
+ \ifoutofrange
+ \expandafter\tempcmd\sseq@yrange
+ \outofrangetrue
+ \else
+ \expandafter\tempcmd\sseq@yrange
+ \fi
+ \sseqy=\dimen0
}
\def\putxyq#1{\toks0={#1}%
- \edef\act{\noexpand\sseqcmdlist={\the\sseqcmdlist \the\toks0}}
+ \edef\act{\noexpand\sseqcmdlist={\the\sseqcmdlist \the\toks0}}%
\act
}
\def\putxy#1{%
- \edef\act{\noexpand\sseqcmdlist={\the\sseqcmdlist #1}}
+ \edef\act{\noexpand\sseqcmdlist={\the\sseqcmdlist #1}}%
\act
}
\def\sseqwritecolor#1{
\ifthenelse{\boolean{usescolor}}{
- \putxy {[#1]}
+ \putxy{\noexpand\color{#1}}
}{}
}
\def\sseqconcludeconnection{
-\sseqconncommand
-\setboolean{sseqhasopenconn}{false}
+ \sseqconncommand
+ \setboolean{sseqhasopenconn}{false}
}
\def\dropvarname#1#2{\csname sseqdrop#1,#2\endcsname}
@@ -164,59 +270,114 @@
\PackageError{sseq}{cannot open position (#1,#2): multiple drops}{You cannot specify this position by coordinates. Instead, name it.}
\fi
}
-
-\def\ssopenposition#1#2{
-\ifuniquedrop{#1}{#2}
- \def\sseqcurrentname{ss(#1,#2)1}
- \putxy{"\sseqcurrentname"}
-\else \ssdroperrormsg{#1}{#2}
-\fi
-\setboolean{sseqhasfinishedpos}{false}
+\def\sseq@updatecurrentdata{
+ \@eval\ss@getcoords{{\number\sseqposx}{\number\sseqposy}}
+ \sseqabsposx=\sseqx
+ \sseqabsposy=\sseqy
+ \let\ifcurroutofrange\ifoutofrange
}
-\newcommand{\ssassertsource}{
-\ifthenelse{\boolean{sseqhasfinishedpos}}{
-\ssopenposition{\the\sseqposx}{\the\sseqposy}
-}
-{}
+\def\sseq@openposition{
+ \ifuniquedrop{\the\sseqposx}{\the\sseqposy}
+ \edef\sseq@currentname{ss(\number\sseqposx,\number\sseqposy)1}
+ \else
+ \ssdroperrormsg{\the\sseqposx}{\the\sseqposy}
+ \def\sseq@currentname{}
+ \fi
}
-\newcommand{\ssputsemicolon}{
-\putxy{;}
-\ifthenelse{\boolean{sseqcurrclip}}{
- \setboolean{sseqprevclip}{true}}{
- \setboolean{sseqprevclip}{false}}
+\def\ssassertsource{
+ \sseq@flushconn
+ \ifx\sseq@currentname\empty
+ \sseq@openposition
+ \fi
}
-\newcommand{\ssfinishpos}{
-\ifthenelse{\boolean{sseqhasfinishedpos}}{}{
-\setboolean{sseqhasfinishedpos}{true}
-\ssputsemicolon
+\def\ssfinishpos{
+ \sseq@flushconn
+ \ifx\sseq@currentname\empty
+ \else
+ \ifthenelse{\boolean{sseqhasopenconn}}
+ {
+ \sseqconcludeconnection
+ }{}
+ \edef\sseq@previousname{\sseq@currentname}
+ \def\sseq@currentname{}
+ \fi
}
-\ifthenelse{\boolean{sseqhasopenconn}}
-{
- \ssopenposition{\the\sseqposx}{\the\sseqposy}
- \sseqconcludeconnection
- \ifthenelse{\boolean{sseqhasfinishedpos}}{}{
- \setboolean{sseqhasfinishedpos}{true}
- \ssputsemicolon}
-}{}
+
+\def\sspacksmart#1#2{
+ \ifcase\count11
+ % ^^A 0
+ \PackageError{sseq}{This can't happen!}{Internal error. Contact the author.}
+ \or % ^^A 1
+ \sseqrearrange{#1}{#2}{\the\count1}{\the\dimen6}{\the\dimen5}
+ \advance\sseqx by \dimen5
+ \advance\sseqy by \dimen6
+ \or % ^^A 2
+ \sseqrearrange{#1}{#2}{\the\count2}{0pt}{\the\dimen5}
+ \sseqrearrange{#1}{#2}{\the\count2}{0pt}{\the\dimen5}
+ \advance\sseqy by \dimen6
+ \or % ^^A 3
+ \sseqrearrange{#1}{#2}{\the\count3}{\the\dimen6}{0pt}
+ \advance\sseqx by \dimen5
+ \advance\sseqy by \dimen6
+ \or % ^^A 4 -- give up on being clever and put everything in one diagonal row.
+ \sseqrearrange{#1}{#2}{\the\count2}{\the\dimen6}{\the\dimen6}
+ \sseqrearrange{#1}{#2}{\the\count3}{\the\dimen5}{0pt}
+ \sseqrearrange{#1}{#2}{\the\count3}{\the\dimen5}{0pt}
+ \sseqrearrange{#1}{#2}{\the\count4}{\the\dimen5}{\the\dimen6}
+ \advance\sseqx by \dimen5
+ \advance\sseqx by \dimen5
+ \advance\sseqx by \dimen5
+ \advance\sseqy by \dimen6
+ \advance\sseqy by \dimen6
+ \advance\sseqy by \dimen6
+ \else
+ \advance\count11 by -1
+ \multiply\dimen5 by \count11
+ \multiply\dimen6 by \count11
+ \advance\sseqx by \dimen5
+ \advance\sseqy by \dimen6
+ \fi
}
-\newcommand{\ssnewpos}{
-\ssfinishpos
-\setboolean{sseqhasfinishedpos}{false}
+\def\sspackhorizontal#1#2{
+ \divide\dimen6 by 2
+ \divide\dimen5 by 2
+ \for\count10=1 \to \count11 \do
+ \sseqrearrange{#1}{#2}{\the\count\count10}{\the\dimen6}{0pt}
+ \od
+ \multiply\dimen5 by \count11
+ \advance\sseqx by \dimen5
+}
+\def\sspackvertical#1#2{
+ \divide\dimen6 by 2
+ \divide\dimen5 by 2
+ \for\count10=1 \to \count11 \do
+ \sseqrearrange{#1}{#2}{\the\count\count10}{0pt}{\the\dimen6}
+ \od
+ \multiply\dimen5 by \count11
+ \advance\sseqy by \dimen5
+}
+\def\sspackdiagonal#1#2{
+ \divide\dimen6 by 2
+ \divide\dimen5 by 2
+ \for\count10=1 \to \count11 \do
+ \sseqrearrange{#1}{#2}{\the\count\count10}{\the\dimen6}{\the\dimen5}
+ \od
+ \multiply\dimen5 by \count11
+ \multiply\dimen6 by \count11
+ \advance\sseqx by \dimen5
+ \advance\sseqy by \dimen6
}
-\def\ssifposinclippingregion#1#2{
- \ssclippedtrue
- \ifthenelse{\boolean{sseqclip}}{
- \ifnum#1<\sseqxstart \ssclippedfalse \fi
- \ifnum#1<\sseqxend \else \ssclippedfalse \fi
- \ifnum#2<\sseqystart \ssclippedfalse \fi
- \ifnum#2<\sseqyend \else \ssclippedfalse \fi
- }{}
- \ifssclipped
+\def\sseqpack#1#2{
+\expandafter\ifx\sseqpacking\ssequndefined
+ \PackageError{sseq}{Unknown packing option, reverting to \string\sspacksmart}{You apparently have redefined \string\sspacksmart. The only allowed values are: \string\sspacksmart,\string\sspackhorizontal,\string\sspackdiagonal,\string\sspackvertical.}
+ \gdef\sseqpacking{\sspacksmart}
+\fi
+\sseqpacking{#1}{#2}
}
\def\sseqrearrange#1#2#3#4#5{
@@ -240,44 +401,32 @@
\expandafter\count\the\count11=\count10
\fi
\od
- % ^^A Now count11 contains the number of previously dropped objects that have to be rearranged.
- \ifcase\count11
- % ^^A 0
- \PackageError{sseq}{This can't happen!}{Internal error. Contact the author.}
- \or % ^^A 1
- \sseqrearrange{#1}{#2}{\the\count1}{\the\dimen6}{\the\dimen5}
- \advance\sseqx by \dimen5
- \advance\sseqy by \dimen6
- \or % ^^A 2
- \sseqrearrange{#1}{#2}{\the\count2}{0pt}{\the\dimen5}
- \sseqrearrange{#1}{#2}{\the\count2}{0pt}{\the\dimen5}
- \advance\sseqy by \dimen6
- \or % ^^A 3
- \sseqrearrange{#1}{#2}{\the\count3}{\the\dimen6}{0pt}
- \advance\sseqx by \dimen5
+ \ifnum\count11<9
\else
- \PackageError{sseq}{Too many drops at (#1,#2)}{The sseq.sty algorithm can only place up to four independent drops in one position.}
+ \PackageError{sseq}{Too many drops at (#1,#2)}{The sseq.sty algorithm can only place up to nine independent drops in one position.}
\fi
+ \sseqpack{#1}{#2}
}
-\newcommand{\ssplacespecial}[4]{
-\ifthenelse{\boolean{sseqhasfinishedpos}}{}{
- \ssputsemicolon
-}
-\setboolean{sseqhasfinishedpos}{false}
-\sseqx=\sseqentrysize
-\multiply\sseqx \sseqxdir
-\multiply\sseqx by #1
-\advance\sseqx by \sseqhalfentry
-\advance\sseqx by \sseqoffsetx
-\advance\sseqx by \sseqoffx
-\sseqy=\sseqentrysize
-\multiply\sseqy \sseqydir
-\multiply\sseqy by #2
-\advance\sseqy by \sseqhalfentry
-\advance\sseqy by \sseqoffsety
-\advance\sseqy by \sseqoffy
-\expandafter\def\expandafter\tmpname\expandafter{\csname sseqdrop#1,#2\endcsname}
+\def\ss@setshapesep#1{
+ \ifdim\ss@currsep=#1\else
+ \putxy{\noexpand\pgfsetshapeinnerxsep{#1}\noexpand\pgfsetshapeinnerysep{#1}}
+ \ss@currsep=#1
+ \fi
+}
+
+\def\sseq@setcircumference{
+ \expandafter\ss@size\expandafter=\expandafter\csname\sseq@currentname size\endcsname
+ \advance\ss@size by 1pt
+ \ss@setshapesep{\the\ss@size}
+}
+
+\def\ss@placespecial#1#2#3#4#5{
+ \ssfinishpos
+ \ss@getcoords{#1}{#2}
+ \advance\sseqx by \sseqhalfentry
+ \advance\sseqy by \sseqhalfentry
+ \expandafter\def\expandafter\tmpname\expandafter{\csname sseqdrop#1,#2\endcsname}
\ifnodrop{#1}{#2}
\expandafter\def\tmpname{1}
\else
@@ -287,114 +436,136 @@
\advance\count0 by 1
\expandafter\edef\tmpname{\the\count0}
\fi
-\putxy{<\csname sseqcoordx<#1,#2>\tmpname\endcsname,\csname sseqcoordy<#1,#2>\tmpname \endcsname>}
+\putxyq{\pgftransformshift}
+\putxy{{\noexpand\pgfpoint{\csname sseqcoordx<#1,#2>\tmpname\endcsname}{\csname sseqcoordy<#1,#2>\tmpname \endcsname}}}
+\ifoutofrange % ^^A Outside clipping region -- produce an empty node
+ \putxyq{\pgfnode{coordinate}{center}{}}
+ % ^^A now give it a unique name
+ \putxy{{ss(#1,#2)\tmpname}}
+ \putxyq{{}}
+\else
+ \sseqwritecolor{\ssplacecolor}
+ \putxyq{\pgfnode{#3}{center}}
+ \putxyq{{#5}}
+ \putxy{{ss(#1,#2)\tmpname}}
+ \putxyq{{#4}}
+\fi
+\putxyq{\pgftransformreset}
+\def\temp{#5}
+\ifx\temp\empty % ^^A It's a bullet or a circle or such
+ \dimen0=1pt
+\else
+ \setbox0=\hbox{#5}
+ \dimen0=0.5\wd0
+\fi
\expandafter\edef\csname sseqcoordx<#1,#2>\tmpname\endcsname{\the\sseqx}
\expandafter\edef\csname sseqcoordy<#1,#2>\tmpname\endcsname{\the\sseqy}
+\expandafter\edef\csname ss(#1,#2)\tmpname size\endcsname{\number\dimen0 sp}
\expandafter\def\csname sseqwillmove<#1,#2>\tmpname\endcsname{1}
-\setboolean{sseqcurrclip}{true}
-\ssifposinclippingregion{#1}{#2}
- \setboolean{sseqcurrclip}{false}
- \putxy{*#3}
- \sseqwritecolor{\ssplacecolor}
- \putxy{#4}
-\fi
-\edef\sseqcurrentname{ss(#1,#2)\tmpname}
-\putxy{="\sseqcurrentname"}
+\edef\sseq@currentname{ss(#1,#2)\tmpname}
\ifthenelse{\boolean{sseqhasopenconn}}{\sseqconcludeconnection}{}
}
\newcommand{\ssplace}[3]{
-\ssplacespecial{#1}{#2}{}{{#3}}
+ \ss@setshapesep{0pt}
+ \putxyq{\pgfsetdash{}{0pt}}
+ \ss@placespecial{#1}{#2}{rectangle}{\pgfusepath{discard}}{\ensuremath{#3}}
}
\newcommand{\ssplaceboxed}[3]{
- \ifthenelse{\boolean{usescolor}}{
- \ssplacespecial{#1}{#2}{+<2pt>[F:\ssplacecolor]}{{#3}}
- }{
- \ssplacespecial{#1}{#2}{+<2pt>}{{#3}}
- }
+ \ss@setshapesep{1pt}
+ \putxyq{\pgfsetdash{}{0pt}}
+ \ss@placespecial{#1}{#2}{rectangle}{\pgfusepath{stroke}}{\ensuremath{#3}}
}
\newcommand{\ssplacecircled}[3]{
-\ifthenelse{\equal{#3}{1}}{
- \ssplacespecial{#1}{#2}{}{[o]{\copy\sseqcircledone}}}{
- \ifthenelse{\equal{#3}{2}}{
- \ssplacespecial{#1}{#2}{}{[o]{\copy\sseqcircledtwo}}}{
- \ifthenelse{\equal{#3}{3}}{
- \ssplacespecial{#1}{#2}{}{[o]{\copy\sseqcircledthree}}}{
- \ifthenelse{\equal{#3}{4}}{
- \ssplacespecial{#1}{#2}{}{[o]{\copy\sseqcircledfour}}}{
- \ifthenelse{\equal{#3}{5}}{
- \ssplacespecial{#1}{#2}{}{[o]{\copy\sseqcircledfive}}}{
- \ifthenelse{\equal{#3}{6}}{
- \ssplacespecial{#1}{#2}{}{[o]{\copy\sseqcircledsix}}}{
- \ifthenelse{\equal{#3}{7}}{
- \ssplacespecial{#1}{#2}{}{[o]{\copy\sseqcircledseven}}}{
- \ifthenelse{\equal{#3}{8}}{
- \ssplacespecial{#1}{#2}{}{[o]{\copy\sseqcircledeight}}}{
- \ifthenelse{\equal{#3}{9}}{
- \ssplacespecial{#1}{#2}{}{[o]{\copy\sseqcirclednine}}}{
- \ifthenelse{\boolean{usescolor}}{
- \ssplacespecial{#1}{#2}{+<3pt>}{[o][F:\ssplacecolor]{#3}}
- }{
- \ssplacespecial{#1}{#2}{+<3pt>}{[o]{#3}}
- }
- }
- }
- }
- }
- }
- }
- }
- }
-}
-}
-
-\newcommand{\ssbull}[2]{
-\ifthenelse{\boolean{usescolor}}{
- \ssplacespecial{#1}{#2}{+<1.1mm>[o][F:\ssplacecolor]}{{}*[\ssplacecolor]\noexpand\frm{*}}
+ \ifthenelse{\equal{#3}{1}
+ \OR \equal{#3}{2}
+ \OR \equal{#3}{3}
+ \OR \equal{#3}{4}
+ \OR \equal{#3}{5}
+ \OR \equal{#3}{6}
+ \OR \equal{#3}{7}
+ \OR \equal{#3}{8}
+ \OR \equal{#3}{9}}{
+ \ss@setshapesep{-.3ex}
+ \count0=191
+ \advance\count0 by #3
+ \def\ss@tmpcmd{\ss@placespecial{#1}{#2}{circle}{\pgfusepath{discard}}}
+ \expandafter\ss@tmpcmd\expandafter{\expandafter\ding\expandafter{\the\count0}}
}{
- \ssplacespecial{#1}{#2}{+<1.1mm>[o]}{{}*\noexpand\frm{*}}
+ \putxyq{\pgfsetdash{}{0pt}}
+ \ss@setshapesep{0pt}
+ \ss@placespecial{#1}{#2}{circle}{\pgfusepath{stroke}}{\ensuremath{#3}}
}
}
-\newcommand{\sscirc}[2]{
-\ssplacespecial{#1}{#2}{}{[o]-={\circ}}
-}
-
\newcommand{\ssglobalname}[1]{\currprefix#1}
\def\sssetglobalname#1{
\ssassertsource
- \expandafter\edef\csname sseqpos<#1>\endcsname{\sseqcurrentname}
+ \expandafter\edef\csname sseqpos<#1>\endcsname{\sseq@currentname}
\expandafter\edef\csname sseqx<#1>\endcsname{\the\sseqposx}
\expandafter\edef\csname sseqy<#1>\endcsname{\the\sseqposy}
}
\newcommand{\ssmoveto}[2]{
+ \ifthenelse{\boolean{sseqhasopenconn}}
+ {
+ \sseqconcludeconnection
+ }{}
\ssfinishpos
\sseqposx=#1
\sseqposy=#2
-\ssifposinclippingregion{#1}{#2}
- \setboolean{sseqcurrclip}{false}
-\fi
+\sseq@updatecurrentdata
}
\newcommand{\ssmove}[2]{
-\count0=\sseqposx
-\advance\count0 by #1
-\count1=\sseqposy
-\advance\count1 by #2
-\ssmoveto{\count0}{\count1}
-}
-\newcommand{\ssdrop}[1]{
-\ssplace {\the\sseqposx} {\the\sseqposy} {#1}
-}
-\newcommand{\ssdropbull}{\ssbull {\the\sseqposx} {\the\sseqposy}}
-\newcommand{\ssdropboxed}[1]{
-\ssplaceboxed {\the\sseqposx} {\the\sseqposy} {#1}
-}
-\newcommand{\ssdropcircled}[1]{
-\ssplacecircled {\the\sseqposx} {\the\sseqposy} {#1}
+\sseqi=\sseqposx
+\advance\sseqi by #1
+\sseqj=\sseqposy
+\advance\sseqj by #2
+\@eval\ssmoveto{{\number\sseqi}{\number\sseqj}}
+}
+\define@key{sseqdrop}{circled}[true]{\newif\ifKV@sseqdrop@circled\csname KV@sseqdrop@circled#1\endcsname}
+\define@key{sseqdrop}{boxed}[true]{\newif\ifKV@sseqdrop@boxed\csname KV@sseqdrop@boxed#1\endcsname}
+\define@key{sseqdrop}{color}{\def\ssplacecolor{#1}}
+\define@key{sseqdrop}{name}{\def\sseq@name{#1}}
+\def\ssdrop{\@ifnextchar[\sseq@drop{\sseq@drop[]}}
+\def\sseq@drop[#1]#2{
+ \edef\sseq@savecolor{\ssplacecolor}
+ \def\sseq@name{\relax}
+ \presetkeys{sseqdrop}{circled=false,boxed=false}{}
+ \setkeys{sseqdrop}{#1}
+ \ifKV@sseqdrop@circled
+ \ssplacecircled{\number\sseqposx}{\number\sseqposy}{#2}
+ \else
+ \ifKV@sseqdrop@boxed
+ \ssplaceboxed{\number\sseqposx}{\number\sseqposy}{#2}
+ \else
+ \def\temp{#2}
+ \def\temptwo{\bullet}
+ \ifx\temp\temptwo
+ \ss@setshapesep{0pt}
+ \ss@placespecial{\number\sseqposx}{\number\sseqposy}{circle}{\pgfusepath{fill}}{}
+ \else
+ \def\temptwo{\circle}
+ \ifx\temp\temptwo
+ \ss@setshapesep{0pt}
+ \ss@placespecial{\number\sseqposx}{\number\sseqposy}{circle}{\pgfusepath{stroke}}{}
+ \else
+ \ssplace{\number\sseqposx}{\number\sseqposy}{#2}
+ \fi
+ \fi
+ \fi
+ \fi
+ \edef\ssplacecolor{\sseq@savecolor}
+ \def\temp{\relax}
+ \ifx\sseq@name\temp \else
+ \@eval\ssname{{\sseq@name}}
+ \fi
}
+\newcommand{\ssdropbull}{\ssdrop{\bullet}}
+\newcommand{\ssdropboxed}[1]{\ssdrop[boxed]{#1}}
+\newcommand{\ssdropcircled}[1]{\ssdrop[circled]{#1}}
\def\ssname#1{
\sssetglobalname{\ssglobalname{#1}}
}
@@ -406,182 +577,322 @@
}
\newcommand{\ssresetprefix}{\def\currprefix{}}
\newcommand{\ssabsgoto}[1]{
-\ssnewpos
-\edef\ssoldconncolor{\ssconncolor}
-\putxy{"\csname sseqpos<#1>\endcsname"}
-\sseqposx=\csname sseqx<#1>\endcsname
-\sseqposy=\csname sseqy<#1>\endcsname
-\ssifposinclippingregion{\the\sseqposx}{\the\sseqposy}
- \setboolean{sseqcurrclip}{false}
+ \ifthenelse{\boolean{sseqhasopenconn}}
+ {
+ \sseqconcludeconnection
+ }{}
+ \ssfinishpos
+ \edef\sseq@currentname{\csname sseqpos<#1>\endcsname}
+ \sseqposx=\csname sseqx<#1>\endcsname
+ \sseqposy=\csname sseqy<#1>\endcsname
+ \sseq@updatecurrentdata
+}
+\define@key{sseqlabel}{color}{\def\sslabelcolor{#1}}
+\define@key{sseqlabel}{pos}{\def\sseq@position{#1}}
+\define@key{sseqlabel}{U}[]{\def\sseq@position{U}}
+\define@key{sseqlabel}{LU}[]{\def\sseq@position{LU}}
+\define@key{sseqlabel}{L}[]{\def\sseq@position{L}}
+\define@key{sseqlabel}{LD}[]{\def\sseq@position{LD}}
+\define@key{sseqlabel}{D}[]{\def\sseq@position{D}}
+\define@key{sseqlabel}{RD}[]{\def\sseq@position{RD}}
+\define@key{sseqlabel}{R}[]{\def\sseq@position{R}}
+\define@key{sseqlabel}{RU}[]{\def\sseq@position{RU}}
+\def\ssdroplabel{\@ifnextchar[\sseq@droplabel{\sseq@droplabel[]}}
+\def\sseq@droplabel[#1]#2{
+\ssassertsource
+\ifcurroutofrange\else
+ \edef\sseq@savecolor{\sslabelcolor}
+ \def\sseq@position{L}
+ \setkeys{sseqlabel}{#1}
+ \ifthenelse{\equal{\sseq@position}{U}}{\def\sseq@anchor{north} \def\sseq@link{south}}{}
+ \ifthenelse{\equal{\sseq@position}{LU}}{\def\sseq@anchor{north west} \def\sseq@link{south east}}{}
+ \ifthenelse{\equal{\sseq@position}{L}}{\def\sseq@anchor{west} \def\sseq@link{east}}{}
+ \ifthenelse{\equal{\sseq@position}{LD}}{\def\sseq@anchor{south west} \def\sseq@link{north east}}{}
+ \ifthenelse{\equal{\sseq@position}{D}}{\def\sseq@anchor{south} \def\sseq@link{north}}{}
+ \ifthenelse{\equal{\sseq@position}{RD}}{\def\sseq@anchor{south east} \def\sseq@link{north west}}{}
+ \ifthenelse{\equal{\sseq@position}{R}}{\def\sseq@anchor{east} \def\sseq@link{west}}{}
+ \ifthenelse{\equal{\sseq@position}{RU}}{\def\sseq@anchor{north east} \def\sseq@link{south west}}{}
+ \sseqwritecolor{\sslabelcolor}
+ \putxyq{\pgftransformshift}
+ \putxy{{\noexpand\pgfpointanchor{\sseq@currentname}{\sseq@anchor}}}
+ \putxyq{\pgfnode{rectangle}}
+ \putxy{{\sseq@link}}
+ \putxyq{{\ensuremath{#2}}{}{\pgfusepath{discard}}}
+ \putxyq{\pgftransformreset}
+ \edef\sslabelcolor{\sseq@savecolor}
\fi
}
-\newcommand{\ssdroplabel}[2][U]{
-\ssassertsource
-\ssifposinclippingregion{\the\sseqposx}{\the\sseqposy}
- \putxy{="prev"}
- \ifthenelse{\boolean{usescolor}}{
- \ifthenelse{\equal{#1}{U}}{
- \putxy{+U*[\sslabelcolor]!D{#2}}}{}
- \ifthenelse{\equal{#1}{LU}}{
- \putxy{+LU*[\sslabelcolor]!RD{#2}}}{}
- \ifthenelse{\equal{#1}{RU}}{
- \putxy{+RU*[\sslabelcolor]!LD{#2}}}{}
- \ifthenelse{\equal{#1}{R}}{
- \putxy{+R*[\sslabelcolor]!L{#2}}}{}
- \ifthenelse{\equal{#1}{L}}{
- \putxy{+L*[\sslabelcolor]!R{#2}}}{}
- \ifthenelse{\equal{#1}{D}}{
- \putxy{+D*[\sslabelcolor]!U{#2}}}{}
- \ifthenelse{\equal{#1}{LD}}{
- \putxy{+LD*[\sslabelcolor]!RU{#2}}}{}
- \ifthenelse{\equal{#1}{RD}}{
- \putxy{+RD*[\sslabelcolor]!LU{#2}}}{}
+\def\ssdropextension{
+ \ssassertsource
+ \expandafter\def\expandafter\tmpname\expandafter{\csname sseqdrop\the\sseqposx,\the\sseqposy\endcsname}
+ \edef\setcnt{\noexpand\count0=\tmpname}
+ \setcnt
+ \advance\count0 by 1
+ \expandafter\edef\tmpname{\the\count0}
+ \putxyq{\pgftransformshift}
+ \putxy{{\noexpand\pgfpointanchor{\sseq@currentname}{center}}}
+ \ifoutofrange
+ \putxyq{\pgfnode{coordinate}{center}{}}
+ \putxy{{ss(\the\sseqposx,\the\sseqposy)\tmpname}{}}
+ \else
+ \sseqwritecolor{\ssplacecolor}
+ \sseq@setcircumference
+ \putxyq{\pgfnode{circle}{center}{}}
+ \putxy{{ss(\the\sseqposx,\the\sseqposy)\tmpname}}
+ \putxyq{{\pgfusepath{stroke}}}
+ \fi
+ \putxyq{\pgftransformreset}
+ \edef\sseq@currentname{ss(\number\sseqposx,\number\sseqposy)\tmpname}
+ \expandafter\edef\csname \sseq@currentname size\endcsname{\number\ss@size sp}
+ \ifthenelse{\boolean{sseqhasopenconn}}{\sseqconcludeconnection}{}
+}
+\def\ssprepareline#1#2{
+ \ssassertsource\ssfinishpos
+ \advance\sseqposx by #1
+ \advance\sseqposy by #2
+ \sseq@updatecurrentdata
+ \setboolean{sseqhasopenconn}{true}
+}
+\def\extractcoords ss(#1,#2)#3{{#1}{#2}}
+\def\sseq@flushconn{
+ \ifx\sseq@connbuffer\empty\else
+ \ifsseq@connreverse
+ \putxy{\noexpand\pgfsetarrows{\sseq@currarrowend-\sseq@currarrowstart}}
+ \else
+ \putxy{\noexpand\pgfsetarrows{\sseq@currarrowstart-\sseq@currarrowend}}
+ \fi
+ \sseq@connbuffer
+ \def\sseq@connbuffer{}
+ \def\sseq@currarrowstart{}
+ \def\sseq@currarrowend{}
+ \fi
+}
+\def\sseq@connection#1#2#3{
+ \sseq@flushconn
+ \ifthenelse{\boolean{#3}}{}{\ssassertsource}
+ \sseq@connreversefalse
+ \edef\sseq@prevxy{\expandafter\extractcoords\sseq@previousname}
+ \expandafter\ss@getcoords\sseq@prevxy
+ \ifcurroutofrange
+ \ifoutofrange % ^^A both out of range -- do nothing
+ \else % ^^Afrom within range to out of range -- draw a void line
+ % ^^A need to recompute the relative coordinates
+ \@eval\sseq@diffhelper{\sseq@prevxy{\number\sseqposx}{\number\sseqposy}}
+ \@eval\sseq@lineintooff{{\sseq@previousname}\sseq@prevxy{\number\count0}{\number\count1}{#1}{#2}}
+ \fi
+ \else
+ \ifoutofrange % ^^A from out of range to within range -- draw a void line
+ \ifthenelse{\boolean{#3}}{}{ % ^^A if the target is also void -- do nothing.
+ \sseq@connreversetrue
+ \@eval\sseq@diffhelper{{\number\sseqposx}{\number\sseqposy}\sseq@prevxy}
+ \@eval\sseq@lineintooff{{\sseq@currentname}{\sseqposx}{\sseqposy}{\number\count0}{\number\count1}{#1}{#2}}
+ }
+ \else
+ \putxyq{\pgfsetdash{#1}{0pt}}
+ \ifthenelse{\boolean{#3}}{ % ^^A draw a void line
+ \multiply\sseqx by -1
+ \advance\sseqx by \sseqabsposx
+ \multiply\sseqy by -1
+ \advance\sseqy by \sseqabsposy
+ \putxy{\noexpand\pgftransformshift{\noexpand\pgfpointanchor{\sseq@previousname}{center}}}
+ \putxyq{\pgfpathmoveto}
+ \putxy{{\noexpand\pgfpointshapeborder{\sseq@previousname}%
+ {\noexpand\pgfpoint{\the\sseqx}{\the\sseqy}}}}
}{
- \ifthenelse{\equal{#1}{U}}{
- \putxy{+U*!D{#2}}}{}
- \ifthenelse{\equal{#1}{LU}}{
- \putxy{+LU*!RD{#2}}}{}
- \ifthenelse{\equal{#1}{RU}}{
- \putxy{+RU*!LD{#2}}}{}
- \ifthenelse{\equal{#1}{R}}{
- \putxy{+R*!L{#2}}}{}
- \ifthenelse{\equal{#1}{L}}{
- \putxy{+L*!R{#2}}}{}
- \ifthenelse{\equal{#1}{D}}{
- \putxy{+D*!U{#2}}}{}
- \ifthenelse{\equal{#1}{LD}}{
- \putxy{+LD*!RU{#2}}}{}
- \ifthenelse{\equal{#1}{RD}}{
- \putxy{+RD*!LU{#2}}}{}
+ \putxyq{\pgfpathmoveto}
+ \putxy{{\noexpand\pgfpointshapeborder{\sseq@previousname}{\noexpand \pgfpointanchor{\sseq@currentname}{center}}}}
}
- \putxy{;"prev"}
-\fi
-}
-\newcommand{\ssdropextension}{
-\ssassertsource
-\expandafter\def\expandafter\tmpname\expandafter{\csname sseqdrop\the\sseqposx,\the\sseqposy\endcsname}
-\edef\setcnt{\noexpand\count0=\tmpname}
-\setcnt
-\advance\count0 by 1
-\expandafter\edef\tmpname{\the\count0}
-\setboolean{sseqcurrclip}{true}
-\ssifposinclippingregion{\the\sseqposx}{\the\sseqposy}
- \setboolean{sseqcurrclip}{false}
- \putxy{*+<1mm,1mm>\noexpand\frm{}*}
- \sseqwritecolor{\ssplacecolor}
- \putxyq{\cir{}}
-\fi
-\edef\sseqcurrentname{ss(\the\sseqposx,\the\sseqposy)\tmpname}
-\putxy{="\sseqcurrentname"}
-\ifthenelse{\boolean{sseqhasopenconn}}{\sseqconcludeconnection}{}
+ \def\sseq@temp{#2}
+ \ifx\sseq@temp\empty
+ \putxyq{\pgfpathlineto}
+ \else
+ \putxyq{\pgfsnakesegmentamplitude=#2pc}
+ \putxyq{\multiply\pgfsnakesegmentamplitude by 3 }
+ \putxyq{\pgfsnakesegmentaspect=.3}
+ \putxyq{\pgfpathsnaketo{bent}}
+ \fi
+ \ifthenelse{\boolean{#3}}{
+ \putxy{{\noexpand\pgfpoint{\the\sseqx}{\the\sseqy}}}
+ }{
+ \putxy{{\noexpand\pgfpointshapeborder{\sseq@currentname}{\noexpand \pgfpointanchor{\sseq@previousname}{center}}}}
+ } \edef\sseq@connbuffer{\noexpand\sseqwritecolor{\ssconncolor}\noexpand\putxyq{\noexpand\pgfusepath{stroke}\noexpand\pgftransformreset}}
+ \fi
+ \fi
}
+\def\sseq@diffhelper#1#2#3#4{
+ \count0=#1
+ \multiply\count0 by -1
+ \advance\count0 by #3
+ \count1=#2
+ \multiply\count1 by -1
+ \advance\count1 by #4
+}
+\define@key{sseqstroke}{color}{\def\ssconncolor{#1}}
+\define@key{sseqstroke}{curve}{\def\sseq@curve{#1}}
+\define@key{sseqstroke}{dashed}[{{2pt}{2pt}}]{\def\sseq@dashing{#1}}
+\define@key{sseqstroke}{dotted}[{{.5pt}{2pt}}]{\def\sseq@dashing{#1}}
+\define@key{sseqstroke}{arrowfrom}[\sseq@defaultarrowstyle]{\edef\sseq@arrowfrom{#1}}
+\define@key{sseqstroke}{arrowto}[\sseq@defaultarrowstyle]{\edef\sseq@arrowto{#1}}
+\define@key{sseqstroke}{void}[true]{\newif\ifKV@sseqstroke@void\csname KV@sseqstroke@void#1\endcsname}
+\def\ssstroke{\@ifnextchar[\sseq@stroke{\sseq@stroke[]}}
+\def\sseq@stroke[#1]{
+ \edef\sseq@savecolor{\ssconncolor}
+ \def\sseq@dashing{}
+ \def\sseq@curve{}
+ \edef\sseq@arrowfrom{\sseq@currarrowstart}
+ \edef\sseq@arrowto{\sseq@currarrowend}
+ \presetkeys{sseqstroke}{void=false}{}
+ \setkeys{sseqstroke}{#1}
+ \ifKV@sseqstroke@void % ^^A a void line
+ \@eval\sseq@connection{{\sseq@dashing}{\sseq@curve}{true}}
+ \else
+ \@eval\sseq@connection{{\sseq@dashing}{\sseq@curve}{false}}
+ \fi
+ \edef\sseq@currarrowstart{\sseq@arrowfrom}
+ \edef\sseq@currarrowend{\sseq@arrowto}
+ \edef\ssconncolor{\sseq@savecolor}
+}
+\newcommand{\sscurve}[1]{\sseq@stroke[curve=#1]}
+\newcommand{\ssdashedstroke}{\sseq@stroke[dashed]}
+\newcommand{\ssdashedcurve}[1]{\sseq@stroke[dashed,curve=#1]}
+\newcommand{\ssdottedstroke}{\sseq@stroke[dotted]}
+\newcommand{\ssdottedcurve}[1]{\sseq@stroke[dotted,curve=#1}
+\newcommand{\ssarrowhead}[1][\sseq@defaultarrowstyle]{\edef\sseq@currarrowend{#1}}
+\newcommand{\ssinversearrowhead}[1][\sseq@defaultarrowstyle]{\edef\sseq@currarrowstart{#1}}
+\def\ssline{\@ifnextchar[\sseq@line{\sseq@line[]}}
+\def\sseq@line[#1]#2#3{
+ \ssprepareline{#2}{#3}
+ \edef\sseqconncommand{\noexpand\ssstroke[color=\ssconncolor,#1]}
+}
+\newcommand{\sscurvedline}[3]{\ssline[curve=#3]{#1}{#2}}
+\newcommand{\ssdashedline}[2]{\ssline[dashed]{#1}{#2}}
+\newcommand{\sscurveddashedline}[3]{\ssline[curve=#3,dashed]{#1}{#2}}
+\newcommand{\ssarrow}[3][]{
+ \ssline[arrowto,#1]{#2}{#3}
+}
+\newcommand{\sscurvedarrow}[3]{\ssline[arrowto,curve=#3]{#1}{#2}}
+\newcommand{\ssdashedarrow}[2]{\ssline[arrowto,dashed]{#1}{#2}}
+\newcommand{\sscurveddashedarrow}[3]{\ssline[arrowto,dashed,curve=#3]{#1}{#2}}
+\def\ssvoidline#1#2{
+ \ssassertsource
+ \edef\sseq@resetcmd{\noexpand\sseqposx=\number\sseqposx%
+ \noexpand\sseqposy=\number\sseqposy%
+ \noexpand\def\noexpand\sseq@currentname{\sseq@currentname}
+ \noexpand\sseq@updatecurrentdata}
+ \ssmove{#1}{#2}
+ \ssstroke[void]
+ \sseq@resetcmd
+}
+\newcommand{\ssvoidarrow}[2]{\ssvoidline{#1}{#2}\ssarrowhead}
+\newcommand{\ssinversevoidarrow}[2]{\ssvoidline{#1}{#2}\ssinversearrowhead}
-\newcommand{\ssprepareline}[2]{
-\ifthenelse{\boolean{sseqhasfinishedpos}}{
- \ssopenposition{\the\sseqposx}{\the\sseqposy}
-}{}
-\advance\sseqposx by #1
-\advance\sseqposy by #2
-\setboolean{sseqhasopenconn}{true}
-\edef\ssoldconncolor{\ssconncolor}
+\def\sseq@pointintersectionoflinewithrectangle#1#2#3#4{
+ \pgf@process{#1}
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \pgf@process{#2}
+ \pgf@xb=\pgf@x
+ \pgf@yb=\pgf@y
+ \pgf@process{#3}
+ \pgf@xc=\pgf@x
+ \pgf@yc=\pgf@y
+ \pgf@process{#4}
+ \dimen0=100cm % ^^A infinity
+ \dimen1=100cm % ^^A infinity
+ \ifnum\pgf@x>0pt % ^^A line goes to the right
+ \dimen0=\pgf@xb
+ \advance\dimen0 by -\pgf@xc
+ \divide\dimen0 by \pgf@x
+ \fi
+ \ifnum\pgf@x<0pt % ^^A line goes to the left
+ \dimen0=\pgf@xa
+ \advance\dimen0 by -\pgf@xc
+ \divide\dimen0 by \pgf@x
+ \fi
+ \ifnum\pgf@y>0pt % ^^A line goes up
+ \dimen1=\pgf@yb
+ \advance\dimen1 by -\pgf@yc
+ \divide\dimen1 by \pgf@y
+ \fi
+ \ifnum\pgf@y<0pt % ^^A line goes down
+ \dimen1=\pgf@ya
+ \advance\dimen1 by -\pgf@xc
+ \divide\dimen1 by \pgf@y
+ \fi
+ \ifnum\dimen1<\dimen0
+ \dimen0=\dimen1
+ \fi
+ % ^^A now dimen0 contains the stretching factor for #4 to the right point.
+ \multiply\pgf@x by \dimen0
+ \multiply\pgf@y by \dimen0
+ \advance\pgf@x by \pgf@xc
+ \advance\pgf@y by \pgf@yc
}
-\newcommand{\sspreparevoidline}[2]{
-\ifthenelse{\boolean{sseqhasfinishedpos}}{
- \ssopenposition{\the\sseqposx}{\the\sseqposy}
-}{}
-\ifthenelse{\boolean{sseqhasfinishedpos}}{}{
- \ssputsemicolon
-}
-\setboolean{sseqhasfinishedpos}{false}
-\sseqx=\sseqentrysize
-\multiply\sseqx \sseqxdir
-\multiply\sseqx by #1
-\sseqy=\sseqentrysize
-\multiply\sseqy \sseqydir
-\multiply\sseqy by #2
-\putxy{p+<\the\sseqx,\the\sseqy>}
-\edef\ssoldconncolor{\ssconncolor}
-}
-
-\def\sseqifconninclippingregion{%
-\ifthenelse{\boolean{sseqcurrclip}\and\boolean{sseqprevclip}}{
- \ssclippedfalse}{
- \ssclippedtrue
- }
- \ifssclipped
-}
-\newcommand{\ssstroke}{
-\ssassertsource
-\sseqifconninclippingregion
- \putxy{**} \sseqwritecolor{\ssoldconncolor}
- \putxyq{\dir{-}}
-\fi
-}
-\newcommand{\sscurve}[1]{
-\ssassertsource
-\sseqifconninclippingregion
- \putxy{**} \sseqwritecolor{\ssoldconncolor}
- \putxyq{\crv{:(.5,#1)}}
-\fi
-}
-\newcommand{\ssdashedstroke}{
-\ssassertsource
-\sseqifconninclippingregion
- \putxy{**} \sseqwritecolor{\ssoldconncolor}
- \putxyq{\dir{--}}
+
+\def\sseq@lineintooff#1#2#3#4#5#6#7{
+ \putxyq{\begin{pgfscope}}
+ \sseqj=0
+ \def\tempcmd{\range@loop{\sseq@findxrange{#2}{#3}}}
+ \expandafter\tempcmd\sseq@xrange
+ \putxyq{\pgfsetdash{#6}{0pt}}
+ \putxyq{\sseq@pointintersectionoflinewithrectangle}
+ \putxy{{\noexpand\pgfpoint{\number \sseqxx sp}{\number \sseqyy sp}}}
+ \putxy{{\noexpand\pgfpoint{\number \sseqx sp}{\number \sseqy sp}}}
+ \putxyq{{\pgfpointanchor{#1}{center}}{\pgfpoint{#4 sp}{#5 sp}}}
+ \putxyq{\sseqx=\pgf@x}
+ \putxyq{\sseqy=\pgf@y}
+ \putxyq{\pgfpathmoveto}
+ \putxy{{\noexpand\pgfpointshapeborder{#1}%
+ {\noexpand\pgfpoint{\noexpand\sseqx}{\noexpand\sseqy}}}}
+ \def\temp{#7}
+ \ifx\temp\empty
+ \putxyq{\pgfpathlineto}
+ \else
+ \dimen0=#7pc
+ \ifsseq@connreverse
+ \multiply\dimen0 by -1
\fi
+ \putxy{\noexpand\pgfsnakesegmentamplitude=\number\dimen0 sp}
+ \putxyq{\advance\pgfsnakesegmentamplitude by \pgfsnakesegmentamplitude}
+ \putxyq{\pgfsnakesegmentaspect=.3}
+ \putxyq{\pgfpathsnaketo{bent}}
+ \fi
+ \putxyq{{\pgfpoint{\sseqx}{\sseqy}}}
+ \edef\sseq@connbuffer{\noexpand\sseqwritecolor{\ssconncolor}%
+ \noexpand\putxyq{\noexpand\pgfusepath{stroke}\noexpand\end{pgfscope}}}
}
-\newcommand{\ssdashedcurve}[1]{
-\ssassertsource
-\sseqifconninclippingregion
- \putxy{**} \sseqwritecolor{\ssoldconncolor}
- \putxyq{\crv{~**\dir{--}:(.5,#1)}}
+
+\def\sseq@findxrange#1#2#3#4{
+ \ifnum#1<#3\else
+ \ifnum#1>#4\else
+ % ^^A found the correct range
+ \sseqj=0
+ \def\tempcmd{\range@loop{\sseq@findyrange{#1}{#2}{#3}{#4}}}
+ \expandafter\tempcmd\sseq@yrange
+ \rangebreaktrue
\fi
+ \fi
}
-\newcommand{\ssarrowhead}{
-\sseqifconninclippingregion
- \putxy {?>*} \sseqwritecolor{\ssoldconncolor}
- \putxyq{\dir{>}}
+\def\sseq@findyrange#1#2#3#4#5#6{
+ \ifnum#2<#5\else
+ \ifnum#2>#6\else
+ % ^^A found the correct range -- do the drawing
+ \ss@getcoords{#3}{#5} % ^^A lower left corner in \sseqx,\sseqy
+ \advance\sseqx by -\sseq@xleak
+ \advance\sseqy by -\sseq@yleak
+ \sseqxx=\sseqx
+ \sseqyy=\sseqy
+ \ss@getcoords{#4}{#6} % ^^A upper right corner in \sseqx,\sseqy
+ \advance\sseqx by \sseq@xleak
+ \advance\sseqx by \sseqentrysize
+ \advance\sseqy by \sseq@yleak
+ \advance\sseqy by \sseqentrysize
+ \rangebreaktrue
\fi
-}
-\newcommand{\ssline}[2]{
-\ssprepareline{#1}{#2}
-\def\sseqconncommand{\ssstroke}
-}
-\newcommand{\sscurvedline}[3]{
-\ssprepareline{#1}{#2} \def\sseqconncommand{\sscurve{#3}}
-}
-\newcommand{\ssdashedline}[2]{
-\ssprepareline{#1}{#2} \def\sseqconncommand{\ssdashedstroke}
-}
-\newcommand{\sscurveddashedline}[3]{
-\ssprepareline{#1}{#2} \def\sseqconncommand{\ssdashedcurve{#3}}
-}
-\newcommand{\ssarrow}[2]{
-\ssprepareline{#1}{#2}
-\def\sseqconncommand{\ssstroke\ssarrowhead}
-}
-\newcommand{\sscurvedarrow}[3]{
-\ssprepareline{#1}{#2} \def\sseqconncommand{\sscurve{#3}\ssarrowhead}
-}
-\newcommand{\ssdashedarrow}[2]{
-\ssprepareline{#1}{#2} \def\sseqconncommand{\ssdashedstroke\ssarrowhead}
-}
-\newcommand{\sscurveddashedarrow}[3]{
-\ssprepareline{#1}{#2} \def\sseqconncommand{\ssdashedcurve{#3}\ssarrowhead}
+ \fi
}
-\newcommand{\ssvoidline}[2]{
-\sspreparevoidline{#1}{#2}
-\ssstroke
-\putxy{,p}
-}
-\newcommand{\ssvoidarrow}[2]{
-\sspreparevoidline{#1}{#2}
-\ssstroke\ssarrowhead
-\putxy{,p}
-}
\newcommand{\ssbullstring}[3]{
\ifnum#3>0
\ifnum#3=1
@@ -599,186 +910,286 @@
\ssbullstring{#1}{#2}{#3}
\ssvoidarrow{#1}{#2}
}
-\def\sseqdrawgrid#1#2{
-\sseqi=0
-\sseqj=0
-\loop
- \sseqy=\sseqentrysize
- \multiply \sseqy by \sseqj
- \advance \sseqy by \sseqlabelbarwidth
- %
- \putxy{<\the\sseqlabelbarwidth,\the\sseqy>;<\the\sseqx,\the\sseqy>**}
- \sseqwritecolor{sseqgr}
- \putxyq{\dir {.},}
- \advance\sseqj 1
-\ifnum\sseqj>#2 \else \repeat
-\sseqy = \sseqentrysize
-\multiply \sseqy by #2
-\advance \sseqy by \sseqlabelbarwidth
-\loop
- \sseqx=\sseqentrysize
- \multiply \sseqx by \sseqi
- \advance \sseqx by \sseqlabelbarwidth
- %
- \putxy{<\the\sseqx,\the\sseqlabelbarwidth>;<\the\sseqx,\the\sseqy>**}
- \sseqwritecolor{sseqgr}
- \putxyq{\dir {.},}
- \advance \sseqi 1
-\ifnum\sseqi>#1 \else \repeat
-}
-\def\sseqdrawlabels#1#2{
-\sseqi=\sseqxstart
-\sseqposx=\sseqxstart
-\multiply \sseqposx by -1
-\advance \sseqposx \sseqi
-\count0=\sseqxdir
-\multiply\count0 by \sseqxdir
-\multiply\count0 by \sseqxstep
-\count1=\sseqydir
-\multiply\count1 by \sseqydir
-\multiply\count1 by \sseqystep
-\loop
- \sseqxx=\sseqentrysize
- \multiply\sseqxx by \sseqposx
- \advance\sseqxx by \sseqhalfentry
- \advance\sseqxx by \sseqlabelbarwidth
- \putxy { <\the\sseqxx,0pt>*}
- \putxyq{\txt\sseqlabelfont}
- \putxy {{\the\sseqi},}
- \advance\sseqi by \sseqxstep
- \advance\sseqposx by \count0
-\ifnum\sseqposx<#1 \repeat
-\sseqj=\sseqystart
-\sseqposy=\sseqj
-\multiply\sseqposy by -1
-\advance\sseqposy by \sseqj
-\loop
- \sseqyy=\sseqentrysize
- \multiply\sseqyy by \sseqposy
- \advance\sseqyy by \sseqhalfentry
- \advance\sseqyy by \sseqlabelbarwidth
- \putxy { <0pt,\the\sseqyy>*}
- \putxyq {\txt\sseqlabelfont}
- \putxy{{\the\sseqj},}
- \advance\sseqj by \sseqystep
- \advance\sseqposy by \count1
-\ifnum\sseqposy<#2\repeat
-}
-
-\newenvironment{sseq}[2]{
-\begingroup
-\countdef\sseqxend=150 \sseqxend=\sseqxstart \advance\sseqxend by #1
-\countdef\sseqyend=151 \sseqyend=\sseqystart \advance\sseqyend by #2
-\dimendef\sseqoffx=200 \sseqoffx=0pt
-\dimendef\sseqoffy=201 \sseqoffy=0pt
-\dimendef\sseqoffsetx=202
-\dimendef\sseqoffsety=203
-\countdef\sseqi=152 \sseqi=0
-\countdef\sseqj=153 \sseqj=0
-\countdef\sseqxdir=154
-\countdef\sseqposx=155
-\countdef\sseqposy=156
-\countdef\sseqydir=157
-\dimendef\sseqlabelbarwidth=204
-\dimendef\sseqhalfentry=205
-\dimendef\sseqx=206
-\dimendef\sseqy=207
-\dimendef\sseqxx=208
-\dimendef\sseqyy=209
-\dimendef\sseqlabelwidth=210
-\dimendef\sseqrightlabelwidth=211
-\dimendef\sseqlabelsize=212
-
-\ifnum\sseqxstep<0 \sseqxdir=-1 \else \sseqxdir=1 \fi
-\ifnum\sseqystep<0 \sseqydir=-1 \else \sseqydir=1 \fi
-\def\sseqlabelfontsize{12}
-\edef\sseqsavecnto{\the\count0}
-\edef\sseqsavecnti{\the\count1}
-\edef\sseqsavecntii{\the\count2}
-\edef\sseqsavecntiii{\the\count3}
-\edef\sseqsavecntiv{\the\count4}
-\edef\sseqsavecntv{\the\count5}
-\edef\sseqsavecntvi{\the\count6}
-\edef\sseqsavecntvii{\the\count7}
-\edef\sseqsavecntviii{\the\count8}
-\edef\sseqsavecntix{\the\count9}
-\sseqlabelwidth=14pt
-\sseqrightlabelwidth=10pt
-\ifnum\sseqxstart<0
- \advance\sseqlabelwidth by 8pt
- \ifnum\sseqxstart<-9
- \advance\sseqlabelwidth by 6pt
- \ifnum\sseqxstart<-99
- \advance\sseqlabelwidth by 6pt
- \fi
+\def\ssgridcrossword#1#2{
+ \pgfsetlinewidth{\the\sseq@gridstrokethickness}
+ \pgfpathgrid[stepx=\the\sseqentrysize,stepy=\the\sseqentrysize]{\pgfpointorigin}{\pgfpoint{#1*\sseqentrysize}{#2*\sseqentrysize}}
+ \pgfusepath{stroke}
+}
+
+\def\ssgridgo#1#2{
+ \pgfsetlinewidth{\the\sseq@gridstrokethickness}
+ \pgftransformxshift{\the\sseqhalfentry}
+ \pgftransformyshift{\the\sseqhalfentry}
+ \pgfpathgrid[stepx=\the\sseqentrysize,stepy=\the\sseqentrysize]{\pgfpoint{-\the\sseqhalfentry}{-\the\sseqhalfentry}}{\pgfpoint{#1*\sseqentrysize-\sseqhalfentry}{#2*\sseqentrysize-\sseqhalfentry}}
+ \pgfusepath{stroke}
+}
+
+\def\ssgridnone#1#2{}
+
+\def\ssgriddots#1#2{
+ \pgfsetlinewidth{1pt}
+ \pgfsetdash{{1pt}{\the\sseqentrysize-1pt}}{\the\sseqhalfentry+.5pt}
+ \pgftransformxshift{\the\sseqhalfentry}
+ \pgftransformyshift{\the\sseqhalfentry}
+ \pgfpathgrid[stepx=\the\sseqentrysize,stepy=\the\sseqentrysize]{\pgfpoint{-\the\sseqhalfentry}{-\the\sseqhalfentry}}{\pgfpoint{#1*\sseqentrysize-\sseqhalfentry}{#2*\sseqentrysize-\sseqhalfentry}}
+ \pgfusepath{stroke}
+}
+
+\def\ssgridchess#1#2{
+ \pgfsetlinewidth{\the\sseqentrysize}
+ \pgfsetdash{{\the\sseqentrysize}{\the\sseqentrysize}}{\the\sseqentrysize}
+ \pgfsetcolor{sslightgr}
+ \pgftransformxshift{\the\sseqhalfentry}
+ \pgftransformyshift{\the\sseqhalfentry}
+ \pgfpathgrid[stepx=\the\sseqentrysize*2,stepy=\the\sseqentrysize*2]{\pgfpoint{-\the\sseqhalfentry}{-\the\sseqhalfentry}}{\pgfpoint{#1*\sseqentrysize-\sseqhalfentry}{#2*\sseqentrysize-\sseqhalfentry}}
+ \pgfusepath{stroke}
+}
+
+\def\sseq@drawgrid{
+ \expandafter\ifx\sseqgridstyle\ssequndefined
+ \PackageError{sseq}{Unknown grid option, reverting to \string\ssgridnone}{You apparently have redefined \string\sseqgridstyle. The only allowed values are: \string\ssgridnone,\string\ssgriddots,\string\ssgridgo,\string\ssgridcrossword,\string\ssgridchess.}
+ \gdef\sseqgridstyle{\ssgridnone}
\fi
-\fi
-\ifnum\sseqxend>10
- \advance\sseqrightlabelwidth by 6pt
- \ifnum\sseqxend>100
- \advance\sseqrightlabelwidth by 6pt
+ \sseqj=0
+ \def\tempcmd{\range@loop{\sseq@innergridloop}}
+ \expandafter\tempcmd\sseq@xrange
+}
+\def\sseq@innergridloop#1#2{
+ \sseqj=0
+ \def\tempcmd{\range@loop{\sseq@gridwrapper{#1}{#2}}}
+ \expandafter\tempcmd\sseq@yrange
+}
+\def\sseq@gridwrapper#1#2#3#4{
+ \begin{pgfscope}
+ \ss@getcoords{#1}{#3}
+ \sseqxx=\sseqx
+ \sseqyy=\sseqy
+ \count0=#2\advance\count0 by 1
+ \count1=#4\advance\count1 by 1
+ \pgftransformshift{\pgfpoint{\the\sseqxx}{\the\sseqyy}}
+ \count2=#1
+ \multiply\count2 by -1
+ \advance\count0 by \count2
+ \count2=#3
+ \multiply\count2 by -1
+ \advance\count1 by \count2
+ \@eval\sseqgridstyle{{\number\count0}{\number\count1}}
+ \end{pgfscope}
+}
+\def\sseq@drawlabels{
+ \sseqj=0
+ \def\tempcmd{\range@loop{\sseqk=-\sseqxstep \sseq@drawhorizontallabels}}
+ \expandafter\tempcmd\sseq@xrange
+ \sseqj=0
+ \def\tempcmd{\range@loop{\sseqk=-\sseqystep \sseq@drawverticallabels}}
+ \expandafter\tempcmd\sseq@yrange
+}
+
+\def\sseq@drawhorizontallabels#1#2{
+ \advance\sseqk by \sseqxstep
+ \sseqi=#1
+ \ifnum\sseqi>#2\else
+ \ss@getcoords{\the\sseqi}{0}
+ \advance\sseqx by \sseqhalfentry
+ \sseqxlabel
+ \sbox\sseq@labelbox{\strut\ensuremath{\sseq@answer}}
+ \dimen0 = \ht\sseq@labelbox
+ \advance\dimen0 by \dp\sseq@labelbox
+ \pgf@protocolsizes{0pt}{-\dimen0} % ^^A fixes a bug with bounding boxes in pgf
+ \pgftext[top,at=\pgfpoint{\the\sseqx}{0pt}]{\usebox{\sseq@labelbox}}
+ \advance\sseqi by \sseqxstep
+ \edef\tempcmd{\noexpand\sseq@drawhorizontallabels{\number\sseqi}{#2}}
+ \expandafter\tempcmd
\fi
+}
+\def\sseq@drawverticallabels#1#2{
+ \advance\sseqk by \sseqystep
+ \sseqi=#1
+ \ifnum\sseqi>#2\else
+ \ss@getcoords{0}{\the\sseqi}
+ \advance\sseqy by \sseqhalfentry
+ \sseqylabel
+ \pgftext[right,at=\pgfpoint{-2pt}{\the\sseqy}]{\ensuremath{\sseq@answer}}
+ \advance\sseqi by \sseqystep
+ \edef\tempcmd{\noexpand\sseq@drawverticallabels{\number\sseqi}{#2}}
+ \expandafter\tempcmd
+ \fi
+}
+\def\sseq@labelfromlist#1#2#3,{
+ \def\temp{#3}
+ \def\tempcmd{}
+ \ifx\temp\range@endmarker
+ \def\sseq@answer{?}
+ \else
+ \count0=#1
+ \ifnum\count0=0
+ \def\sseq@lastlabel{}
+ \def\tempcmd{\sseq@innerlabelfromlist{#2}#3;END;}
+ \else
+ \advance\count0 by -1
+ \edef\tempcmd{\noexpand\sseq@labelfromlist{\number\count0}{#2}}
+ \fi
+ \fi
+ \tempcmd
+}
+
+\def\sseq@innerlabelfromlist#1#2;{
+ \def\temp{#2}
+ \def\tempcmd{}
+ \ifx\temp\range@endmarker
+ \ifx\sseq@lastlabel\empty
+ \def\sseq@answer{?}
+ \else
+ \count0=#1
+ \ifnum\count0=0
+ \def\sseq@answer{\ensuremath{\sseq@lastlabel}}
+ \def\tempcmd{\range@gobbletoend}
+ \else
+ \advance\count0 by -1
+ \edef\tempcmd{\noexpand\sseq@innerlabelfromlist{\number\count0}END;}
+ \fi
+ \fi
+ \else
+ \def\sseq@lastlabel{#2}
+ \count0=#1
+ \ifnum\count0=0
+ \def\sseq@answer{\ensuremath{#2}}
+ \def\tempcmd{\range@gobbletoend}
+ \else
+ \advance\count0 by -1
+ \edef\tempcmd{\noexpand\sseq@innerlabelfromlist{\number\count0}}
+ \fi
+ \fi
+ \tempcmd
+}
+\define@key{sseq}{grid}{
+\expandafter\def\expandafter\sseqgridstyle\expandafter{\csname ssgrid#1\endcsname}
+}
+\define@key{sseq}{entrysize}{
+\sseqentrysize=#1
+}
+\define@key{sseq}{labels}{
+ \setkeys{sseq}{xlabels=#1,ylabels=#1}
+}
+\define@key{sseq}{xlabels}{
+ \def\temp{#1}
+ \def\temptwo{none}
+ \ifx\temp\temptwo
+ \def\sseqxlabel{\def\sseq@answer{}}
+ \else
+ \def\temptwo{numbers}
+ \ifx\temp\temptwo
+ \def\sseqxlabel{\def\sseq@answer{\the\sseqi}}
+\else
+ \def\sseqxlabel{%
+ \@eval\sseq@labelfromlist{{\number\sseqj}{\number\sseqk}}#1,END,%
+ }
+ \fi
+ \fi
+}
+\define@key{sseq}{ylabels}{
+ \def\temp{#1}
+ \def\temptwo{none}
+ \ifx\temp\temptwo
+ \def\sseqylabel{\def\sseq@answer{}}
+ \else
+ \def\temptwo{numbers}
+ \ifx\temp\temptwo
+ \def\sseqylabel{\def\sseq@answer{\the\sseqi}}
+\else
+ \def\sseqylabel{%
+ \@eval\sseq@labelfromlist{{\number\sseqj}{\number\sseqk}}#1,END,%
+ }
\fi
-\ifnum\sseqrightlabelwidth>\sseqlabelwidth
- \sseqlabelwidth=\sseqrightlabelwidth
-\fi
-\sseqlabelsize=10pt
-\count0=\sseqentrysize
-\multiply \count0 by 160
-\divide \count0 by \sseqlabelwidth
-\multiply \sseqlabelsize by \count0
-\divide \sseqlabelsize by 100
-\ifdim\sseqlabelsize<11pt
- \def\sseqlabelfontsize{10}
- \ifdim\sseqlabelsize<9.5pt
- \def\sseqlabelfontsize{9}
- \ifdim\sseqlabelsize<8.5pt
- \def\sseqlabelfontsize{8}
\fi
- \fi
+}
+\define@key{sseq}{xlabelstep}{\sseqxstep=#1}
+\define@key{sseq}{ylabelstep}{\sseqystep=#1}
+\define@key{sseq}{labelstep}{\setkeys{sseq}{xlabelstep=#1}\setkeys{sseq}{ylabelstep=#1}}
+
+\define@key{sseq}{gapsize}{\setkeys{sseq}{xgapsize=#1}\setkeys{sseq}{ygapsize=#1}}
+\define@key{sseq}{xgapsize}{\sseq@xgap=#1}
+\define@key{sseq}{ygapsize}{\sseq@ygap=#1}
+\define@key{sseq}{leak}{\setkeys{sseq}{xleak=#1}\setkeys{sseq}{yleak=#1}}
+\define@key{sseq}{xleak}{\sseq@xleak=#1}
+\define@key{sseq}{yleak}{\sseq@yleak=#1}
+\define@key{sseq}{gridstroke}{\sseq@gridstrokethickness=#1}
+\define@key{sseq}{arrows}{\def\sseq@defaultarrowstyle{#1}}
+\sseqentrysize=0.4cm
+\sseq@xgap=0.3cm
+\sseq@ygap=0.3cm
+\global\sseq@xleak=-100mm
+\global\sseq@yleak=-100mm
+\sseqxstep=2
+\sseqystep=2
+\def\sseqgridstyle{\ssgridcrossword}
+\def\sseq@defaultarrowstyle{to}
+
+\newenvironment{sseq}[3][]{%
+\begingroup
+\begin{pgfpicture}
+\countdef\sseqi=152%
+\countdef\sseqj=153%
+\countdef\sseqxdir=154%
+\countdef\sseqposx=155%
+\countdef\sseqposy=156%
+\countdef\sseqydir=157%
+\countdef\sseqk=158%
+\dimendef\sseqhalfentry=205%
+\dimendef\sseqx=206%
+\dimendef\sseqy=207%
+\dimendef\sseqxx=208%
+\dimendef\sseqyy=209%
+\dimendef\sseqabsposx=210%
+\dimendef\sseqabsposy=211%
+\sseq@gridstrokethickness=.1pt%
+\edef\sseqsavecnto{\number\count0}%
+\edef\sseqsavecnti{\number\count1}%
+\edef\sseqsavecntii{\number\count2}%
+\edef\sseqsavecntiii{\number\count3}%
+\edef\sseqsavecntiv{\number\count4}%
+\edef\sseqsavecntv{\number\count5}%
+\edef\sseqsavecntvi{\number\count6}%
+\edef\sseqsavecntvii{\number\count7}%
+\edef\sseqsavecntviii{\number\count8}%
+\edef\sseqsavecntix{\number\count9}%
+\setkeys{sseq}{#1}
+\ifnum\sseqxstep=0 % ^^A old-fashioned way of disabling labels
+ \setkeys{sseq}{xlabels=none}
+ \sseqxstep=1
+\else
+ \@ifundefined{sseqxlabel}{\setkeys{sseq}{xlabels=numbers}}{}
+\fi
+\ifnum\sseqystep=0 % ^^A old-fashioned way of disabling labels
+ \setkeys{sseq}{ylabels=none}%
+ \sseqystep=1
+\else
+ \@ifundefined{sseqylabel}{\setkeys{sseq}{ylabels=numbers}}{}
+\fi
+\ifdim\sseq@xleak=-100mm
+ \sseq@xleak=0.3\sseq@xgap
+\fi
+\ifdim\sseq@yleak=-100mm
+ \sseq@yleak=0.3\sseq@ygap
\fi
-\edef\sz{\the\sseqlabelsize}
-\putxyq {\font \sseqlabelfont = cmtt}
-\putxy{\sseqlabelfontsize\space at \the\sseqlabelsize\space}
-\sseqlabelbarwidth=\sseqlabelsize
-\divide\sseqlabelbarwidth by 2
-\dimen0=\sseqentrysize
-\multiply\dimen0 by -1
-\multiply\dimen0 by \sseqxdir
-\multiply\dimen0 by \sseqxstart
-\sseqoffsetx=\sseqlabelbarwidth
-\advance\sseqoffsetx by \dimen0
-\dimen0=\sseqentrysize
-\multiply\dimen0 by -1
-\multiply\dimen0 by \sseqydir
-\multiply\dimen0 by \sseqystart
-\sseqoffsety=\sseqlabelbarwidth
-\advance\sseqoffsety by \dimen0
+\range@parseandnormalize{\sseq@xrange}{\sseqxstart}{#2}
+\range@parseandnormalize{\sseq@yrange}{\sseqystart}{#3}
+\pgfsetshapeminwidth{1.1mm}
+\pgfsetshapeinnerxsep{1pt}
+\pgfsetshapeinnerysep{1pt}
\sseqhalfentry=\sseqentrysize
\divide\sseqhalfentry by 2
-\sseqx=\sseqentrysize
-\multiply \sseqx by #1
-\advance \sseqx by \sseqlabelbarwidth
-\sseqy=\sseqentrysize
-\multiply \sseqy by \sseqj
-\advance \sseqy by \sseqlabelbarwidth
-\sseqxx=\sseqx
-\sseqyy=\sseqy
-\advance\sseqxx by \sseqhalfentry
-\advance\sseqyy by \sseqhalfentry
-\putxyq {\xy}
-\sseqdrawgrid{#1}{#2}
-\sseqdrawlabels{#1}{#2}
+\sseq@drawgrid
+\sseq@drawlabels
\sseqposx=0
\sseqposy=0
}
{
\relax
-\ssfinishpos
-\putxyq{\endxy}
-\bigskip
+\ssmoveto 0 0 \ssmoveto 0 0
\edef\lst{\the\sseqcmdlist}
\ifthenelse{\boolean{debug}}{\show\lst}{}
+\the\sseqcmdlist
\count0=\sseqsavecnto
\count1=\sseqsavecnti
\count2=\sseqsavecntii
@@ -789,9 +1200,8 @@
\count7=\sseqsavecntvii
\count8=\sseqsavecntviii
\count9=\sseqsavecntix
-\the\sseqcmdlist
+\end{pgfpicture}
\endgroup
-\bigskip
}
\endinput
%%