[comp.text] fancy margins with troff -mm

holub@violet.berkeley.edu (06/09/89)

Has anyone modified -mm so that it will print wide left and narrow right
margines on even numbered pages and wide-right/narrow-left margins on odd pages?
That is, I need the wide margin to be at the outside of the page and the narrow
margin to be at the inside, like this:

even (left) page:	odd (right) page:
+----------------+	+----------------+
| header....text |	| header....text |
|		 |	|		 |
|      text text |	| text text 	 |
|      text text |	| text text 	 |
|      text text |	| text text 	 |
|      text text |	| text text 	 |
+----------------+	+----------------+

It's easy to get the odd pages working correctly (I even have a marginal-note
macro), but the even pages are harder. Anyway, if you've done it, I could use
some help. Thanks.

	-Allen Holub	holub@violet.berkeley.edu     ...!ucbvax!violet!holub

morrell@hpsal2.HP.COM (Michael Morrell) (06/10/89)

/ hpsal2:comp.text / holub@violet.berkeley.edu / 10:39 am  Jun  8, 1989 /
Has anyone modified -mm so that it will print wide left and narrow right
margines on even numbered pages and wide-right/narrow-left margins on odd pages?
That is, I need the wide margin to be at the outside of the page and the narrow
margin to be at the inside, like this:

even (left) page:	odd (right) page:
+----------------+	+----------------+
| header....text |	| header....text |
|		 |	|		 |
|      text text |	| text text 	 |
|      text text |	| text text 	 |
|      text text |	| text text 	 |
|      text text |	| text text 	 |
+----------------+	+----------------+
----------

I think all you have to do is switch the page offset for odd and even pages.
Add some code like:

  .if e .po 2i
  .if o .po 0

in either a header or footer macro (for example, .PX).

    Michael

bamford@ihlpf.ATT.COM (Harold E. Bamford) (06/10/89)

In article <25354@agate.BERKELEY.EDU> holub@violet.berkeley.edu () writes:
>Has anyone modified -mm so that it will print wide left and narrow right
>margines on even numbered pages and wide-right/narrow-left margins on odd pages?
>That is, I need the wide margin to be at the outside of the page and the narrow
>margin to be at the inside, like this:

How about putting this at the top of your document:

	.po +1.0i
	.am TP
	.if e .po -1.0i
	.if o .po +1.0i
	..

The .TP macro is the Top-of-Page macro that is invoked at the top of
each page.  .am appends two simple tests to the end of that macro.  If
the page is even numbered (.if e) then subtract an inch from the page
offset.  If it is odd, add an inch.

In a very brief test, it seems to work for me.  It should be a starting
point in any case.

I assume that this is to be able to convert your output to double sided
and then store it in a binder.  Correct?

-- Harold Bamford