[texhax] The fundamental problem ...

Uwe Lueck uwe.lueck at web.de
Sun Jun 26 09:11:13 CEST 2011


"Peter Davis" <pfd at pfdstudio.com> wrote 26.06.2011 05:29:19:
> On Sat, Jun 25, 2011 at 8:45 PM,
> Donald Arseneau <asnd at triumf.ca[mailto:asnd at triumf.ca]> wrote:
>> Peter Davis <pfd at pfdstudio.com[mailto:pfd at pfdstudio.com]> writes:
>> The flowfram package comes pretty close to what I need, but it still has two
>> limitations that would be difficult to work around:
>> 1) if it overflows a frame in the middle of a paragraph, and the following
>> frame has a different width, the end of that paragraph will be set at the
>> width of the first frame, not the second.
> You'll have to keep travk of line-counts and usr \parshape.
>
> Thanks, Donald, but I don't see how \parshape let's me know
> how much of the text fit on a line (or set of lines).
> I can work out that the height of a box divided by
> the baselineskip tells me how many lines will fit, but how can I
> determine what text has to overflow into the next box?

Trying to solve the cryptical hint:

1. Assume all lines have same height -- grid typesetting,
difficult with LaTeX, depending on the kind of text,
ConTeXt seems to be better than LaTeX for this.

2. Keep a table of which lines must have which widths,
depending on the text widths in the sequence of frames.
Actually, already the first paragraph may fill many or
all! frames, so for the first one \parshape command
(all indents zero) is! that table (almost).

3. At \everypar, add \prevgraf to the recorded number of lines.

Problem: LaTeX uses \everypar in a way that makes it
(almost) impossible to use \everypar for own special purposes.
The everyhook package seems to improve this:

    http://ctan.org/pkg/everyhook

Actually, not quite so. Procedure I would try:

a. Make a list macro \linewidths containing all the
line widths, according to how many lines fit into a frame
and what the width of the frame is. For the first frame with
n lines, the macro has n entries \do{WIDTH} where WIDTH
is the width of the first frame. For the next frame,
more entries are attached to the right of that list macro ...

b. The \parshape command is formed by

    \def\do#1{0pt #1 } \parshape LINES \linewidths
    
at \everypar, where LINES is about as the number of lines
for which you have frames.

c. At each \everypar from the second one onwards, remove
\prevgraf entries from \linewidths, e.g. by

    \newcount\linescnt
    \count@\prevgraf
    \loop \ifnum\linescnt>0
        \xdef\linewidhts{%
            \expandafter\removedo\linewidths\removedo}
        \advance\linescnt-1
    \repeat
    
after one
    
    \def\removedo\do#1#2\removedo{#2}

-- make sure \linewidths is long enough so there is always
an entry left ... and then do b.

c. may give you a hint about a. ...
HTH --

    Uwe.



More information about the texhax mailing list