summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/shapepar
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2006-11-25 04:26:32 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2006-11-25 04:26:32 +0000
commit82db8f99deb2aff5f2ccc4f896b7431d93147fa7 (patch)
treeed19c96064a701aa73b1d6dd6f973df09e408369 /Master/texmf-dist/tex/generic/shapepar
parentec573a613cbc9a1c6d7f9d9497a8b9dcd5312b42 (diff)
update shapepar.
git-svn-id: svn://tug.org/texlive/trunk@2523 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/shapepar')
-rw-r--r--Master/texmf-dist/tex/generic/shapepar/shapepar.sty423
1 files changed, 135 insertions, 288 deletions
diff --git a/Master/texmf-dist/tex/generic/shapepar/shapepar.sty b/Master/texmf-dist/tex/generic/shapepar/shapepar.sty
index c64fc6dccdc..cef41e5b84f 100644
--- a/Master/texmf-dist/tex/generic/shapepar/shapepar.sty
+++ b/Master/texmf-dist/tex/generic/shapepar/shapepar.sty
@@ -2,9 +2,9 @@
%
% Typeset paragraphs in various shapes.
%
-% Version 2.0 (Dec 2002)
+% Version 2.1 (Sept 2006)
%
-% Copyright (c) 1993,2002 Donald Arseneau
+% Copyright (c) 1993,2002,2006 Donald Arseneau
% These definitions may be freely transmitted, reproduced, or modified
% provided that any modifications are clearly identified and this notice
% is left intact.
@@ -12,11 +12,11 @@
% \shapepar: a macro to typeset paragraphs in a specific shape. The
% size is adjusted automatically so that the entire shape is filled
% with text. There can be no displayed math, and no "\vadjust"
-% material (no "\vspace"). These macros work for both LaTeX and Plain
-% TeX. For LaTeX, specify \usepackage{shapepar}, or for Plain,
+% material (no "\vspace"). These macros work for both LaTeX and plain
+% TeX. For LaTeX, specify \usepackage{shapepar}, or for either,
% \input shapepar.sty . Configuration parameters are set just
% below here. Instructions for use are given in the LaTeX document
-% shapepar.tex; a short summary is given after \endinput below.
+% shapepar.ltx; a short summary is given after \endinput below.
%
% ToDo:
% Vertical correction for character height applied to shape.
@@ -31,10 +31,10 @@
\edef\squarepar
{\catcode\string `\string @ \the\catcode `\@
\catcode\string `\string $ \the\catcode `$
- \catcode\string `\string * \the\catcode `\*
+ \catcode\string `\string ! \the\catcode `\!
\catcode\string `\string ^ \the\catcode `\^}
\catcode\string`\@=11 \catcode\string`\$=11
-\catcode\string`\^=14 \catcode\string`\*=10
+\catcode\string`\^=14 \catcode\string`\!=10
% ------ Configuration parameters ------
@@ -64,8 +64,8 @@
% --------------------------------------
\ifx\DeclareOption\undefined\else
- \ProvidesPackage{shapepar}[2002/12/30 v 2.0, Shaped paragraphs]
- \DeclareOption{quiet}{\catcode`\*=14}
+ \ProvidesPackage{shapepar}[2006/09/11 v 2.1, Shaped paragraphs]
+ \DeclareOption{quiet}{\catcode`\!=14}
\DeclareOption{noisy}{\catcode`\^=10}
\ProcessOptions
@@ -172,8 +172,7 @@
% \spaceskip .333333emplus.8emminus.15em % optimise stretch
\parfillskip\z@ plus\@ne fil
\begingroup
- \linepenalty\@m
- \def\\{\unskip\penalty-200 \hskip1em plus\@m\p@ \penalty-60 }%
+ \linepenalty\@m \let\\\SH@newline
\let\par\SH@endpar \hsize\maxdimen \rightskip\spaceskip
\pretolerance\m@ne \hyphenpenalty 9000 % make discretionaries
\ifx\textwidth\undefined\else \textwidth\hsize
@@ -186,19 +185,22 @@
\def\SH@dm{display-math}
+% Explicit \\ commands insert a marker (kern) that will later preserve a line-break
+\def\SH@newline{\unskip\hfill\kern9sp\break\ignorespaces}
+
\def\SH@endpar{% Insert filler for fixed-scale paragraphs
\ifdim\SH@scale>\z@ \def~{\hfil\null\hfil\null\hfil\null\hfil\null}%
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\fi
\xdef\SH@baseset{\noexpand\baselineskip\the\baselineskip \relax}%
\endgraf \endgroup % still inside \vbox and \begingroup
\SH@baseset
- \global\SH@dscale\z@
% get tottext = total length / 256 because total length may be > \maxdimen
\setbox\@tempboxa\box\voidb@x \global\SH@tottext\z@
\SH@sumlines % combine multiple lines -> \@tempboxa; width/256 ->\SH@tottext
-^ \message{total length = 256 times \the\SH@tottext;
-^ \string\baselineskip=\the\baselineskip;
-^ and spec height = \Pointless\spec@height. }%
+^ \message{total text length = \the\wd\@tempboxa, or 256 x \the\SH@tottext;
+^ \string\baselineskip=\the\baselineskip;}%
+^ {\let\\\relax\message{Spec is: \SH@spec}}%
+^ \message{spec height = \Pointless\spec@height. }%
\unskip\unkern\unpenalty\unskip\unkern\unpenalty
\setbox\SH@boxa\box\@tempboxa % all the text
\ifdim\SH@scale>\z@ % for specified fixed scale: only format once
@@ -206,17 +208,23 @@
\else % Automatic scaling. Get a first-guess scale
% Get 1/256 of total segment length into \@tempdima
\@tempdima\z@ \spec@prevpos\z@
-^ {\let\\relax\message{Measure area of spec: \SH@spec}}%
\expandafter\SH@measline\SH@spec \\\delimiter
^ \message{Spec area/256 = \Pointless\@tempdima}%
-% scale = 1.02 * sqrt( [text_length/256]*\baselineskip / [spec_area/256] )
- \SH@scale \Pointless\SH@tottext\baselineskip
+% scale = 1.01 * sqrt( [text_length/256]*\baselineskip / [spec_area/256] )
+% Pull out some large factors from square-root to extend numeric range
+% available for division.
+ \SH@dscale=1.01\p@ % optimize
+ \loop \if\AbsVal\@tempdima<\p@
+ \multiply\@tempdima\@cclvi \multiply\SH@dscale\sixt@@n
+ \repeat
+ \SH@scale=\Pointless\SH@tottext\baselineskip
\fpdivide\SH@scale\@tempdima
\sqrtofdim\SH@scale
- \SH@scale 1.0\SH@scale % optimize
+ \SH@scale=\Pointless\SH@dscale\SH@scale
^ \message{Initial scale = \the\SH@scale}%
\global\SH@ntries\z@ % will count maximum \ScaleMaxTries trial scales
\fi
+ \global\SH@dscale\z@
\SH@parpars \SH@tryparshape}
% Measure the area covered by segments in the shape spec. Accumulate
@@ -232,7 +240,12 @@
\expandafter\SH@measline
\fi {#3}}
-\def\SH@measseg#1t#2#3{%
+% Recursively measure and accumulate widths of text segments on a line.
+% Invoke as \SH@measseg <segments>t\fam\fam, as the "t\fam\fam" serves
+% as an end-marker. All the widths are scaled by a factor \@tempa and
+% added to \@tempdima. (Overwrites \@tempdimb.)
+
+\def\SH@measseg#1t#2#3{% #1 = stuff before "t", #2,#3 = posn,wid
\ifx \fam #3\else
\@tempdimb #3\p@
\advance\@tempdima\@tempa\@tempdimb
@@ -251,8 +264,8 @@
\def\SH@tryparshape{%
\advance\SH@scale\SH@dscale % shift scale factor by delta
^ \message{------------------------------------------------------------------------}%
-* \message{(\the\SH@ntries) Try shape with scale \the\SH@scale. \space
-* (Delta = \Pointless\SH@dscale). \space }%
+! \message{(\the\SH@ntries) Try shape with scale \the\SH@scale. \space
+! (Delta = \Pointless\SH@dscale). \space }%
\spec@incr\baselineskip \fpdivide\spec@incr\SH@scale
\spec@position\spec@height \advance\spec@position-.3\spec@incr % height-delta
\SH@nline\spec@position \divide\SH@nline\spec@incr % number of lines
@@ -366,7 +379,7 @@
\def\SH@updps{% Update parshape with `new' info
^\message{Segment \Pointless\SH@posold, \Pointless\SH@widold}%
\ifdim\SH@widold>\SmallestSegment
-* \message{.}%
+! \message{.}%
\xdef\SH@parshape{\SH@parshape\the\SH@posold\the\SH@widold\space}%
\xdef\SH@lines{\@elt{\the\SH@nline}{\the\SH@posold}{\the\SH@widold}\SH@lines}%
\advance\SH@npslines\@ne
@@ -417,16 +430,16 @@
\advance\SH@npslines\@ne
\parshape\the\SH@npslines\space \SH@parshape \z@ \maxdimen
\advance\SH@npslines\m@ne
-* \message{Formatting. }%
+! \message{Formatting. }%
\noindent \unhcopy\SH@boxa \endgraf
-* \message{Expected \the\SH@npslines\space lines;
-* got \the\prevgraf\space lines}%
+! \message{Expected \the\SH@npslines\space lines;
+! got \the\prevgraf\space lines}%
\ifnum\prevgraf=\SH@npslines % maybe right size; check last line
\ifdim\SH@widseg>\z@ % yes, we can check
\ifnum\SH@ntries<\ScaleMaxTries % safe to screw around with \SH@npslines
\SH@grablast \@tempdima\wd\SH@boxa \advance\@tempdima 20\p@
\ifdim\@tempdima<.8\SH@widseg % final line underfull % optimise
-* \message{but the last line is too empty. }%
+! \message{but the last line is too empty. }%
\advance\SH@npslines\@ne % flag underfullness
\fi\fi\fi\fi
\ifnum\prevgraf=\SH@npslines % right size, done
@@ -487,12 +500,13 @@
\fi}
\def\SH@parpars{%
- \lineskiplimit-99\p@ \linepenalty\thr@@
+ \lineskiplimit-0\p@ \linepenalty\thr@@
\tolerance9999
\ifx\emergencystretch\undefined % TeX2
\rightskip\z@ plus.5emminus.2em % optimise
\else \rightskip\z@skip \emergencystretch 3em % TeX 3
- \fi \pretolerance\m@ne \hbadness\@MM % avoid error messages
+ \fi \pretolerance\m@ne
+ \hbadness\@MM \hfuzz\maxdimen % avoid formatting warning messages
\SH@baseset
}
@@ -500,7 +514,6 @@
\skip@ 1spplus2\p@ minus\p@
\parfillskip.5\maxdimen % this will drag text to the bottom point.
\advance\SH@npslines\@ne
-% \message{Parshape: \parshape\the\SH@npslines\space \SH@parshape 0 .5\maxdimen. }%
\SH@reform % reformat paragraph with new parfillskip
\ifx\SH@usebox\box % boxed \Shapepar: find min pos
\let\@elt\SH@measureh \SH@posold\maxdimen \SH@lines
@@ -509,10 +522,10 @@
\fi
% {\let\@elt\relax \message{SH@lines: \SH@lines. }}%
\SH@nline\m@ne \SH@highline-\@m \SH@lowline\m@ne \let\@elt\SH@restack
-* \message{Restacking.}%
+^ \message{Restacking.}%
% re-stack segments and re-justify lines; put in \vtop or \vbox appropriately
\global\setbox\SH@boxb \ifx\SH@margin\@empty \vbox \else \vtop \fi {%
- \setbox\SH@boxa\vbox{}\leftskip\z@ plus55sp minus5\p@ % optimise
+ \setbox\SH@boxa\vbox{}\leftskip=\z@ plus55sp minus99sp % optimise
\unvbox\SH@boxb
\SH@lines \unvbox\SH@boxa
\ifnum\SH@highline<\SH@lowline
@@ -561,14 +574,15 @@
\def\SH@reform{%
\global\setbox\SH@boxb\vbox\bgroup
-* \message{Reformat paragraph with \string\rightskip = \the\rightskip.}%
+! \message{Reformat paragraph with \string\rightskip = \the\rightskip.}%
\advance\parfillskip-\rightskip \advance\parfillskip-\leftskip
\parshape\the\SH@npslines\space \SH@parshape \z@ .5\maxdimen
%% Maybe use prevdepth from outside, penalty puts \parskip and favors breaks
\ifx\SH@margin\@empty \ifx\SH@usebox\unvbox
\prevdepth\SH@pd \ifdim\SH@pd>-\@m\p@ \penalty-50 \fi
- \fi \fi
- \noindent \unhcopy\SH@boxa \unskip\unskip\unpenalty\strut
+ \fi \fi
+ \noindent \unhcopy\SH@boxa \unskip\unskip\unpenalty
+ \lower\dp\strutbox\hbox{}% depth-only strut (\@finalstrut not defined in plain TeX)
\penalty-\@M\hbox{\kern\maxdimen}\endgraf
\ifnum\prevgraf=\SH@npslines % good, it worked.
\setbox\SH@boxa\lastbox \unskip\unpenalty % remove mongo last box
@@ -686,8 +700,10 @@
\@tempdima\wd\SH@boxa \divide\@tempdima\@cclvi
\global\advance\SH@tottext\@tempdima
\setbox\@tempboxa\hbox{%
- \ifvoid\@tempboxa\else \unhbox\@tempboxa\space \fi
- \unhbox\SH@boxa}%
+ \unhbox\SH@boxa
+ \ifdim\lastkern=9sp \hfill\break \fi
+ \ifvoid\@tempboxa\else \unhbox\@tempboxa \fi
+ }% Repeat until complete:
\expandafter\SH@sumlines
\fi}
@@ -906,7 +922,6 @@
-\newcount\FPD@hi \FPD@hi=67108863
% Approximate Fixed Point Division of two dimensions
% 3.14159/2.71828 = 1.15573
@@ -916,20 +931,35 @@
% as an explicit *integer* string, "123", which is treated as 0.001877
% = 123/65536.) % \@tempcntb is used and altered.
%
-\def\fpdivide#1#2{\let\FPD@nume#1\@tempcntb#2\relax
- \FPD@scale\FPD@scale\FPD@scale\FPD@scale
- \divide#1\@tempcntb}
-
-% Rescale numbers to preserve accuracy. The number 16 is the level of
-% uncertainty. Use a lower power of 2 for more accuracy (2 is most precise).
-% But if you change it, you must change the repetions of \FPD@scale in
-% \fpdivide above: magic_number^repetitions = 65536 (16^4 = 65536).
-%
-\def\FPD@scale{\ifnum\AbsVal\FPD@nume<\FPD@hi
- \multiply\FPD@nume\sixt@@n
- \else
- \divide\@tempcntb\sixt@@n
- \fi}
+\ifx\dimexpr\undefined % Use original TeX's integer \divide
+
+ \def\fpdivide#1#2{\let\FPD@nume#1\@tempcntb#2\relax
+ \FPD@scale\FPD@scale\FPD@scale\FPD@scale
+ \FPD@scale\FPD@scale\FPD@scale\FPD@scale
+ \divide#1\@tempcntb}
+
+ % Rescale numbers to preserve accuracy. The magnum is the level of
+ % uncertainty. Use a lower power of 2 for more accuracy (2 is most precise).
+ % But if you change it, you must change the repetions of \FPD@scale in
+ % \fpdivide above: magic_number^repetitions = 65536 (16^4 = 4^8 = 65536).
+ %
+ \chardef\FPD@magnum=4
+ \newcount\FPD@hi \FPD@hi=\maxdimen \divide\FPD@hi\FPD@magnum
+
+ \def\FPD@scale{%
+ \ifnum\AbsVal\FPD@nume<\FPD@hi
+ \multiply\FPD@nume\FPD@magnum
+ \else
+ \divide\@tempcntb\FPD@magnum
+ \fi}
+
+\else % Else, use eTeX's \dimexpr
+
+ \def\fpdivide#1#2{\@tempcntb#2\relax
+ #1=\dimexpr #1*\p@/\@tempcntb \relax
+ }
+
+\fi
% take absolute value of TeX number or dimension (dimen must be a register)
\def\AbsVal#1{\ifnum#1<\z@-\fi#1}
@@ -955,6 +985,14 @@
}
\def\squarepar#1{\shapepar{\squareshape}#1\par}
+\def\rectangleshape#1#2{% <height> <width>
+ {0}% "center" the left edge... sorry, better use \Shapepar
+ {0}b{0}\\%
+ {0}t{0}{#2}\\%
+ {#1}t{0}{#2}\\%
+ {#1}e{0}%
+}
+
\def\heartshape{%
{20}{0}b{13.32}b{26.68}%
\\{.14}t{10.12}{4.42}t{25.46}{4.42}%
@@ -1028,6 +1066,17 @@
}
\def\nutpar#1{\Shapepar\nutshape #1\par}
+% Just the nut shape with the central hole erased:
+\def\hexagonshape{%
+{0}%
+{0}b{0}\\%
+{0}t{-12.5}{25}\\%
+{21.65}t{-25}{50}\\%
+{43.3}t{-12.5}{25}\\%
+{43.3}e{0}%
+}
+\def\hexagonpar#1{\Shapepar\hexagonshape #1\par}
+
\def\CDlabshape{%
{0}%
{-5.5}b{0}\\%
@@ -1065,256 +1114,54 @@
%-------------------------------------------------------------------
- S H A P E P A R . S T Y -- Instructions
+ S H A P E P A R . S T Y -- Short Instructions
\shapepar is a macro to typeset paragraphs of a specified shape.
-The total size is adjusted automatically so that the entire shape is
-filled with text. This is distinct from the normal \parshape command
-which specifies a shape *and* a size, which may be only partially
-filled, or over-filled, from top to bottom. In a \shapepar there
-can be no displayed math, and no "\vadjust" material, (including
-"\vspace"). \Shapepar (capital S) is just like \shapepar except the
-paragraph is boxed and not centered. Shaping paragraphs this way is a
-slow process, so this is mainly intended for cards, invitations etc.,
-not for whole books! Although short paragraphs process much faster,
-only long paragraphs accurately fill complex shapes.
-
-These macros work for both LaTeX and plain TeX. For LaTeX, specify
-\usepackage{shapepar}, or for either, \input shapepar.sty.
-
-The command \shapepar should be used at the beginning of a paragraph,
-and it applies to the entire paragraph. There is one optional length
-parameter -- a fixed scale, <scale>, and one required parameter -- a
-description of the shape, <shape_spec>.
+
+See shapepar.ltx (or shapepar.pdf etc) for full instructions.
+
+Loading:
+
+plain TeX: \input shapepar.sty
+
+LaTeX: \usepackage{shapepar}
+
+LaTeX package options: [quiet], [noisy]
+
+Usage:
\shapepar [<scale>]{<shape_spec>} Text of the paragraph...
-The text of the paragraph is not literally a *parameter*, so verbatim
-macros will work there.
-
-Ordinarily, the scale is calculated automatically so the pargaraph
-fills the shape. If a scale length is given, then the shape is
-reproduced so one unit of the <shape_spec> equals the <scale>, and
-the shape is filled with whitespace after the paragraph text.
-
-The <shape_spec> parameter is very complex, but there are a few
-shapes predefined as macros in this file: \diamondshape, \heartshape
-and \nutshape, which are used as examples in the instructions below.
-There are also commands to use these shapes: \diamondpar, \squarepar
-and \heartpar; for example, \heartpar begins \shapepar{\heartshape}#1
-so you can use it like:
-
-\heartpar{This paragraph is too short to be recognized as a heart shape.}
-
-The syntax rules for <shape_spec> are very specific, and must be
-followed closely. (In these rules, { } mean explicit braces, [ ]
-denote optional parts, < > surround a keyword that is defined (perhaps
-loosely), and | means "or"; do not type [ ] < > or |, but do type { }.)
-
-<shape_spec> = {<h_center>} <lines>
-
-<lines> = <line_spec> [\\<lines>]
-
-That is, the shape is specified as a single number in braces, followed
-by the specifications for the lines, with the lines separated by \\. The
-final paragraph will have its <h_center> position centered on the page.
-<h_center> is a number (like 10.5) of arbitrary units; whatever units
-are used for lengths and positions in the <lines>, they just need to be
-consistent.
-
-The lines in the spec are not lines of text; nor are they the lines
-that you would use to draw the shape itself. They are horizontal
-scans across the shape at irregular intervals. Curved shapes need
-many scan lines for accurate rendering while simple shapes need only
-a few. To determine the line specifications, start by drawing the
-shape on paper, then draw a series of horizontal lines across it,
-including lines that just touch the top and the bottom of the figure.
-Each line crosses over pieces of the figure in some region. These
-intersections of line and figure define a <line_spec>.
-
-<line_spec> = {<v_pos>} <segment> [ other <segment>s ]
-
-The <v_pos> is the vertical position of the line. Each <line_spec> must
-usually have a position greater than or equal to that of the previous
-line, and with all <v_pos> > -1000. The exception is that between consecutive
-lines relating to completely disconnected parts of the figure the <vpos>
-may decrease (backspacing). Position is measured from top to bottom, and
-always moving down. Each <segment> represents a region where text will
-go in the final paragraph; it is the segment of the horizontal scan line
-that overlaps the body of the figure. There are five types of segment:
-
-<segment> = t{pos}{len} | b{pos} | e{pos} | s | j
-
- b{pos} begin text at a point at horizontal position pos
- e{pos} end text at a point at horizontal position pos
- t{pos}{len} make a block of text at position pos with length len
- s split text (begin whitespace)
- j join two text blocks (end a gap)
-
-The most common type of segment is t (text). The other types are
-degenerate in that they are single points rather than finite segments.
-Types s and j have no explicit position, but they must appear between
-text segments, and those texts should abut; e.g., t{3}{2}st{5}{4}
-(text from 3 to 5 and text from 5 to 9).
-
-Let's jump right into a simple example, and the meanings will be
-clearer. A "diamond" shape can have the four vertices:
-
- (x=1,y=0)
- .
- +---> x
- ! (0,1) . . (2,1)
- !
- V y .
- (1,2)
-
-
-This shape can be exactly specified by just three scan lines passing
-through the vertices. The specification is:
-
-{1}% h_center: x = 1
-{0}b{1}\\% text block begins at point y=0, x=1
-{1}t{0}{2}\\% this scan (at y=1) crosses text (len=2) starting at x=0
-{2}e{1} text block ends at point y=2, x=1
-
-Other specification lines, like
-
-{1.5}t{0.5}{1}\\%
-
-could be inserted, but would make no difference--the shape is
-interpolated linearly between scan lines.
-
-Every block of text must start with a b specifier and end with an e
-spec on some line below. Every segment specified by t must have a
-length greater than zero. If two blocks of text merge to form one (like
-at the notch of a heart shape) there should be a j spec at the point of
-junction. If one block bifurcates (like at the top of a hole in a
-doughnut) there should be an s spec.
-
-Thus, the first line for any valid shape description must consist
-of only b segment descriptors; the last line can only have e type
-descriptors. Although the definition of the units is arbitrary, the
-numbers should range in magnitude from ~.1 - 100 to avoid numeric
-overflows and underflows.
-
-If there are errors in the format of the specification, \shapepar
-might complain with the error message
-
- Shaped Paragraph Error: Error in specification. Check carefully!
-
-At this point you may as well type x or e, as there is very little
-chance that TeX will continue successfully. You might also get one
-of TeX's regular error messages, like
-
- Illegal unit of measure (pt inserted).
-or
- Missing number, treated as zero.
-
-or you might get no error message at all, just ridiculous formatting.
-Check shape syntax carefully against the rules and the examples before
-running them through TeX.
-
-What to do if the figure does not start at a point--if it has a flat
-top? It can start at a single point, but have the next scan line at
-the same vertical position! A square paragraph is specified by:
-
- {1}% centerline at x=1 (x=1 is horizontally centered on page)
- {0}b{0}\\% begin at (0,0)
- {0}t{0}{2}\\% text at y=0, width=2
- {2}t{0}{2}\\% text at y=2, width=2
- {2}e{1}% end at (1,2)
+The <scale> is a length (like \unitlength for the picture environment)
+used for scaling the <shape_spec> to positions on the page. When the
+<scale> parameter is absent, the scaling is adjusted automatically so
+that the entire shape is filled with text.
-Both \diamondpar and \squarepar are defined above as paragraphs with
-these shapes.
+\Shapepar (capital S) is just like \shapepar except the paragraph
+is boxed and not centered.
-Now let's get more ambitious. A heart shape must have two simultaneous
-beginnings, a short stretch of separate text, ending with a join,
-whereafter there is just one stretch of text leading to the final
-bottom point. This shape has many scan lines so that the smooth
-flowing curves are preserved.
+\cutout {<side>} (<hoffset>,<voffset>) \shapepar...as above...
-\def\heartshape{%
-{20}{0}b{13.32}b{26.68}%
-\\{.14}t{10.12}{4.42}t{25.46}{4.42}%
-\\{.7}t{9.14}{7.16}t{23.7}{7.16}%
-\\{1.4}t{8.4}{9.02}t{22.58}{9.02}%
-\\{2.1}t{7.82}{10.42}t{21.76}{10.42}%
-\\{2.8}t{7.36}{11.58}t{21.06}{11.58}%
-\\{3.5}t{6.98}{12.56}t{20.46}{12.56}%
-\\{4.2}t{6.68}{13.32}jt{20}{13.32}%
-\\{4.9}t{6.48}{27.04}%
-\\{5.6}t{6.34}{27.32}%
-\\{6.3}t{6.28}{27.44}%
-\\{7}t{6.26}{27.48}%
-\\{7.7}t{6.27}{27.46}%
-\\{8.4}t{6.32}{27.36}%
-\\{9.1}t{6.4}{27.2}%
-\\{9.8}t{6.52}{26.96}%
-\\{10.5}t{6.68}{26.64}%
-\\{11.9}t{7.12}{25.76}%
-\\{13.3}t{7.72}{24.56}%
-\\{14.7}t{8.51}{22.98}%
-\\{16.1}t{9.5}{21}%
-\\{17.5}t{10.69}{18.62}%
-\\{18.9}t{12.08}{15.84}%
-\\{20.3}t{13.7}{12.6}%
-\\{21.7}t{15.62}{8.76}%
-\\{22.4}t{16.7}{6.6}%
-\\{23.1}t{17.87}{4.26}%
-\\{24.6}e{20}%
-}
+This cuts out a section of the surrounding text to fit the shaped par.
+The <side> is l (left) or r (right). The pair of offsets is optional.
-Look at \heartshape and find the two b specifiers at the beginning; find
-the j a few lines below. Notice that above the j there are two segments
-per line, but only one below it; the text to the left and right of the
-join meet at the join point: 20. I drew this heart freehand, and measured
-lengths from the sketch, so you should be able to do better!
-
-Text can have holes. For example, a doughnut-shape would have a b on
-the first line, followed by some lines with a single t, then a line with
-t s t at the start of the hole. The hole is represented by lines with two
-t specs--the gap between them is the hole. A line with t j t ends the
-hole. There are more lines with single t, and then an e line to end
-with. Our final example is a nut. Not a doughnut, but a hex-nut (for a
-machine screw) -- a regular hexagon with a circular hole in the center.
-The hexagon is flat on top and bottom so the specification begins and
-ends like the square shape. The circle is rendered as a 24-gon, beginning
-with a split (s) of the surrounding text and ending with a join (j). If
-the spacing of the scan lines looks odd, it is because the hexagon alone
-would need few scans, but the circle needs many; the points on the circle
-are at 15 degree intervals.
+Pre-defined shapes, and commands to use the shape:
-\def\nutshape{%
-{0}%
-{0}b{0}\\%
-{0}t{-12.5}{25}\\%
-{11.65}t{-19.23}{19.23}st{0}{19.23}\\%
-{11.99}t{-19.42}{16.835}t{2.59}{16.835}\\%
-{12.99}t{-20}{15}t{5}{15}\\%
-{14.58}t{-20.92}{13.85}t{7.07}{13.85}\\%
-{16.65}t{-22.11}{13.45}t{8.66}{13.45}\\%
-{19.06}t{-23.51}{13.85}t{9.66}{13.85}\\%
-{21.65}t{-25}{15}t{10}{15}\\%
-{24.24}t{-23.51}{13.85}t{9.66}{13.85}\\%
-{26.65}t{-22.11}{13.45}t{8.66}{13.45}\\%
-{28.72}t{-20.92}{13.85}t{7.07}{13.85}\\%
-{30.31}t{-20}{15}t{5}{15}\\%
-{31.31}t{-19.42}{16.835}t{2.59}{16.835}\\%
-{31.65}t{-19.23}{19.23}jt{0}{19.23}\\%
-{43.3}t{-12.5}{25}\\%
-{43.3}e{0}%
-}
+\diamondshape, \diamondpar; \squareshape, \squarepar; \heartshape,
+\heartpar; \circleshape, \circlepar; \nutshape, \nutpar; \CDlabshape,
+\CDlabel; \starshape, \starpar; \hexagonshape, \hexagonpar.
+
+Shape generator:
+
+\rectangleshape{height}{width}
-\shapepar cheats a bit when the horizontal gap between two bits of text
-is small (like down in the notch of \heartpar). When the gap is less
-than an interword space it is eliminated, and the texts are joined; when
-it is somewhat larger it is expanded to give it more visibility. If you
-want to eliminate this behavior, move the following definitions up into
-the main part of the file.
+Typeset shapepar.ltx (or see shapepar.pdf) for detailed instructions.
-See shapepar.tex for more detailed instructions.
%-----------------------------------------
+Version 2.1 (Sep 2006) Repair \\, fix multibox ordering, \rectangleshape,
+ hexagon.
+Version 2.01 (Jun 2006) Avoid some numeric overflows.
Version 2.00 (Dec 2002) \cutout, disjoint parts, set scale, much rewrite
Version 1.01 (March 1993) Small changes from initial release.