summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/cutwin/cutwin.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-10-30 19:39:58 +0000
committerKarl Berry <karl@freefriends.org>2021-10-30 19:39:58 +0000
commitd73d6bf4e9505d2e144f0aa7ba2068d554a43406 (patch)
tree5ba2e3f25da1f46928c3dec7e38a19d6105de2eb /Master/texmf-dist/tex/latex/cutwin/cutwin.sty
parentf7b4a9a5747d771354b32ab1e1ba9e2dfd405982 (diff)
cutwin (30oct21)
git-svn-id: svn://tug.org/texlive/trunk@60901 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/cutwin/cutwin.sty')
-rw-r--r--Master/texmf-dist/tex/latex/cutwin/cutwin.sty100
1 files changed, 42 insertions, 58 deletions
diff --git a/Master/texmf-dist/tex/latex/cutwin/cutwin.sty b/Master/texmf-dist/tex/latex/cutwin/cutwin.sty
index dcd73b55a1a..cdf1b47bc08 100644
--- a/Master/texmf-dist/tex/latex/cutwin/cutwin.sty
+++ b/Master/texmf-dist/tex/latex/cutwin/cutwin.sty
@@ -11,6 +11,9 @@
%% and Alan Hoenig
%% Copyright 2010 Peter R. Wilson
%%
+%% Current Maintainer David Carlisle
+%% Copyright 2021 Peter R. Wilson, David Carlisle
+%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any
@@ -20,72 +23,65 @@
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2003/06/01 or later.
%%
-%% This work has the LPPL maintenance status "author-maintained".
+%% This work has the LPPL maintenance status "maintained".
%%
%% This work consists of the files listed in the README file.
%% -----------------------------------------------------------------
%%
%% \iffalse meta-comment
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{cutwin}[2010/09/29 v0.1 cutout windows]
-
+\ProvidesPackage{cutwin}[2021/10/13 v0.2 cutout windows]
\newcount\c@twwinlines % window lines
\newcount\c@twtoplines % top lines
\newcount\c@twcnt % a count
-
\newdimen\c@twlftside % left width
\newdimen\c@twrtside % right width
\newdimen\c@twtopht % height of top text
\newdimen\c@twvsilg % Vertical Shift or InterLine Glue
-
\newtoks\c@twtoka % build of parshape spec
\newtoks\c@twtokb % build of parshape spec
-
\newbox\c@twrawtext % text as input
\newbox\c@twholdwin % text for window sides
\newbox\c@twwindow % composed window
\newbox\c@twfinaltext % final assembled cutout paragraph
\newbox\c@twslicea % slice A of window text
\newbox\c@twsliceb % slice B of window text
-
+\newdimen\c@twdima % formally \@tempdimb
+\newdimen\c@twdimb % formally \@tempdimc
\newcommand*{\opencutleft}{\def\c@twl@c{-1}}
\newcommand*{\opencutright}{\def\c@twl@c{1}}
\newcommand*{\opencutcenter}{\def\c@twl@c{0}}
\opencutcenter
-
\newcommand{\cutfuzz}{\vbadness=50000
\hbadness=50000
\sloppy}
-
\newcommand*{\c@twcalcilg}{%
\c@twvsilg=\baselineskip
- \setbox0=\hbox{(}
+ \setbox0=\hbox{(}%
\advance\c@twvsilg-\ht0 \advance\c@twvsilg-\dp0}
-
\newcommand*{\pageinwindow}{%
- \@tempdimc=\c@twwinlines\baselineskip % cutout height
- \@tempdimb=\hsize
+ \c@twdimb=\c@twwinlines\baselineskip % cutout height
+ \c@twdima=\hsize
\ifnum\c@twl@c=\m@ne % openleft
- \advance\@tempdimb -\c@twrtside
+ \advance\c@twdima -\c@twrtside
\else
\ifnum\c@twl@c=\@ne % openright
- \advance\@tempdimb -\c@twlftside
+ \advance\c@twdima -\c@twlftside
\else% center
- \advance\@tempdimb - \c@twlftside
- \advance\@tempdimb - \c@twrtside
+ \advance\c@twdima - \c@twlftside
+ \advance\c@twdima - \c@twrtside
\fi
\fi
\begin{picture}(0,0)%
\put(0,0){%
\raisebox{4pt}{%
- \begin{minipage}[t][\@tempdimc][c]{\@tempdimb}
+ \begin{minipage}[t][\c@twdimb][c]{\c@twdima}%
\windowpagestuff
- \end{minipage}
+ \end{minipage}%
}% end raisebox
}% end put
\end{picture}}
\newcommand*{\windowpagestuff}{}
-
\newenvironment{cutout}[4]{%
\cutfuzz
\c@twtoplines=#1\relax
@@ -111,18 +107,17 @@
\fi
\setbox\c@twholdwin=\vsplit\c@twrawtext to\c@twtopht
\ifnum\c@twl@c=\z@% center
- \c@twcompctr{\c@twholdwin}{\c@twwindow}
+ \c@twcompctr{\c@twholdwin}{\c@twwindow}%
\else% left or right
- \c@twcomplftrt{\c@twholdwin}{\c@twwindow}
+ \c@twcomplftrt{\c@twholdwin}{\c@twwindow}%
\fi
\setbox\c@twfinaltext=
\vbox{\ifnum\c@twtoplines>\z@\unvbox\c@twfinaltext\vskip\c@twvsilg\fi
\unvbox\c@twwindow%
\vskip-\c@twvsilg\unvbox\c@twrawtext}%
\box\c@twfinaltext}
-
\newcommand*{\c@twcompctr}[2]{%
- \def\c@twfirst{1}
+ \def\c@twfirst{1}%
\loop\advance\c@twwinlines\m@ne
\setbox\c@twslicea=\vsplit#1 to\baselineskip
\setbox\c@twsliceb=\vsplit#1 to\baselineskip
@@ -135,15 +130,14 @@
\setbox#2=\vbox{\unvbox#2\hbox
to\hsize{\box\c@twslicea\hfil\box\c@twsliceb}}%
\fi
- \def\c@twfirst{2}
+ \def\c@twfirst{2}%
\ifnum\c@twwinlines>\z@\repeat}
-
\newcommand*{\c@twcomplftrt}[2]{%
\def\c@twfirst{1}%
\loop\advance\c@twwinlines\m@ne
\setbox\c@twslicea=\vsplit#1 to\baselineskip
\ifnum\c@twl@c=\m@ne% open left, text at right
- \c@twprune{\c@twslicea}{\c@twrtside}
+ \c@twprune{\c@twslicea}{\c@twrtside}%
\ifnum\c@twfirst=\@ne
\setbox#2=\vbox{\unvbox#2\hbox
to\hsize{\pageinwindow\hfil\box\c@twslicea}}%
@@ -151,10 +145,10 @@
\setbox#2=\vbox{\unvbox#2\hbox
to\hsize{\mbox{}\hfil\box\c@twslicea}}%
\fi
- \def\c@twfirst{2}
+ \def\c@twfirst{2}%
\else
\ifnum\c@twl@c=\@ne% open right, text at left
- \c@twprune{\c@twslicea}{\c@twlftside}
+ \c@twprune{\c@twslicea}{\c@twlftside}%
\ifnum\c@twfirst=\@ne\relax
\setbox#2=\vbox{\unvbox#2\hbox
to\hsize{\box\c@twslicea\pageinwindow}}%
@@ -162,15 +156,13 @@
\setbox#2=\vbox{\unvbox#2\hbox
to\hsize{\box\c@twslicea}}%
\fi
- \def\c@twfirst{2}
+ \def\c@twfirst{2}%
\fi
\fi
\ifnum\c@twwinlines>\z@\repeat}
-
\newcommand*{\c@twprune}[2]{%
\unvbox#1 \setbox#1=\lastbox % \box#1 is now an \hbox
\setbox#1=\hbox to#2{\strut\unhbox#1\unskip}}
-
\newcommand*{\c@twmakeparspec}{%
\c@twcnt=\c@twwinlines
\ifnum\c@twl@c=\z@
@@ -178,7 +170,7 @@
\fi
\advance\c@twcnt by \c@twtoplines \advance\c@twcnt by \@ne
\ifnum\c@twtoplines>\z@
- \loop\c@twtoka=\expandafter{\the\c@twtoka 0pt \hsize}
+ \loop\c@twtoka=\expandafter{\the\c@twtoka 0pt \hsize}%
\advance\c@twtoplines -1\relax
\ifnum\c@twtoplines>\z@\repeat
\fi
@@ -188,18 +180,17 @@
\fi
\loop\c@twtoka=%
\ifnum\c@twl@c=\m@ne % openleft
- \expandafter{\the\c@twtoka \c@twlftside \c@twrtside}
+ \expandafter{\the\c@twtoka \c@twlftside \c@twrtside}%
\else
\ifnum\c@twl@c=\@ne % openright
- \expandafter{\the\c@twtoka 0pt \c@twlftside}
+ \expandafter{\the\c@twtoka 0pt \c@twlftside}%
\else %center
- \expandafter{\the\c@twtoka 0pt \c@twlftside 0pt \c@twrtside}
+ \expandafter{\the\c@twtoka 0pt \c@twlftside 0pt \c@twrtside}%
\fi
\fi
\advance\c@twwinlines \m@ne
\ifnum\c@twwinlines>\z@\repeat
\c@twtoka=\expandafter{\the\c@twtoka 0pt \hsize}}
-
\newcommand*{\c@twcalcshift}{% vertical shift
\c@twvsilg=\c@twwinlines\baselineskip
\ifnum\c@twtoplines<\@ne
@@ -209,13 +200,11 @@
\ifnum\c@twl@c=\z@\else
\c@twvsilg=0.5\c@twvsilg
\fi}
-
\newcommand*{\picinwindow}{%
\begin{picture}(0,0)
\putstuffinpic
\end{picture}}
\newcommand*{\putstuffinpic}{}
-
\newenvironment{shapedcutout}[3]{%
\cutfuzz
\c@twtoplines=#1\relax
@@ -240,16 +229,15 @@
\fi
\setbox\c@twholdwin=\vsplit\c@twrawtext to\c@twtopht
\ifnum\c@twl@c=\z@% center
- \c@twcompoddctr{\c@twholdwin}{\c@twwindow}
- \else% open left or righyt
- \c@twcompoddlftrt{\c@twholdwin}{\c@twwindow}
+ \c@twcompoddctr{\c@twholdwin}{\c@twwindow}%
+ \else% open left or right
+ \c@twcompoddlftrt{\c@twholdwin}{\c@twwindow}%
\fi
\setbox\c@twfinaltext=
\vbox{\ifnum\c@twtoplines>\z@\unvbox\c@twfinaltext\vskip\c@twvsilg\fi
\unvbox\c@twwindow%
\vskip-\c@twvsilg\unvbox\c@twrawtext}%
\box\c@twfinaltext}
-
\newcommand*{\c@twmaketopoddspec}{%
\c@twcnt=\c@twwinlines
\ifnum\c@twl@c=\z@
@@ -257,45 +245,42 @@
\fi
\advance\c@twcnt by \c@twtoplines \advance\c@twcnt by \@ne
%% \c@twcnt is total of toplines + 2(window lines) + 1
- \c@twtoka={}
+ \c@twtoka={}%
\ifnum\c@twtoplines>\z@
- \loop\c@twtoka=\expandafter{\the\c@twtoka 0pt \hsize}
+ \loop\c@twtoka=\expandafter{\the\c@twtoka 0pt \hsize}%
\advance\c@twtoplines -1\relax
\ifnum\c@twtoplines>\z@\repeat
\fi}
-
\newcommand*{\c@twaddtospec}[1]{%
\c@twtokb=\c@twxpf{\the\c@twtokb 0pt #1 }}
\let\c@twxpf\expandafter
\newcommand*{\c@twbuildoddspec}[1]{%
- \c@twtokb={}
+ \c@twtokb={}%
\@for\c@twlspec:=#1\do{%
\c@twxpf\c@twxpf\c@twxpf\c@twaddtospec\c@twxpf{\c@twlspec}}}
-
\newcommand*{\c@twcompoddctr}[2]{%
- \def\c@twrounds{1}
- \def\c@twfirst{1}
+ \def\c@twrounds{1}%
+ \def\c@twfirst{1}%
\@for\c@twlspec:=\c@twb\do{%
\ifnum\c@twrounds=1
\setbox\c@twslicea=\vsplit#1 to\baselineskip % first of pair
\c@twprune{\c@twslicea}{\c@twlspec}%
- \def\c@twrounds{2}
+ \def\c@twrounds{2}%
\else
\setbox\c@twsliceb=\vsplit#1 to\baselineskip % second of pair
\c@twprune{\c@twsliceb}{\c@twlspec}%
\ifnum\c@twfirst=1
\setbox#2=\vbox{\unvbox#2\hbox
to\hsize{\box\c@twslicea\hfil\picinwindow\hfil\box\c@twsliceb}}%
- \def\c@twfirst{2}
+ \def\c@twfirst{2}%
\else
\setbox#2=\vbox{\unvbox#2\hbox
to\hsize{\box\c@twslicea\hfil\box\c@twsliceb}}%
\fi
- \def\c@twrounds{1}
+ \def\c@twrounds{1}%
\fi}}
-
\newcommand*{\c@twcompoddlftrt}[2]{%
- \def\c@twfirst{1}
+ \def\c@twfirst{1}%
\@for\c@twlspec:=\c@twb\do{%
\setbox\c@twslicea=\vsplit#1 to\baselineskip % get a line
\c@twprune{\c@twslicea}{\c@twlspec}%
@@ -303,7 +288,7 @@
\ifnum\c@twfirst=1
\setbox#2=\vbox{\unvbox#2\hbox
to\hsize{\mbox{}\hfil\picinwindow\hfil\box\c@twslicea}}%
- \def\c@twfirst{2}
+ \def\c@twfirst{2}%
\else
\setbox#2=\vbox{\unvbox#2\hbox
to\hsize{\mbox{}\hfil\box\c@twslicea}}%
@@ -313,14 +298,13 @@
\ifnum\c@twfirst=1
\setbox#2=\vbox{\unvbox#2\hbox
to\hsize{\box\c@twslicea\hfil\picinwindow\hfil}}%
- \def\c@twfirst{2}
+ \def\c@twfirst{2}%
\else
\setbox#2=\vbox{\unvbox#2\hbox
to\hsize{\box\c@twslicea\hfil}}%
\fi
\fi
\fi}}
-
\endinput
%%
%% End of file `cutwin.sty'.