summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/sprite
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/sprite
Initial commit
Diffstat (limited to 'macros/latex/contrib/sprite')
-rw-r--r--macros/latex/contrib/sprite/sprite.sty39
-rw-r--r--macros/latex/contrib/sprite/spriteuse.tex85
2 files changed, 124 insertions, 0 deletions
diff --git a/macros/latex/contrib/sprite/sprite.sty b/macros/latex/contrib/sprite/sprite.sty
new file mode 100644
index 0000000000..849434fe8a
--- /dev/null
+++ b/macros/latex/contrib/sprite/sprite.sty
@@ -0,0 +1,39 @@
+%%%%%%%%%%%%% SPRITE.STY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% LaTeX style option SPRITE.STY ( Martin Costabel 27-Oct-1987 )
+%% Use: \documentstyle[...,sprite,...]{...}
+%\makeatletter %use this if you \input{sprite.sty}
+%% New command:
+%%
+%% \sprite{cmd}(lins,cols)[wdth,hght] pixels \endsprite
+%%
+%% Here:
+%% cmd is a command sequence which is afterwards the name of the new object.
+%% It is defined as \usebox{cmd@box}, so there is also a new box cmd@box.
+%% wdth and hght are the width and height of the new object.
+%% pixels is a sequence of lins lines, each of which starts with a `:'(colon),
+%% ends with a `|'(vertical bar), and contains cols pixels which are
+%% either a `.'(period, meaning a white pixel) or a `B'(capital B, meaning
+%% a black pixel). Blank spaces are ignored.
+%%
+\newlength{\@pxlwd} \newlength{\@rulewd} \newlength{\@pxlht}
+\catcode`.=\active \catcode`B=\active \catcode`:=\active \catcode`|=\active
+\def\sprite#1(#2,#3)[#4,#5]{
+ \edef\@sprbox{\expandafter\@cdr\string#1\@nil @box}
+ \expandafter\newsavebox\csname\@sprbox\endcsname
+ \edef#1{\expandafter\usebox\csname\@sprbox\endcsname}
+ \expandafter\setbox\csname\@sprbox\endcsname =\hbox\bgroup
+ \vbox\bgroup
+ \catcode`.=\active\catcode`B=\active\catcode`:=\active\catcode`|=\active
+ \@pxlwd=#4 \divide\@pxlwd by #3 \@rulewd=\@pxlwd
+ \@pxlht=#5 \divide\@pxlht by #2
+ \def .{\hskip \@pxlwd \ignorespaces}
+ \def B{\@ifnextchar B{\advance\@rulewd by \@pxlwd}{\vrule
+ height \@pxlht width \@rulewd depth 0 pt \@rulewd=\@pxlwd}}
+ \def :{\hbox\bgroup\vrule height \@pxlht width 0pt depth 0pt\ignorespaces}
+ \def |{\vrule height \@pxlht width 0pt depth 0pt\egroup
+ \prevdepth= -1000 pt}
+ }
+\def\endsprite{\egroup\egroup}
+\catcode`.=12 \catcode`B=11 \catcode`:=12 \catcode`|=12\relax
+%\makeatother %use this if you \input{sprite.sty}
+%%%%%%%%%%% End of SPRITE.STY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/macros/latex/contrib/sprite/spriteuse.tex b/macros/latex/contrib/sprite/spriteuse.tex
new file mode 100644
index 0000000000..3d8e532735
--- /dev/null
+++ b/macros/latex/contrib/sprite/spriteuse.tex
@@ -0,0 +1,85 @@
+%%%%%%%%%%% SPRITEUSE.TEX %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Example for the use of SPRITE.STY ( Martin Costabel 27-Oct-1987 )
+\documentstyle[12pt,sprite]{article}
+\begin{document}
+\newsavebox{\CalH} \sbox{\CalH}{${\cal H}$} % Get the size of \cal H.
+\newcommand{\ScriptH}% Some fine-tuning of the
+{\raisebox{-0.5 pt}{\SH}\kern 1 pt}% positioning might be necessary
+\sprite{\SH}(33,65)[\wd\CalH, \ht\CalH] % The size will be the same
+ % as for \cal H.
+ % Resolution ca. 250x500 dpi
+:..........BBBBBBBB.............BBB..................BBBBBB....... |
+:........BBBB....BBB..........BBBBB..............BBBBBB...BBBB.... |
+:........BB.......BBB.......BBB.BBB............BBBBBB.......BBBB.. |
+:........BB.......BBB.....BBB..BBBB..........BBBBBB..........BBB.. |
+:........BB.......BBB....BB...BBBB.........BBBBBB............BBBB. |
+:........BB.......BBB...BB....BBBB.........BBBBB.............BBBB. |
+:..................BBBBBB.....BBB.........BBBBB..............BBBB. |
+:............................BBBB........BBBBBB..............BBBB. |
+:...........................BBBB.........BBBBB...............BBBB. |
+:...........................BBBB.........BBBBB...............BBB.. |
+:..........................BBBB.........BBBBB...............BBBB.. |
+:..........................BBBB.........BBBB...............BBBB... |
+:.........................BBBB.........BBBBB..............BBBB.... |
+:.........................BBBB.........BBBB..............BBBB..... |
+:........................BBBBB.........BBBB............BBBBB...... |
+:........................BBBB.........BBBB..........BBBBBB........ |
+:.......................BBBBB.........BBBB.....BBBBBBBB........... |
+:..........BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB................ |
+:.......BBBB...........BBBBB.........BBBB......................... |
+:.....BBBB.............BBBBB........BBBBB......................... |
+:....BBB...............BBBB.........BBBB.......................... |
+:...BB................BBBB.........BBBBB.......................... |
+:..BBB...............BBBBB.........BBBB........................... |
+:.BBB................BBBB..........BBBB........................... |
+:.BBB...............BBBB..........BBBB............................ |
+:BBB...............BBBBB..........BBBB..................B......... |
+:BBB..............BBBBB...........BBBB.................BB......... |
+:BBB.............BBBBB............BBBB................BBB......... |
+:BBB............BBBBB..............BBBB..............BBB.......... |
+:BBB...........BBBBB................BBBB...........BBBB........... |
+:.BBBB........BBBB...................BBBB........BBBB............. |
+:...BBB.....BBBB.......................BBBB....BBBBB.............. |
+:.....BBBBBBB.............................BBBBBBB................. |
+\endsprite
+
+\def\schwa{\FormOfSchwa\kern 1 pt} % Only necessary if \kern... is wanted
+\sprite{\FormOfSchwa}(16,24)[0.4 em, 1 ex] % Resolution ca. 200x340 dpi.
+:.......BBBBBBBBBB....... |
+:....BBBB........BBBB.... |
+:..BBB.............BBBB.. |
+:.BB.................BBB. |
+:.B...................BBB |
+:.....................BBB |
+:.....................BBB |
+:.....................BBB |
+:BBBBBBBBBBBBBBBBBBBBBBBB |
+:BBB..................BBB |
+:BBB..................BBB |
+:BBB.................BBB. |
+:.BBB...............BBB.. |
+:..BBBB...........BBBB... |
+:....BBBBB.....BBBBB..... |
+:.......BBBBBBBB......... |
+\endsprite
+% Now we can use it
+
+\section{Here is a script \protect\ScriptH :} % It is fragile!
+You can use it also in Formulas:
+$$ H \neq \ScriptH \neq {\cal H}$$
+And we defined also some kind of Sch\schwa wa.
+
+\newpage
+\section{\TeX\ capacity exceeded?}
+If you have too many of these on one page, your \TeX\ might give up:
+A \ScriptH \\
+B \schwa \\
+C \ScriptH \
+D \schwa \\
+E \ScriptH \\
+F \schwa \\
+G \ScriptH \ etc.
+\end{document}
+%%%%%%%%%%%%%End of SPRITEUSE.TEX %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%---And Cut here----------------------------------------------------
+