I was trying to write a macro for wrapping text around a figure. I aware that it is available in Latex and there is another package, figflow for plainTex. I am just learning to write my own. My first step was to use \parshape to create a blank area for the figure. I got stuck here. I define the macro as follows:
\newcount\ln
\def\wrap#1#2{\parshape=#1 \loop\relax\ifnum\ln<#1 0cm #2 \advance\ln by 1\repeat}
It does not work. I tried \edef
, which did not work either. Please can anyone help? Thanks!
\parshape{6}{10cm} Here is the definitive guide to the use of TeX, written by the system's creator, Donald E. Knuth. TeX represents the state of the art in computer typesetting. It is particularly valuable where the document, article, or book to be produced contains a lot of mathematics, and where the user is concerned about typographic quality. TeX software offers both writers and publishers the opportunity to produce technical text of all kinds, in an attractive form, with the speed and efficiency of a computer system. Novice and expert users alike will gain from The TeXbook the level of information they seek. Knuth warns newcomers away from the more difficult areas, while he entices experienced users with new challenges. The novice need not learn much about TeX to prepare a simple manuscript with it. But for the preparation of more complex documents, The TeXbook contains all the detail required. Knuth's familiar wit, and illustrations specially drawn by Duane Bibby, add a light touch to an unusually readable software manual. The TeXbook is the first in a five-volume series on Computers and Typesetting, all authored by Knuth
\bye
\loop...\repeat
isn't expandable, but the way you're using it you need an expandable loop. I think we have an almost duplicate question (but regarding the use in LaTeX) on the network, I'll dig.\widowpenalties
, but still very similar in nature. Take a look here: tex.stackexchange.com/questions/26272\numexpr
. But you don't necessarily need an expandable loop, instead you could use your\loop ...\repeat
construct in a group and utilize\aftergroup
to build the list for\parshape
.insbox
, which already contains all the functionality you'd need for that, and which works in plain. Link: ctan.org/pkg/insbox