Re: plain TeX: different \hsize and \vsize for odd and even pages (was: plain TeX: different margins for odd and even pages)
David Carlisle <[email protected]> Wed, 8 Apr 2026 22:56:51 +0100
| Newsgroups | gmane.comp.tex.texhax |
|---|---|
| Message-ID | <CAEW6iOikxWKdNLCbpV8Tbgj6Z7XYaomf3Q4smCdGkt-q4N=Agw@mail.gmail.com> |
--000000000000480a96064ef9fa0f Content-Type: text/plain; charset="UTF-8" On Wed, 8 Apr 2026 at 22:29, Jim Diamond <[email protected]> wrote: > On Wed, Apr 8, 2026 at 21:34 (+0100), David Carlisle wrote: > > >> \global\hsize=\oddhsize > > > yes but only if, as in your example, all page breaks are forced. > > > if you have any paragraphs breaking over a page (as happens in most > documents) that doesn't really work, as a paragraph is broken in to lines > with a fixed \hsize (the value in force at the end) so to change hsize mid > paragraph you need to guess how many lines are in the first page, then set > up a parshape that uses one linewidth for that many lines and then the > hsize for the remaining lines for the new page. > > David (et al), > > I haven't looked at output routines in a long time, but as I recall the > leftover paragraph bit (after the paragraph has been split) becomes the > first \vbox contribution for the new page. > > As you say, it has been set with a particular \hsize. > > But is there not some unbox trickery which can be used to create a new > paragraph out of the leftover bit? > > I suspect the unboxing may (or may not) lose some glue explicitly applied, > but if the OP's paragraphs are just plain text (sequences of words), and > not fancy constructions or math, is this something which might work? > basically no you can not reflow a box in classic tex. you can't unhyphenate words and information about whatever glue was discarded at line breaks is lost. If the paragraph has colour specials or other whatsits between the lines you can not deconstruct the box at all, (well you can attempt vsplit rather than lastbox, but that loses more information) In luatex you can grab the node list prior to linebreaking and hyphenation and so you have rather more options but the question was about classic tex. > > The last 5 or 6 pages of Chapter 15 of The TeXbook might be of interest to > anyone who wants to try this out. > the texbook is always interesting but it's not going to help here:-) > Jim > David] --000000000000480a96064ef9fa0f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote g= mail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, 8 Apr 2= 026 at 22:29, Jim Diamond <<a href=3D"mailto:jim%[email protected]">jim+a= [email protected]</a>> wrote:<br></div><blockquote class=3D"gmail_quote" sty= le=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddi= ng-left:1ex">On Wed, Apr=C2=A0 8, 2026 at 21:34 (+0100), David Carlisle wro= te:<br> <br> >>=C2=A0 \global\hsize=3D\oddhsize<br> <br> > yes but only if, as in your example, all page breaks are forced.<br> <br> > if you have any paragraphs breaking over a page (as happens in most do= cuments)=C2=A0 that doesn't really work, as a paragraph is broken in to= lines with a fixed \hsize (the value in force at the end)=C2=A0 so to chan= ge hsize mid paragraph you need to guess how many lines are in the first pa= ge, then set up a parshape that uses one linewidth for that many lines and = then the hsize for the remaining lines for the new page.<br> <br> David (et al),<br> <br> I haven't looked at output routines in a long time, but as I recall the= <br> leftover paragraph bit (after the paragraph has been split) becomes the<br> first \vbox contribution for the new page.<br> <br> As you say, it has been set with a particular \hsize.<br> <br> But is there not some unbox trickery which can be used to create a new<br> paragraph out of the leftover bit?<br></blockquote><div><br></div><div><br>= </div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b= order-left:1px solid rgb(204,204,204);padding-left:1ex"> <br> I suspect the unboxing may (or may not) lose some glue explicitly applied,<= br> but if the OP's paragraphs are just plain text (sequences of words), an= d<br> not fancy constructions or math, is this something which might work?<br></b= lockquote><div><br></div><div> basically no you can not reflow a box in classic tex.=C2=A0 you can't= =20 unhyphenate words and information about whatever glue was discarded at=20 line breaks is lost. If the paragraph has colour specials or other=20 whatsits between the lines you can not deconstruct the box at all, (well yo= u can attempt vsplit rather than lastbox, but that loses more information)= =C2=A0=C2=A0</div><div><br></div><div>In luatex you can grab the node list = prior to linebreaking and hyphenation and so you have rather more options b= ut=C2=A0the question was about=C2=A0 classic tex.=C2=A0</div><blockquote cl= ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid= rgb(204,204,204);padding-left:1ex"> <br> The last 5 or 6 pages of Chapter 15 of The TeXbook might be of interest to<= br> anyone who wants to try this out.<br></blockquote><div><br></div><div>the t= exbook=C2=A0is always interesting but it's not going to help=C2=A0here:= -)</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0p= x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Jim<br></blockquote><div><br></div><= div>David]=C2=A0</div></div></div> --000000000000480a96064ef9fa0f--