24
The vwcol package Will Robertson 2015/02/10 v0.2 1 Introduction This package provides an environment that allows paragraph text to be typeset into multiple columns of uneven width, with text that flows from one column to the next. The columns can not span over multiple pages. Due to difficulties with the processing of such a thing, little else besides text is allowed within (feel free to experiment, but you’re on your own). Here’s an example: 1 \begin{vwcol}[widths={0.3,0.2,0.5}] \lipsum[1] \end{vwcol} Lorem ipsum dolor sit amet, con- sectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adip- iscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra me- tus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Prae- sent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum. 2 Options As shown above, at heart this package is quite simple. This section discusses the options that can be passed to the vwcol environment. The options are: widths The number and size of the columns. sep The width of the space between the columns. sidesep Whether to add space on the outside of the columns (equiv. to the following two options together). presep Whether to add space before the columns. postsep Whether to add space after the columns. rule The width of the rule. 1 Requires the lipsum package to print the sample text. 1

The vwcol package - University of Washington

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

The vwcol package

Will Robertson

2015/02/10 v0.2

1 Introduction

This package provides an environment that allows paragraph text to be typesetinto multiple columns of uneven width, with text that flows from one column tothe next. The columns can not span over multiple pages.

Due to difficulties with the processing of such a thing, little else besides textis allowed within (feel free to experiment, but you’re on your own). Here’s anexample:1

\begin{vwcol}[widths={0.3,0.2,0.5}]\lipsum[1]

\end{vwcol}

Lorem ipsum dolor sit amet, con-sectetuer adipiscing elit. Ut puruselit, vestibulum ut, placerat ac, adip-iscing vitae, felis. Curabitur dictumgravida mauris. Nam arcu libero,nonummy eget, consectetuer id,vulputate a, magna. Donec vehiculaaugue eu neque. Pellentesque

habitant morbi tristiquesenectus et netus etmalesuada fames acturpis egestas. Maurisut leo. Cras viverra me-tus rhoncus sem. Nullaet lectus vestibulumurna fringilla ultrices.

Phasellus eu tellus sit amet tortor gravida placerat. Integersapien est, iaculis in, pretium quis, viverra ac, nunc. Prae-sent eget sem vel leo ultrices bibendum. Aenean faucibus.Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac,nulla. Curabitur auctor semper nulla. Donec varius orci egetrisus. Duis nibh mi, congue eu, accumsan eleifend, sagittisquis, diam. Duis eget orci sit amet orci dignissim rutrum.

2 Options

As shown above, at heart this package is quite simple. This section discusses theoptions that can be passed to the vwcol environment. The options are:

widths The number and size of the columns.sep The width of the space between the columns.sidesep Whether to add space on the outside of the columns (equiv. to the

following two options together).presep Whether to add space before the columns.postsep Whether to add space after the columns.rule The width of the rule.

1Requires the lipsum package to print the sample text.

1

siderule Whether to draw a rule on the outside of the columns (equiv. to thefollowing two options together).

prerule Whether to draw a rule before the columns.postrule Whether to draw a rule after the columns.rulecolor The colour of the rule.2

justify Paragraph justification within the columns.indent Indentation size within the columns (if relevant).

Paragraph options justify and indent are covered in section §3 on page 5, andsome advanced options are discussed in section §4 on page 6.

This macro may be used to set the default values for the options (described\vwcolsetupsubsequently) of the vwcol environment.

\vwcolsetup{widths={0.3,0.2,0.5},rule=2pt}\begin{vwcol}

\lipsum[1]\end{vwcol}

Lorem ipsum dolor sit amet, con-sectetuer adipiscing elit. Ut puruselit, vestibulum ut, placerat ac, adip-iscing vitae, felis. Curabitur dictumgravida mauris. Nam arcu libero,nonummy eget, consectetuer id,vulputate a, magna. Donec vehiculaaugue eu neque. Pellentesque

habitant morbi tristiquesenectus et netus etmalesuada fames acturpis egestas. Maurisut leo. Cras viverra me-tus rhoncus sem. Nullaet lectus vestibulumurna fringilla ultrices.

Phasellus eu tellus sit amet tortor gravida placerat. Integersapien est, iaculis in, pretium quis, viverra ac, nunc. Prae-sent eget sem vel leo ultrices bibendum. Aenean faucibus.Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac,nulla. Curabitur auctor semper nulla. Donec varius orci egetrisus. Duis nibh mi, congue eu, accumsan eleifend, sagittisquis, diam. Duis eget orci sit amet orci dignissim rutrum.

This option must always be present (either as a default value previously setwidthsin \vwcolsetup or specified in the environment directly) and consists of anynumber of comma-separated lengths or ratios. Lengths set the column width toan explicit size, whereas a ratio (as above) sets the column width to a fractionof the available linewidth (leaving some space for some separation between thecolumns).

As shown in the example in section §1, when the width ratios sum to 100%then the multi-columns will span the entire line width regardless of the chosenseparation between the columns. A set of widths may be any combination ofratios and lengths, but the total width should not exceed the linewidth available(a warning will be given if so).

The separation between the columns can be chosen as either a length, a ratiosepof the linewidth, or the keyword fill. The default is sep=0.05 (i.e., 5% of thelinewidth).

2Added in v0.2.

2

\begin{vwcol}[widths={0.35,0.25,0.4},sep=5pt]\lipsum[1]

\end{vwcol}

Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, vestibulum ut,placerat ac, adipiscing vitae, felis. Curabiturdictum gravida mauris. Nam arcu libero,nonummy eget, consectetuer id, vulputatea, magna. Donec vehicula augue eu neque.Pellentesque habitant morbi tristique senectus

et netus et malesuada fames acturpis egestas. Mauris ut leo.Cras viverra metus rhoncus sem.Nulla et lectus vestibulum urnafringilla ultrices. Phasellus eutellus sit amet tortor gravidaplacerat. Integer sapien est,

iaculis in, pretium quis, viverra ac, nunc. Praesenteget sem vel leo ultrices bibendum. Aenean faucibus.Morbi dolor nulla, malesuada eu, pulvinar at, mollisac, nulla. Curabitur auctor semper nulla. Donecvarius orci eget risus. Duis nibh mi, congue eu,accumsan eleifend, sagittis quis, diam. Duis egetorci sit amet orci dignissim rutrum.

The keyword fill adds stretchable space between the columns so the multi-columns fill the entire linewidth (without altering the widths of the columnsthemselves):

\begin{vwcol}[widths={2cm,2cm,0.4},sep=fill]\lipsum[1]

\end{vwcol}

Lorem ipsum dolor sitamet, consectetuer adip-iscing elit. Ut purus elit,vestibulum ut, placeratac, adipiscing vitae,felis. Curabitur dictumgravida mauris. Namarcu libero, nonummyeget, consectetuer id,

vulputate a, magna.Donec vehicula augueeu neque. Pellentesquehabitant morbi tristiquesenectus et netus etmalesuada fames acturpis egestas. Mauris utleo. Cras viverra metusrhoncus sem. Nulla et

lectus vestibulum urna fringilla ultrices. Phasellus eutellus sit amet tortor gravida placerat. Integer sapienest, iaculis in, pretium quis, viverra ac, nunc. Praesenteget sem vel leo ultrices bibendum. Aenean faucibus.Morbi dolor nulla, malesuada eu, pulvinar at, mollisac, nulla. Curabitur auctor semper nulla. Donec variusorci eget risus. Duis nibh mi, congue eu, accumsaneleifend, sagittis quis, diam. Duis eget orci sit ametorci dignissim rutrum.

If ratio column widths are used with a variable separation gap, then the separationgap is considered zero for the total width calculation. In this example, becausethe ratios for the column widths sum to 100% there is no room left over for aseparation gap:

\begin{vwcol}[widths={0.3,0.2,0.5},sep=fill]\lipsum[1]

\end{vwcol}

Lorem ipsum dolor sit amet, con-sectetuer adipiscing elit. Ut purus elit,vestibulum ut, placerat ac, adipiscingvitae, felis. Curabitur dictum gravidamauris. Nam arcu libero, nonummyeget, consectetuer id, vulputate a,magna. Donec vehicula augue eu neque.

Pellentesque habitantmorbi tristique senectus etnetus et malesuada famesac turpis egestas. Maurisut leo. Cras viverra metusrhoncus sem. Nulla etlectus vestibulum urna

fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat.Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Prae-sent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbidolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabiturauctor semper nulla. Donec varius orci eget risus. Duis nibh mi,congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sitamet orci dignissim rutrum.

These options control whether an extra separation is added before and/or afterpreseppostsepsidesep

the multicolumns. presep (or presep=true) adds space before the columns (andpresep=false suppresses it); postsep adds space after the columns; sidesep isa shorthand for activating both at once.

3

\begin{vwcol}[widths={0.3,0.25,0.4}]\lipsum[1]

\end{vwcol}

\setlength\fboxsep{0pt}\fbox{\begin{vwcol}[widths={0.3,0.25,0.4},sidesep]

\lipsum[1]\end{vwcol}}

Lorem ipsum dolor sit amet, con-sectetuer adipiscing elit. Ut puruselit, vestibulum ut, placerat ac, adip-iscing vitae, felis. Curabitur dictumgravida mauris. Nam arcu libero,nonummy eget, consectetuer id,vulputate a, magna. Donec vehiculaaugue eu neque. Pellentesque habi-

tant morbi tristique senectuset netus et malesuada famesac turpis egestas. Maurisut leo. Cras viverra metusrhoncus sem. Nulla et lectusvestibulum urna fringillaultrices. Phasellus eu tellus sitamet tortor gravida placerat.

Integer sapien est, iaculis in, pretium quis,viverra ac, nunc. Praesent eget sem vel leoultrices bibendum. Aenean faucibus. Morbidolor nulla, malesuada eu, pulvinar at, mollisac, nulla. Curabitur auctor semper nulla. Donecvarius orci eget risus. Duis nibh mi, congue eu,accumsan eleifend, sagittis quis, diam. Duiseget orci sit amet orci dignissim rutrum.

Lorem ipsum dolor sit amet,consectetuer adipiscing elit.Ut purus elit, vestibulum ut,placerat ac, adipiscing vitae, felis.Curabitur dictum gravida mauris.Nam arcu libero, nonummy eget,consectetuer id, vulputate a,magna. Donec vehicula augueeu neque. Pellentesque habitant

morbi tristique senectus etnetus et malesuada famesac turpis egestas. Maurisut leo. Cras viverra metusrhoncus sem. Nulla etlectus vestibulum urnafringilla ultrices. Phaselluseu tellus sit amet tortorgravida placerat. Integer

sapien est, iaculis in, pretium quis, viverraac, nunc. Praesent eget sem vel leo ultricesbibendum. Aenean faucibus. Morbi dolornulla, malesuada eu, pulvinar at, mollisac, nulla. Curabitur auctor semper nulla.Donec varius orci eget risus. Duis nibh mi,congue eu, accumsan eleifend, sagittis quis,diam. Duis eget orci sit amet orci dignissimrutrum.

The width of the rule is configurable (again, either a length or a ratio of the linerulewidth) and does not affect the separation gap. Use rule=none or rule=0pt tosuppress drawing the rule. The default is rule=0.4pt.

\begin{vwcol}[widths={0.35,0.25,0.4}]\lipsum[1]

\end{vwcol}\begin{vwcol}[widths={0.35,0.25,0.4},rule=0.02]

\lipsum[1]\end{vwcol}

Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, vestibulumut, placerat ac, adipiscing vitae, felis.Curabitur dictum gravida mauris. Namarcu libero, nonummy eget, consectetuerid, vulputate a, magna. Donec vehiculaaugue eu neque. Pellentesque habitantmorbi tristique senectus et netus et

malesuada fames ac turpisegestas. Mauris ut leo. Crasviverra metus rhoncus sem.Nulla et lectus vestibulumurna fringilla ultrices.Phasellus eu tellus sit amettortor gravida placerat.Integer sapien est, iaculis in,

pretium quis, viverra ac, nunc. Praesent egetsem vel leo ultrices bibendum. Aenean faucibus.Morbi dolor nulla, malesuada eu, pulvinarat, mollis ac, nulla. Curabitur auctor sempernulla. Donec varius orci eget risus. Duis nibhmi, congue eu, accumsan eleifend, sagittis quis,diam. Duis eget orci sit amet orci dignissimrutrum.

Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, vestibulumut, placerat ac, adipiscing vitae, felis.Curabitur dictum gravida mauris. Namarcu libero, nonummy eget, consectetuerid, vulputate a, magna. Donec vehiculaaugue eu neque. Pellentesque habitantmorbi tristique senectus et netus et

malesuada fames ac turpisegestas. Mauris ut leo. Crasviverra metus rhoncus sem.Nulla et lectus vestibulumurna fringilla ultrices.Phasellus eu tellus sit amettortor gravida placerat.Integer sapien est, iaculis in,

pretium quis, viverra ac, nunc. Praesent egetsem vel leo ultrices bibendum. Aenean faucibus.Morbi dolor nulla, malesuada eu, pulvinarat, mollis ac, nulla. Curabitur auctor sempernulla. Donec varius orci eget risus. Duis nibhmi, congue eu, accumsan eleifend, sagittis quis,diam. Duis eget orci sit amet orci dignissimrutrum.

These options control whether extra vertical rules are added before and/or afterprerulepostrulesiderule

the columns. prerule places a rule before the columns; postrule after them.(Again, prerule=false (etc.) turns this feature off.) And siderule is a shorthandto activate both. Using these options implicitly activates the relevant presepand/or postsep options, because you can’t have the rule without the gap.

4

\begin{vwcol}[widths={0.35,0.25,0.4},siderule]\lipsum[1]

\end{vwcol}

Lorem ipsum dolor sit amet, con-sectetuer adipiscing elit. Ut purus elit,vestibulum ut, placerat ac, adipiscingvitae, felis. Curabitur dictum gravidamauris. Nam arcu libero, nonummyeget, consectetuer id, vulputate a,magna. Donec vehicula augue euneque. Pellentesque habitant morbitristique senectus et netus et male-

suada fames ac turpisegestas. Mauris ut leo. Crasviverra metus rhoncus sem.Nulla et lectus vestibulumurna fringilla ultrices.Phasellus eu tellus sit amettortor gravida placerat.Integer sapien est, iaculisin, pretium quis, viverra

ac, nunc. Praesent eget sem vel leo ultricesbibendum. Aenean faucibus. Morbi dolornulla, malesuada eu, pulvinar at, mollisac, nulla. Curabitur auctor semper nulla.Donec varius orci eget risus. Duis nibh mi,congue eu, accumsan eleifend, sagittis quis,diam. Duis eget orci sit amet orci dignissimrutrum.

The colour of each rule. Either used a pre-defined name or define your own usingrulecolorcolor or xcolor. The color package is loaded by this package.

\vwcolsetup{widths={0.35,0.25,0.4},siderule,rule=2pt}\begin{vwcol}[rulecolor=red]

\lipsum[6]\end{vwcol}\definecolor{myrulecol}{rgb}{0.1,0.6,0.3}\begin{vwcol}[rulecolor=myrulecol]

\lipsum[6]\end{vwcol}

Suspendisse vel felis. Ut lorem lorem,interdum eu, tincidunt sit amet, laoreetvitae, arcu. Aenean faucibus pedeeu ante. Praesent enim elit, rutrumat, molestie non, nonummy vel, nisl.Ut lectus eros, malesuada sit amet,

fermentum eu, sodalescursus, magna. Donec eupurus. Quisque vehicula,urna sed ultricies auctor,pede lorem egestas dui, etconvallis elit erat sed nulla.

Donec luctus. Curabitur et nunc. Aliquamdolor odio, commodo pretium, ultricies non,pharetra in, velit. Integer arcu est, nonummyin, fermentum faucibus, egestas vel, odio.

Suspendisse vel felis. Ut lorem lorem,interdum eu, tincidunt sit amet, laoreetvitae, arcu. Aenean faucibus pedeeu ante. Praesent enim elit, rutrumat, molestie non, nonummy vel, nisl.Ut lectus eros, malesuada sit amet,

fermentum eu, sodalescursus, magna. Donec eupurus. Quisque vehicula,urna sed ultricies auctor,pede lorem egestas dui, etconvallis elit erat sed nulla.

Donec luctus. Curabitur et nunc. Aliquamdolor odio, commodo pretium, ultricies non,pharetra in, velit. Integer arcu est, nonummyin, fermentum faucibus, egestas vel, odio.

3 Paragraph settings

The justification to use; one of ragged (default), flush, raggedleft, or center.justifyThese settings are made using the ragged2e package, with the result that hy-phenation is enabled even in the ragged settings (this is a good thing!); due to alimitation of TEX’s \parshape, LATEX’s ordinary \raggedright setting cannot beused.

5

\begin{vwcol}[widths={0.35,0.25,0.4}]\lipsum[66]

\end{vwcol}\begin{vwcol}[widths={0.35,0.25,0.4},justify=flush]

\lipsum[66]\end{vwcol}\begin{vwcol}[widths={0.35,0.25,0.4},justify=raggedleft]

\lipsum[66]\end{vwcol}\begin{vwcol}[widths={0.35,0.25,0.4},justify=center]

\lipsum[66]\end{vwcol}

Nunc sed pede. Praesent vitae lectus.Praesent neque justo, vehicula eget,interdum id, facilisis et, nibh. Phasellus at

purus et libero lacinia dictum.Fusce aliquet. Nulla eu anteplacerat leo semper dictum.

Mauris metus. Curabitur lobortis. Curabitursollicitudin hendrerit nunc. Donec ultrices lacusid ipsum.

Nunc sed pede. Praesent vitae lectus. Prae-sent neque justo, vehicula eget, interdumid, facilisis et, nibh. Phasellus at purus

et libero lacinia dictum. Fuscealiquet. Nulla eu ante plac-erat leo semper dictum. Mau-

ris metus. Curabitur lobortis. Curabitur sollici-tudin hendrerit nunc. Donec ultrices lacus id ip-sum.

Nunc sed pede. Praesent vitae lectus.Praesent neque justo, vehicula eget,

interdum id, facilisis et, nibh. Phasel-

lus at purus et liberolacinia dictum. Fusce

aliquet. Nulla eu ante

placerat leo semper dictum. Mauris metus.Curabitur lobortis. Curabitur sollicitudin

hendrerit nunc. Donec ultrices lacus id ipsum.

Nunc sed pede. Praesent vitae lectus.Praesent neque justo, vehicula eget,

interdum id, facilisis et, nibh. Phasellus

at purus et libero laciniadictum. Fusce aliquet.

Nulla eu ante placerat leo

semper dictum. Mauris metus. Curabiturlobortis. Curabitur sollicitudin hendrerit

nunc. Donec ultrices lacus id ipsum.

This option is used to set the paragraph indent for ragged right and justifiedindentparagraph shapes (by default [indent=1.5em]).

\begin{vwcol}[widths={0.35,0.25,0.4},indent=5em]\lipsum[66]\lipsum[66]

\end{vwcol}

Nunc sed pede. Praesent vitae lectus.Praesent neque justo, vehicula eget,interdum id, facilisis et, nibh. Phasellusat purus et libero lacinia dictum. Fuscealiquet. Nulla eu ante placerat leo semperdictum. Mauris metus. Curabitur lobortis.

Curabitur sollicitudinhendrerit nunc. Donecultrices lacus id ipsum.

Nunc sed pede.Praesent vitae lectus. Praesentneque justo, vehicula eget,

interdum id, facilisis et, nibh. Phasellus at puruset libero lacinia dictum. Fusce aliquet. Nullaeu ante placerat leo semper dictum. Maurismetus. Curabitur lobortis. Curabitur sollicitudinhendrerit nunc. Donec ultrices lacus id ipsum.

Note that the first column always begins with a \noindent. Let me know if youdon’t like this idea.

4 Advanced (read: not very useful) options

The vwcol package passes certain information about what it’s doing via errors inquietcompilation, warnings in the console output, and info in the .log file. Loadingvwcol with the [quiet] option ‘demotes’ the priority of these diagnostics: errorsbecome warnings, warnings become info in the .log file, and info is suppressedentirely.

With the default [lines=auto], the vwcol environment tries to estimate howlines

6

much space is required but it will sometimes get it wrong. Pass an integer tothe lines option to specify exactly how many lines to use (which will also saveprocessing time), but if the value chosen is too small then text will be lost (andan error given):

\begin{vwcol}[widths={0.35,0.25,0.4},lines=4]\lipsum[1]

\end{vwcol}\begin{vwcol}[widths={0.35,0.25,0.4},lines=11]

\lipsum[1]\end{vwcol}

Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, vestibulumut, placerat ac, adipiscing vitae, felis.Curabitur dictum gravida mauris. Nam

arcu libero, nonummy eget,consectetuer id, vulputatea, magna. Donec vehiculaaugue eu neque. Pellentesque

habitant morbi tristique senectus et netus etmalesuada fames ac turpis egestas. Mauris utleo. Cras viverra metus rhoncus sem. Nullaet lectus vestibulum urna fringilla ultrices.

Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, vestibulumut, placerat ac, adipiscing vitae, felis.Curabitur dictum gravida mauris. Namarcu libero, nonummy eget, consectetuerid, vulputate a, magna. Donec vehiculaaugue eu neque. Pellentesque habitantmorbi tristique senectus et netus etmalesuada fames ac turpis egestas.Mauris ut leo. Cras viverra metus rhoncussem. Nulla et lectus vestibulum urna

fringilla ultrices. Phaselluseu tellus sit amet tortorgravida placerat. Integersapien est, iaculis in, pretiumquis, viverra ac, nunc.Praesent eget sem vel leoultrices bibendum. Aeneanfaucibus. Morbi dolor nulla,malesuada eu, pulvinar at,mollis ac, nulla. Curabiturauctor semper nulla. Donec

varius orci eget risus. Duis nibh mi, congue eu,accumsan eleifend, sagittis quis, diam. Duiseget orci sit amet orci dignissim rutrum.

The rationale behind producing an error is that you really want to be alerted iftext in your input is not making it into the output document (cf. with trying toinsert a character that doesn’t exist in the current font).

When the estimate number of lines is calculated, the value is sometimes too small.maxrecursionvwcol will increment the number of lines one-by-one at most maxrecursion timesuntil the text completely fits into the columns. If it hits maxrecursion, then anerror is reported explaining what’s going on.

The default is 5, but I’d be surprised if you ever need to adjust this parameter.

5 Usage notes

If you want the widths ratios to use a different width to denote 100% (instead of\linewidth), put the whole thing in a minipage or \parbox:

\begin{minipage}{0.8\linewidth}\begin{vwcol}[widths={0.3,0.7},indent=1.8em]

\lipsum[66]\lipsum[66]\end{vwcol}

\end{minipage}

Nunc sed pede. Praesent vitaelectus. Praesent neque justo,vehicula eget, interdum id,facilisis et, nibh. Phasellus atpurus et libero lacinia dictum.Fusce aliquet. Nulla eu anteplacerat leo semper dictum.

Mauris metus. Curabitur lobortis. Curabitur sollicitudin hendreritnunc. Donec ultrices lacus id ipsum.

Nunc sed pede. Praesent vitae lectus. Praesent neque justo,vehicula eget, interdum id, facilisis et, nibh. Phasellus at purus etlibero lacinia dictum. Fusce aliquet. Nulla eu ante placerat leo semperdictum. Mauris metus. Curabitur lobortis. Curabitur sollicitudinhendrerit nunc. Donec ultrices lacus id ipsum.

7

(I might add an option to vwcol to allow this directly; E.g., [totalwidth=0.8\linewidth].Let me know if you like the idea.)

The vwcol environment ends the previous paragraph at \begin{vwcol} andterminates the paragraph it is contained within at \end{vwcol}. This means youcan’t place two vwcol environments next to each other, for example (or next toanything else, for that matter). If you want to be able to do this, again, put themin minipages or \parboxes:

\rule{0.1\linewidth-\fboxsep}{1ex}%%\fbox{\parbox{0.8\linewidth}{%

\begin{vwcol}[widths={0.3,0.7},indent=1.8em]\lipsum[66]\lipsum[66]

\end{vwcol}}}%%\rule{0.1\linewidth-\fboxsep}{1ex}%

Nunc sed pede. Praesent vitaelectus. Praesent neque justo,vehicula eget, interdum id,facilisis et, nibh. Phasellus atpurus et libero lacinia dictum.Fusce aliquet. Nulla eu anteplacerat leo semper dictum.

Mauris metus. Curabitur lobortis. Curabitur sollicitudin hendreritnunc. Donec ultrices lacus id ipsum.

Nunc sed pede. Praesent vitae lectus. Praesent neque justo,vehicula eget, interdum id, facilisis et, nibh. Phasellus at purus etlibero lacinia dictum. Fusce aliquet. Nulla eu ante placerat leo semperdictum. Mauris metus. Curabitur lobortis. Curabitur sollicitudinhendrerit nunc. Donec ultrices lacus id ipsum.

(I might add an option to vwcol to allow this directly; E.g., [par=false] or[block=par] vs. [block=inline]. Let me know if you like the idea.)

Note in both of these cases that the \parindent length had to be redefinedafter {minipage} or \parbox defined it to zero inside themselves.

6 Acknowledgements

Many thanks to Flavio Costa for testing an early version of this package andespecially for proof-reading this documentation. In large part due to him thismanual makes much more sense :)

8

File I

vwcol implementationThis is the package.

1 \ProvidesPackage{vwcol}2 [2015/02/10 v0.2 Variable-width multicolumn text]

7 Preamble

7.1 Packages3 \RequirePackage{calc}4 \RequirePackage{color}5 \RequirePackage{environ}[2008/06/18]6 \RequirePackage{keyval}7 \RequirePackage{ragged2e}

7.2 Things we need8 \newlength\vwcol@sep9 \newlength\vwcol@rule

10 \newlength\vwcol@totalwidth11 \newlength\vwcol@averagewidth12 \newlength\vwcol@parindent

13 \newcount\vwcol@last14 \newcount\vwcol@Ncols15 \newcount\vwcol@Nlines16 \newcount\vwcol@maxrecursion

17 \newbox\vwcol@box18 \newbox\vwcol@plainbox19 \newbox\vwcol@outputbox

20 \newif\if@vwcol@boxready21 \newif\if@vwcol@prerule22 \newif\if@vwcol@postrule23 \newif\if@vwcol@presep24 \newif\if@vwcol@postsep

7.3 Conveniences

Start error and warning text on a new line coz I think it looks better that way:25 \newcommand\vwcol@PackageError[2]{%26 \PackageError{vwcol}{^^J\space\space#1}{#2}}

9

27 \newcommand\vwcol@PackageWarning[1]{%28 \PackageWarning{vwcol}{%29 ^^J\space\space#1^^JThis warning occurred}}

30 \newcommand\vwcol@PackageInfo[1]{%31 \PackageWarning{vwcol}{%32 ^^J\space\space#1^^JThis warning occurred}}

7.4 Package option33 \DeclareOption{quiet}{%34 \renewcommand\vwcol@PackageError[2]{%35 \vwcol@PackageWarning{#1.}}%36 \let\vwcol@PackageInfo\@gobble}37 \ProcessOptions

8 Auxiliary macros

\vwcol@test@length {#1}: Rational number or length (i.e., with unit){#2}: Multiplier for the rational (e.g., \linewidth)This macro returns \@tempswa true if the input is a rational number (e.g., 0.1,1, etc.) or false if it is a length (e.g., 2pt, 3cm).3 \@tempdima contains the lengthcorresponding to the rational number multiplier of #2 or the length input, respec-tively.

\vwcol@test@length{1}{\linewidth}\if@tempswa Rational\else Length\fi\\\vwcol@test@length{1cm}{\linewidth}\if@tempswa Rational\else Length\fi

RationalLength

38 \def\vwcol@test@length#1#2{%39 \afterassignment\vwcol@test@@40 \@tempdima=#1#2\@nil}

The afterassignment macro:41 \def\vwcol@test@@#1\@nil{%42 \ifx\@nil#1\@nil43 \@tempswatrue44 \else45 \@tempswafalse46 \fi}

3Based on a similar macro by David Kastrup: http://groups.google.com/group/comp.text.tex/msg/9bd5349ea2416c95

10

Actually, I don’t use \if@tempswa in this package (I use \@tempdima directly),but I’ve left the conditional in there in case someone else finds it useful.

9 Environment options

\vwcolsetup To set the defaults:47 \def\vwcolsetup{\setkeys{vwcol}}

widths The number and size of each column.48 \define@key{vwcol}{widths}{\def\vwcol@widths{#1}}

No defaults.

maxrecursion Number of iterations used to estimate the number of lines. I doubtif it will ever need to be changed from the default.49 \define@key{vwcol}{maxrecursion}{\vwcol@maxrecursion=#1}

Default:50 \vwcolsetup{maxrecursion=5}

rule The width of the intercolumn rule as a length or as a ratio of the total linewidth or as the keyword none.51 \define@key{vwcol}{rule}{%52 \def\@tempa{#1}%53 \def\@tempb{none}%54 \ifx\@tempa\@tempb55 \vwcol@rule=0pt56 \else57 \vwcol@test@length{#1}{\linewidth}%58 \vwcol@rule=\@tempdima59 \fi}

Default:60 \vwcolsetup{rule=0.4pt}

lines The number of lines of text in each column or the keyword auto.61 \define@key{vwcol}{lines}{%62 \def\@tempa{#1}%63 \def\@tempb{auto}%64 \ifx\@tempa\@tempb65 \vwcol@Nlines=066 \else67 \vwcol@Nlines=#168 \fi}

11

Default:69 \vwcolsetup{lines=auto}

sep The distance between each column (including space taken up by the rule, ifany) as a length or as a ratio or as the keyword fill.70 \define@key{vwcol}{sep}{%71 \def\@tempa{#1}%72 \def\@tempb{fill}%73 \ifx\@tempa\@tempb74 \vwcol@sep=1sp75 \else76 \vwcol@test@length{#1}{\linewidth}%77 \vwcol@sep=\@tempdima78 \fi}

Default:79 \vwcolsetup{sep=0.05}

presep Whether to include a gap before the first column.80 \define@key{vwcol}{presep}[true]{%81 \def\@tempa{#1}%82 \def\@tempb{true}%83 \ifx\@tempa\@tempb84 \@vwcol@preseptrue85 \else86 \def\@tempb{false}%87 \ifx\@tempa\@tempb88 \@vwcol@presepfalse89 \else90 \vwcol@PackageWarning{%91 ’#1’ not a valid option for option ’presep’;92 ’true’ or ’false’ only.}%93 \fi94 \fi}

Default:95 \vwcolsetup{presep=false}

postsep Whether to include a gap after the last column.96 \define@key{vwcol}{postsep}[true]{%97 \def\@tempa{#1}%98 \def\@tempb{true}%99 \ifx\@tempa\@tempb

100 \@vwcol@postseptrue

12

101 \else102 \def\@tempb{false}%103 \ifx\@tempa\@tempb104 \@vwcol@postsepfalse105 \else106 \vwcol@PackageWarning{%107 ’#1’ not a valid option for option ’postsep’;108 ’true’ or ’false’ only.}%109 \fi110 \fi}

Default:111 \vwcolsetup{postsep=false}

sidesep Shorthand for setting both presep and postsep at once.112 \define@key{vwcol}{sidesep}[true]{%113 \def\@tempa{#1}%114 \def\@tempb{true}%115 \ifx\@tempa\@tempb116 \@vwcol@preseptrue117 \@vwcol@postseptrue118 \else119 \def\@tempb{false}%120 \ifx\@tempa\@tempb121 \@vwcol@presepfalse122 \@vwcol@postsepfalse123 \else124 \vwcol@PackageWarning{%125 ’#1’ not a valid option for option ’sidesep’;126 ’true’ or ’false’ only.}%127 \fi128 \fi}

prerule Whether to place a rule before the first column (implies presep).129 \define@key{vwcol}{prerule}[true]{%130 \def\@tempa{#1}%131 \def\@tempb{true}%132 \ifx\@tempa\@tempb133 \@vwcol@preseptrue134 \@vwcol@preruletrue135 \else136 \def\@tempb{false}%137 \ifx\@tempa\@tempb138 \@vwcol@prerulefalse139 \else

13

140 \vwcol@PackageWarning{%141 ’#1’ not a valid option for option ’prerule’;142 ’true’ or ’false’ only.}%143 \fi144 \fi}

Default:145 \vwcolsetup{prerule=false}

postrule Whether to place a rule after the last column (implies postsep).146 \define@key{vwcol}{postrule}[true]{%147 \def\@tempa{#1}%148 \def\@tempb{true}%149 \ifx\@tempa\@tempb150 \@vwcol@postseptrue151 \@vwcol@postruletrue152 \else153 \def\@tempb{false}%154 \ifx\@tempa\@tempb155 \@vwcol@postrulefalse156 \else157 \vwcol@PackageWarning{%158 ’#1’ not a valid option for option ’postrule’;159 ’true’ or ’false’ only.}%160 \fi161 \fi}

Default:162 \vwcolsetup{postrule=false}

siderule Shorthand for setting prerule and postrule simultaneously.163 \define@key{vwcol}{siderule}[true]{%164 \def\@tempa{#1}%165 \def\@tempb{true}%166 \ifx\@tempa\@tempb167 \@vwcol@preseptrue168 \@vwcol@postseptrue169 \@vwcol@preruletrue170 \@vwcol@postruletrue171 \else172 \def\@tempb{false}%173 \ifx\@tempa\@tempb174 \@vwcol@prerulefalse175 \@vwcol@postrulefalse176 \else

14

177 \vwcol@PackageWarning{%178 ’#1’ not a valid option for option ’siderule’;179 ’true’ or ’false’ only.}%180 \fi181 \fi}

justify The justification to use; one of flush/ragged/raggedleft/center.182 \define@key{vwcol}{justify}{%183 \def\@tempa{#1}%184 \def\@tempb{ragged}%185 \ifx\@tempa\@tempb186 \let\vwcol@justify\RaggedRight187 \else188 \def\@tempb{flush}%189 \ifx\@tempa\@tempb190 \let\vwcol@justify\justifying191 \else192 \def\@tempb{raggedleft}%193 \ifx\@tempa\@tempb194 \let\vwcol@justify\RaggedLeft195 \else196 \def\@tempb{center}%197 \ifx\@tempa\@tempb198 \let\vwcol@justify\Centering199 \else200 \vwcol@PackageWarning{%201 ’#1’ not a valid option for option ’justify’;202 one of ’flush’/’ragged’/’raggedleft’/’center’ only.}%203 \fi204 \fi205 \fi206 \fi}

Default:207 \vwcolsetup{justify=ragged}

indent The paragraph indent to use with flush or ragged justification.208 \define@key{vwcol}{indent}{\setlength\vwcol@parindent{#1}}

Default:209 \vwcolsetup{indent=1.5em}

rulecolor The colour of each rule.210 \define@key{vwcol}{rulecolor}{\def\vwcol@rulecol{#1}}211 \vwcolsetup{rulecolor=black}

15

No defaults.

10 vwcol environment definition

vwcol Always start a new par.212 \NewEnviron{vwcol}[1][]{%213 \par\noindent

Initialisation:214 \@vwcol@boxreadyfalse215 \vwcolsetup{#1}%

Ensure the space at the top of each column is uniform:216 \splittopskip=\ht\strutbox

Setup widths (this counts the columns and calculates the average and total widthsof the columns):

217 \expandafter\vwcol@process@widths\expandafter{\vwcol@widths}%

Set up the paragraph parameters:218 \vwcol@para@setup

From the width of the columns, the total width of the environment can becalculated. First, if sep=fill then the whole linewidth will be used:

219 \ifdim\vwcol@sep=1sp220 \vwcol@totalwidth=\linewidth

Otherwise calculate the total from the number of separation gaps:(\vwcol@totalwidth is currently the total of the columns widths, which wascalculated above in \vwcol@process@widths)

221 \else222 \vwcol@totalwidth=\numexpr223 \vwcol@totalwidth+(\vwcol@Ncols-1)*\vwcol@sep224 \relax sp

Add on extra space due to the optional pre- and post-separation gaps and rules.Note that while rules between columns do not contribute to the total widthof the columns (they subtract from the empty space in the gaps between thecolumns, which explains why the correction is needed in the presep/postseplength processing), pre- or post-rules do.

225 \if@vwcol@presep226 \advance\vwcol@totalwidth\dimexpr(\vwcol@sep-\vwcol@rule)/2\relax227 \fi228 \if@vwcol@postsep229 \advance\vwcol@totalwidth\dimexpr(\vwcol@sep-\vwcol@rule)/2\relax230 \fi

16

231 \if@vwcol@prerule \advance\vwcol@totalwidth \vwcol@rule\fi232 \if@vwcol@postrule\advance\vwcol@totalwidth \vwcol@rule\fi233 \fi

Finally, warn the author if their columns are going to be too large:234 \ifdim\vwcol@totalwidth > \linewidth235 \vwcol@PackageWarning{%236 Total width of columns plus their separations237 is greater than the linewidth^^J\space\space238 (by \the\vwcol@totalwidth\space - \the\linewidth\space =239 \the\dimexpr \vwcol@totalwidth-\linewidth\relax)}%240 \fi241 \ifnum\vwcol@Nlines=0%

If the lines are not explicitly selected then they must be estimated. Typesetthe text into a single box of the average column width (while ignoring over-full/underfull boxes):

242 \@tempcnta=\hbadness243 \hbadness=\maxdimen244 \setbox\vwcol@plainbox\hbox{%245 \parbox{\vwcol@averagewidth}{\vwcol@justify\BODY}}%246 \hbadness=\@tempcnta

Now the estimate of the number of lines per column, L, can be calculated. Startby assuming that the ‘area’ of the material in the single block will be about thesame when split into columns of un-equal width, wi. (By ‘area’ we actually meanthe number of lines in a block multiplied by the number of lines N.) If T is thetotal number of lines of the single block typeset above (which is calculated bydividing the height of the block by the baselineskip), this gives

T × wa ≈ L × w1 + L × w2 + · · · = L ×N

∑i=1

wi.

The width of the single block is defined above to be the average of the columnwidths:

wa = ave(wi) =N

∑i=1

wi/N

These two expressions are easily combined to give

L =T × ave(wi)

∑Ni=1 wi

=TN

.

In words, the number of lines per column is simply to simply the number of linesin the single block divided by the number of columns.

247 \vwcol@Nlines=\numexpr248 (\ht\vwcol@plainbox+\dp\vwcol@plainbox)/

17

249 (\baselineskip*\vwcol@Ncols)250 \relax

However, differences may arise due to rounding (due to TEX’s integer arith-metic, the floor of the resultant value is always calculated4) and hyphen-ation/justification variations between the two cases.

Due to these differences, we start with the calculated number of lines andincrement in a loop if necessary to ensure all of the material does actually fit. It’sunlikely that the number of lines estimated will be greater than the number oflines required due to the effect of the ‘flooring’ of the calculations.

251 \@tempcnta=1%252 \loop\unless\if@vwcol@boxready253 \savebox\vwcol@outputbox{%254 \hbox to \vwcol@totalwidth{\vwcol@{\BODY}}}%255 \unless\if@vwcol@boxready256 \advance\@tempcnta 1%257 \advance\vwcol@Nlines 1%

Here we could keep looping for as long as necessary, but in case of weird inputwe put a hard limit on the number of iterations. Stop after the line number hasbeen incremented five times (by default) because surely the calculation couldn’thave been that far wrong.

258 \ifnum\@tempcnta>\vwcol@maxrecursion259 \@vwcol@boxreadytrue260 \vwcol@PackageError{%261 The estimated number of lines is greater than262 \the\vwcol@maxrecursion\space lines too small,%263 ^^J\space\space264 so I gave up (last tried maximum value of265 [lines=\the\vwcol@Nlines])%266 }{%267 Text will be truncated in the multicolumns;268 please select the%269 ^^J\space\space270 number of lines explicitly or increase271 [maxrecursion=\the\vwcol@maxrecursion].%272 }%273 \fi274 \fi275 \repeat276 \usebox\vwcol@outputbox

If the lines was chosen explicitly then just run with it, giving an error if the lineswere too small. I can imagine an approxlines option that varies the number of

4I think.

18

lines over a range of say, 5 lines up and down then chooses the best one, but Ican’t be bothered implementing that right now.

277 \else278 \hbox to \vwcol@totalwidth{\vwcol@{\BODY}}%279 \unless\if@vwcol@boxready280 \vwcol@PackageError{%281 Not enough lines to fit the entire text;282 some text has been truncated.^^J\space\space283 Increase [lines=\the\vwcol@Nlines] to fit more%284 }{%285 Or remove [lines=\the\vwcol@Nlines] altogether286 to have ’vwcol’ estimate the value.}%287 \fi288 \fi\par}

That’s it!

\vwcol@para@setup Set up the paragraph options.289 \def\vwcol@para@setup{%

Justification:290 \vwcol@justify

\parindent override if justify is ragged or flush:291 \@tempswafalse292 \ifx\vwcol@justify\RaggedRight293 \@tempswatrue294 \else\ifx\vwcol@justify\justifying295 \@tempswatrue296 \fi\fi297 \if@tempswa298 \parindent=\vwcol@parindent299 \else300 \vwcol@PackageInfo{%301 ’indent’ ignored for [justify=raggedleft]302 or [justify=center]}303 \fi

The algorithm, unfortunately, doesn’t work with non-zero \parskip:304 \parskip=0pt}

\vwcol@process@widths This macros takes the widths input and calculates the number of columns andthe total and average widths of the columns.

305 \def\vwcol@process@widths#1{%

Count the number of columns: (this must be done in a loop before the main oneso that \vwcol@Ncols is known first)

306 \@for\@ii:=#1\do{\advance\vwcol@Ncols 1}%

19

Based on the colsep and rule width, calculate allowable space. For stretchablecolumn gaps, the separation gap counts as zero but the rules still take up somespace:

307 \ifdim\vwcol@sep=1sp308 \@tempdimb=\numexpr309 \linewidth-(\vwcol@Ncols-1)*\vwcol@rule310 \relax sp

And for fixed-width column gaps: (chuck in the warning here about sep≥rulecoz it’s convenient)

311 \else312 \ifdim\vwcol@rule > \vwcol@sep313 \vwcol@sep=\vwcol@rule314 \vwcol@PackageWarning{%315 ’sep’ must be greater than or equal to ’rule’}%316 \fi317 \@tempdimb=\numexpr318 \linewidth-(\vwcol@Ncols-1)*\vwcol@sep319 \relax sp

Remember that the rules do not take up any space of their own between thecolumns, so they subtract from the white space of the separation gap; this mustbe mirrored when additional space is included before or after the columns:

320 \if@vwcol@presep321 \advance\@tempdimb\dimexpr(-\vwcol@sep+\vwcol@rule)/2\relax322 \fi323 \if@vwcol@postsep324 \advance\@tempdimb\dimexpr(-\vwcol@sep+\vwcol@rule)/2\relax325 \fi326 \fi

The prerule and postrule both contribute to the total width, unlike the rulesbetween the columns:

327 \if@vwcol@prerule\advance\@tempdimb-\vwcol@rule\fi328 \if@vwcol@postrule\advance\@tempdimb-\vwcol@rule\fi

\@tempdimb now contains the maximum width that the columns can span beforethe environment is wider the \linewidth, after the rules and gaps are added intoo. Use this as the reference length to calculate the lengths of the columns thathave widths specified as ratios.

Now iterate to do stuff:329 \@for\@ii:=#1\do{%

If the column width is a plain rational number (like 0.4) then set the columnwidthto be that fraction of the allowable width.

330 \vwcol@test@length\@ii\@tempdimb

20

Keep a running total of the total width being used:331 \advance\vwcol@totalwidth\@tempdima

Save the column widths for later in the \parshape processing:332 \expandafter\expandafter\expandafter\def333 \expandafter\expandafter\expandafter\vwcol@setup@parlines334 \expandafter\expandafter\expandafter{%335 \expandafter\vwcol@setup@parlines336 \expandafter\vwcol@addlines337 \expandafter{\the\@tempdima}}}%

End the loop. Finally, calculate the average width of the columns:338 \vwcol@averagewidth=\dimexpr \vwcol@totalwidth/\vwcol@Ncols \relax}

\vwcol@setup@parlines This is the macro used to locally store the setup for the \parshape line spec-ification: (see a few lines back for the \expandafter fun of getting stuff intoit)

339 \def\vwcol@setup@parlines{\let\vwcol@parlines\@empty}

\vwcol@addlines Adds paragraph specifications to \vwcol@parlinesfor a single column inthe \parshapeFor N columns there will be N calls to this macro inside\vwcol@setup@parlines, which gets expanded at the beginning of every para-graph to create the required \parshape specification.

\@tempcntb starts at 0 at the beginning of each paragraph and counts thenumber of lines over all the columns. \vwcol@last is the total number of linesthat have so far been put into the columns. \vwcol@parlines is initialised at thebeginning of each paragraph.

Each time \vwcol@addlines is executed, \@tempcnta iterates through eachline in that column. Once the total line count reaches the number of lines thathave been typeset, \vwcol@parlines starts filling up with \parshape lines forthe next paragraph.

340 \def\vwcol@addlines#1{%341 \@tempcnta=0342 \loop\ifnum\@tempcnta<\vwcol@Nlines343 \advance\@tempcntb 1344 \ifnum\@tempcntb>\vwcol@last345 \xdef\vwcol@parlines{\vwcol@parlines 0cm #1 }%346 \fi347 \advance\@tempcnta 1348 \repeat}

\vwcol@ This is the macro for splitting the text into variable-width columns.349 \newcommand\vwcol@[1]{%

21

Setting the paragraphs First set the text into a special box that varies width at theappropriate places so when it is split into equal segments they can be arrangedinto variable-width columns.

350 \setbox\vwcol@box\vbox{%

The trick is to keep a running counter of lines that we’ve gone through byinspecting every paragraph after it is typeset:

351 \def\par{\endgraf\advance\vwcol@last\the\prevgraf}%

(see \vwcol@addlines for a more detailed explanation):352 \everypar{%353 \@tempcntb=0354 \vwcol@setup@parlines355 \parshape=\numexpr \vwcol@Nlines*\vwcol@Ncols-\vwcol@last \relax356 \vwcol@parlines}%

Insert a \strut at the top to ensure we chop off the first column at the sameheight as all the others:

357 \noindent\strut#1}%

Splitting the columns First insert a pre-sep and -rule, if appropriate:358 \if@vwcol@presep359 \if@vwcol@prerule360 \begingroup361 \color{\vwcol@rulecol}362 \vrule width \vwcol@rule363 \endgroup364 \fi365 \hskip\dimexpr (\vwcol@sep-\vwcol@rule)/2 \relax366 \fi

Iterate over the total number of columns:367 \@tempcnta=0368 \loop\ifnum\@tempcnta < \vwcol@Ncols369 \advance\@tempcnta 1

Skip the separations and rules in the first case:370 \unless\ifnum\@tempcnta=1

Sep and rule between the columns if [sep=fill]:371 \ifdim\vwcol@sep=1sp372 \hfill373 \begingroup374 \color{\vwcol@rulecol}375 \vrule width \vwcol@rule376 \endgroup377 \hfill

22

378 \else

Sep and rule between the columns if sep is a length:379 \@tempdima=\dimexpr (\vwcol@sep-\vwcol@rule)/2 \relax380 \hskip\@tempdima381 \begingroup382 \color{\vwcol@rulecol}383 \vrule width \vwcol@rule384 \endgroup385 \hskip\@tempdima386 \fi387 \fi

Split off and place the text column, then loop:388 \vsplit\vwcol@box to \numexpr389 (\vwcol@Nlines-1)*\baselineskip+\ht\strutbox \relax sp390 \repeat

Finally place the post-sep and -rule, if appropriate:391 \if@vwcol@postsep392 \hskip\dimexpr (\vwcol@sep-\vwcol@rule)/2 \relax393 \if@vwcol@postrule394 \begingroup395 \color{\vwcol@rulecol}396 \vrule width \vwcol@rule397 \endgroup398 \fi399 \fi

If \vwcol@box is void then we’ve used up all the material. This fact is passedon so we can re-run the algorithm with a different number of lines (or give awarning) if the material was truncated.

400 \ifvoid\vwcol@box401 \global\@vwcol@boxreadytrue402 \fi}

23

11 Problem with \raggedright and \parshape

Check it out; when you make a \parshape with more lines specified than neces-sary, the linebreak of the first line is totally wrong:

\raggedright\newlength\tmp\tmp=241.84842pt

\def\oneline{ 2.5em \tmp}\def\fivelines{\oneline\oneline\oneline\oneline\oneline}

\textbf{Wrong}:\\\parshape 10 \fivelines\fivelines\lipsum[66]

\textbf{Right}:\\\parshape 7 \fivelines\oneline\oneline\lipsum[66]

Wrong:Nuncsed pede. Praesent vitae lectus. Praesent neque justo,vehicula eget, interdum id, facilisis et, nibh. Phasellusat purus et libero lacinia dictum. Fusce aliquet.Nulla eu ante placerat leo semper dictum. Maurismetus. Curabitur lobortis. Curabitur sollicitudinhendrerit nunc. Donec ultrices lacus id ipsum.

Right:Nunc sed pede. Praesent vitae lectus. Praesentneque justo, vehicula eget, interdum id, facilisiset, nibh. Phasellus at purus et libero lacinia dictum.Fusce aliquet. Nulla eu ante placerat leo semperdictum. Mauris metus. Curabitur lobortis. Curabitursollicitudin hendrerit nunc. Donec ultrices lacus idipsum.

This is why this package uses ragged2e’s \RaggedRight instead of LATEX’s\raggedright.

In actual fact, when isolated into plain TEX code this reveals a legitimate bugin TEX’s line-breaking algorithm. Unfortunately discovered too late in TEX’s lifeto be awarded a cheque.

24