summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/luasseq
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-11-17 22:30:53 +0000
committerKarl Berry <karl@freefriends.org>2010-11-17 22:30:53 +0000
commit82363687abbffeaa2b8e9fe3ea988d92702a09b1 (patch)
treef580bb966a58d2e057c8436dfecc6efd8fd54890 /Master/texmf-dist/tex/lualatex/luasseq
parent638db9025e3da8d1a4eb81f3431bd51c4095cf92 (diff)
luasseq under lualatex, .lua in runtime (luecking 17 Nov 2010 15:52:14)
git-svn-id: svn://tug.org/texlive/trunk@20467 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/luasseq')
-rw-r--r--Master/texmf-dist/tex/lualatex/luasseq/luasseq.sty353
1 files changed, 353 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/lualatex/luasseq/luasseq.sty b/Master/texmf-dist/tex/lualatex/luasseq/luasseq.sty
new file mode 100644
index 00000000000..17e4ca8179b
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/luasseq/luasseq.sty
@@ -0,0 +1,353 @@
+%%
+%% This is file `luasseq.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% luasseq.dtx (with options: `package')
+%%
+%% IMPORTANT NOTICE:
+%%
+%% For the copyright see the source file.
+%%
+%% Any modified versions of this file must be renamed
+%% with new filenames distinct from luasseq.sty.
+%%
+%% For distribution of the original source see the terms
+%% for copying and modification in the file luasseq.dtx.
+%%
+%% This generated file may be distributed as long as the
+%% original source files, as listed above, are part of the
+%% same distribution. (The sources need not necessarily be
+%% in the same archive or directory.)
+
+\NeedsTeXFormat{LaTeX2e}
+
+\ProvidesPackage{luasseq}[2010/11/06 ver 2.1]
+
+\RequirePackage{ifthen,calc,pifont}
+\RequirePackage{pgf}[2006/01/01]
+\RequirePackage{xkeyval}
+\usepgflibrary{snakes}
+
+\newboolean{debug}
+\setboolean{debug}{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}{\errmessage{sseq: deprecated option color ignored}}
+\DeclareOption{nocolor}{\errmessage{sseq: deprecated option nocolor ignored}}
+\DeclareOption{debug}{\setboolean{debug}{true}}
+
+\ProcessOptions
+
+
+\directlua0{dofile(kpse.find_file("luasseq.lua"))}
+
+ \definecolor{sseqgr}{gray}{0.65}
+ \definecolor{sslightgr}{gray}{0.9}
+ \definecolor{ssred}{rgb}{1,0,0}
+ \definecolor{ssblack}{rgb}{0,0,0}
+\newcommand{\ssconncolor}{ssblack}
+\newcommand{\sslabelcolor}{ssblack}
+\newcommand{\ssplacecolor}{ssblack}
+
+%% ^^A Initialization
+\newcount\sseqxstart \sseqxstart=0
+\newcount\sseqystart \sseqystart=0
+\newdimen\sseq@dimen % ^^A To convert dimensions to scaled points (in TeX)
+\newbox\sseqbox % ^^A To compute the size of dropped objects (in TeX)
+
+\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\ss@placespecial#1#2#3#4#5{
+\directlua0{sseq_drop_object(#1,#2,[[#3]],[[#4]],[[#5]],[[\ssplacecolor]])}}
+
+\newcommand{\ssplace}[3]{
+ \ss@placespecial{#1}{#2}{rectangle}{discard}{#3}
+}
+
+\newcommand{\ssplaceboxed}[3]{
+ \ss@placespecial{#1}{#2}{rectangle}{stroke}{\ensuremath{#3}}
+}
+
+\newcommand{\ssplacecircled}[3]{
+ \ss@placespecial{#1}{#2}{circle}{stroke}{\ensuremath{#3}}
+}
+
+\newcommand{\ssmoveto}[2]{\directlua0{sseq_moveto(#1,#2)}}
+\newcommand{\ssmove}[2]{\directlua0{sseq_move(#1,#2)}}
+\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\sseq@color{#1}}
+\define@key{sseqdrop}{name}{\def\sseq@name{#1}}
+\def\ssdrop{\@ifnextchar[\sseq@drop{\sseq@drop[]}}
+\def\sseq@drop[#1]#2{
+ \presetkeys{sseqdrop}{circled=false,boxed=false,color=\ssplacecolor,name=\relax}{}
+ \setkeys{sseqdrop}{#1}
+ \ifKV@sseqdrop@circled
+ \directlua0{sseq_drop_object_here("circle","stroke",[[#2]],"\sseq@color")}
+ \else
+ \ifKV@sseqdrop@boxed
+ \directlua0{sseq_drop_object_here("rectangle","stroke",[[#2]],"\sseq@color")}
+ \else
+ \directlua0{sseq_drop_object_here("rectangle","discard",[[#2]],"\sseq@color")}
+ \fi
+ \fi
+ \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{\directlua0{sseq_name("#1")}}
+\newcommand{\ssgoto}[1]{\directlua0{sseq_goto("#1")}}
+\newcommand{\ssprefix}[1]{\directlua0{sseq_prefix("#1")}}
+\newcommand{\ssresetprefix}{\directlua0{sseq_reset_prefix()}}
+\newcommand{\ssabsgoto}[1]{\directlua0{sseq_abs_goto("#1")}}
+\define@key{sseqlabel}{color}{\def\sseq@color{#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{
+ \def\sseq@position{L}
+ \presetkeys{sseqlabel}{color=\ssplacecolor}{}
+ \setkeys{sseqlabel}{#1}
+ \directlua0{sseq_drop_label("\sseq@position","\sseq@color",[[#2]])}
+}
+\define@key{sseqdropext}{circled}[true]{\newif\ifKV@sseqdrop@circled\csname KV@sseqdrop@circled#1\endcsname}
+\define@key{sseqdropext}{boxed}[true]{\newif\ifKV@sseqdrop@boxed\csname KV@sseqdrop@boxed#1\endcsname}
+\define@key{sseqdropext}{color}{\def\ssplacecolor{#1}}
+\define@key{sseqdropext}{name}{\def\sseq@name{#1}}
+\def\ssdropextension{\@ifnextchar[\sseq@dropextension{\sseq@dropextension[]}}
+\def\sseq@dropextension[#1]{
+ \edef\sseq@savecolor{\ssplacecolor}
+ \def\sseq@name{\relax}
+ \presetkeys{sseqdropext}{circled=false,boxed=false}{}
+ \setkeys{sseqdrop}{#1}
+ \ifKV@sseqdrop@boxed
+ \directlua0{sseq_drop_extension("rectangle","stroke","\sseq@color")}
+ \else
+ \directlua0{sseq_drop_extension("circle","stroke","\sseq@color")}
+ \fi
+
+ \def\temp{\relax}
+ \ifx\sseq@name\temp \else
+ \@eval\ssname{{\sseq@name}}
+ \fi
+}
+\define@key{sseqstroke}{color}{\def\sseq@color{#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]{\def\sseq@arrowfrom{\ssinversearrowhead[#1]}}
+\define@key{sseqstroke}{arrowto}[\sseq@defaultarrowstyle]{\def\sseq@arrowto{\ssarrowhead[#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]{
+ \def\sseq@dashing{}
+ \def\sseq@curve{}
+ \def\sseq@arrowfrom{}
+ \def\sseq@arrowto{}
+ \presetkeys{sseqstroke}{void=false,color=\ssconncolor}{}
+ \setkeys{sseqstroke}{#1}
+ \ifKV@sseqstroke@void % ^^A a void line
+ \directlua0{sseq_late_connection("\sseq@dashing","\sseq@curve","\sseq@color",false,true)}
+ \else
+ \directlua0{sseq_late_connection("\sseq@dashing","\sseq@curve","\sseq@color",false,false)}
+ \fi
+ \sseq@arrowfrom
+ \sseq@arrowto
+}
+\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]{\directlua0{sseq_add_arrow("arrowto","#1")}}
+\newcommand{\ssinversearrowhead}[1][\sseq@defaultarrowstyle]{\directlua0{sseq_add_arrow("arrowfrom","#1")}}
+\define@key{sseqline}{color}{\def\sseq@color{#1}}
+\define@key{sseqline}{curve}{\def\sseq@curve{#1}}
+\define@key{sseqline}{dashed}[{{2pt}{2pt}}]{\def\sseq@dashing{#1}}
+\define@key{sseqline}{dotted}[{{.5pt}{2pt}}]{\def\sseq@dashing{#1}}
+\define@key{sseqline}{arrowfrom}[\sseq@defaultarrowstyle]{\def\sseq@arrowfrom{\ssinversearrowhead[#1]}}
+\define@key{sseqline}{arrowto}[\sseq@defaultarrowstyle]{\def\sseq@arrowto{\ssarrowhead[#1]}}
+\define@key{sseqline}{void}[true]{\newif\ifKV@sseqline@void\csname KV@sseqline@void#1\endcsname}
+\def\ssline{\@ifnextchar[\sseq@line{\sseq@line[]}}
+\def\sseq@line[#1]#2#3{
+ \def\sseq@dashing{}
+ \def\sseq@curve{}
+ \edef\sseq@arrowfrom{}
+ \edef\sseq@arrowto{}
+ \presetkeys{sseqline}{void=false,color=\ssconncolor}{}
+ \setkeys{sseqline}{#1}
+ \ifKV@sseqline@void % ^^A a void line
+ \directlua0{sseq_assert_source(); sseq_finish_pos(); sseq_move(#2,#3); sseq_late_connection("\sseq@dashing","\sseq@curve","\sseq@color",false,true)}
+ \else
+ \directlua0{sseq_open_connection("\sseq@dashing","\sseq@curve","\sseq@color",false,false); sseqposx = sseqposx+#2; sseqposy = sseqposy+#3}
+ \fi
+ \sseq@arrowfrom
+ \sseq@arrowto
+}
+\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{\@ifnextchar[\sseq@voidline{\sseq@voidline[]}}
+\def\sseq@voidline[#1]#2#3{
+ \def\sseq@dashing{}
+ \def\sseq@curve{}
+ \edef\sseq@arrowfrom{}
+ \edef\sseq@arrowto{}
+ \presetkeys{sseqline}{color=\ssconncolor}{}
+ \setkeys{sseqline}{#1}
+ \directlua0{sseq_void_line("\sseq@dashing","\sseq@curve","\sseq@color",#2,#3)}
+ \sseq@arrowfrom
+ \sseq@arrowto
+}
+
+\newcommand{\ssvoidarrow}[2]{\ssvoidline{#1}{#2}\ssarrowhead}
+\newcommand{\ssinversevoidarrow}[2]{\ssvoidline{#1}{#2}\ssinversearrowhead}
+
+\newcommand{\ssbullstring}[3]{
+\directlua0{sseq_bullstring(#1,#2,#3,[[\ssplacecolor]])}
+}
+\newcommand{\ssinfbullstring}[3]{
+\ssbullstring{#1}{#2}{#3}
+\ssvoidarrow{#1}{#2}
+}
+\newcommand{\ssgrayout}[1][gray]{\directlua0{sseq_grayout("#1")}}
+\define@key{sseq}{grid}{
+ \directlua0{sseqgriddrawer = sseq_grid_#1}
+}
+\define@key{sseq}{entrysize}{
+ \sseq@dimen=#1
+ \directlua0{sseqentrysize=\number\sseq@dimen} % In LUA, it's all in scaled points.
+}
+
+\define@key{sseq}{labels}{
+ \setkeys{sseq}{xlabels=#1,ylabels=#1}
+}
+\define@key{sseq}{xlabels}{
+ \def\temp{#1}
+ \def\temptwo{none}
+ \ifx\temp\temptwo
+ \directlua0{sseqxlabels = sseq_parse_label_list("")}
+ \else
+ \def\temptwo{numbers}
+ \ifx\temp\temptwo
+ \directlua0{sseqxlabels = sseq_parse_label_list("&n")}
+ \else
+ \directlua0{sseqxlabels = sseq_parse_label_list([[#1]])}
+ \fi
+ \fi
+}
+\define@key{sseq}{ylabels}{
+ \def\temp{#1}
+ \def\temptwo{none}
+ \ifx\temp\temptwo
+ \directlua0{sseqylabels = sseq_parse_label_list("")}
+ \else
+ \def\temptwo{numbers}
+ \ifx\temp\temptwo
+ \directlua0{sseqylabels = sseq_parse_label_list("&n")}
+ \else
+ \directlua0{sseqylabels = sseq_parse_label_list([[#1]])}
+ \fi
+ \fi
+}
+
+\define@key{sseq}{xlabelstep}{
+\directlua0{sseqxstep=#1}
+}
+\define@key{sseq}{ylabelstep}{
+\directlua0{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@dimen=#1
+\directlua0{sseqxgap=\number\sseq@dimen}
+}
+\define@key{sseq}{ygapsize}{
+\sseq@dimen=#1
+\directlua0{sseqygap=\number\sseq@dimen}
+}
+\define@key{sseq}{leak}{\setkeys{sseq}{xleak=#1}\setkeys{sseq}{yleak=#1}}
+\define@key{sseq}{xleak}{
+\sseq@dimen=#1
+\directlua0{sseqxleak=\number\sseq@dimen}
+}
+\define@key{sseq}{yleak}{
+\sseq@dimen=#1
+\directlua0{sseqyleak=\number\sseq@dimen}
+}
+
+\define@key{sseq}{gridstroke}{
+\sseq@dimen=#1
+\directlua0{sseqgridstrokethickness=\number\sseq@dimen}
+}
+
+\define@key{sseq}{arrows}{
+\def\sseq@defaultarrowstyle{#1}
+\directlua0{sseqdefaultarrowstyle="#1"}
+}
+
+\define@key{sseq}{packing}{
+\directlua0{sseqpacking = sseq_pack_#1}
+}
+\def\sseq@defaultarrowstyle{to}
+
+\directlua0{sseq_set_defaults()}
+
+\newenvironment{sseq}[3][]{%
+\begingroup
+\directlua0{sseq_init()}
+\begin{pgfpicture}
+\setkeys{sseq}{#1}
+\directlua0{sseq_setup_ranges("#2","#3",\the\sseqxstart,\the\sseqystart)}
+\directlua0{sseq_drawgrid()}
+\directlua0{sseq_drawlabels()}
+\directlua0{sseqboxno = \the\sseqbox} % ^^A Needed to measure the size of entries
+}
+{
+\relax
+\ssmoveto 0 0
+\directlua0{sseq_position_objects(); sseq_dump_code()}
+\end{pgfpicture}
+\endgroup
+}
+\endinput
+%%
+%% End of file `luasseq.sty'.