5

I need to change both horizontal and vertical dimensions of the output pages. Is there a simple way to do it in plain TeX?

  • 1
    Change \hsize and \vsize. For placing the text block on the page, the simplest method is acting on \hoffset and \voffset; the correct method would be modifying the output routing. – egreg Dec 8 '14 at 15:24
  • @egreg But it works with the .dvi file and not with the .pdf. (Both if I use dvipdf or directly pdftex). For example, if I write \divide\vsize by 2, then the pages are shrinked only in the .dvi: in the .pdf the pages remain the same, except that the bottom margin increases. – User Dec 8 '14 at 15:39
  • 1
    The dvi file has no notion of the physical output page. Please, be more specific about your workflow. Why are you using dvipdf and not pdftex directly? – egreg Dec 8 '14 at 15:50
  • Because there are some plain tex macros on which pdftex works differently than tex. But, even if I directly use pdftex, the shape of the pages doesn't change. Instead, by compiling with tex, if I open the .dvi file with a viewer (I use evince), then it appears right. The file I am compiling is \divide\vsize by 2 Hello world! \bye – User Dec 8 '14 at 16:04
  • 2
    You can probably use \pdfpagewidth=<dimen>/\pdfpageheight=<dimen> with pdfTeX/XeTeX at least. – morbusg Dec 8 '14 at 17:55
4

You can use opmac.tex which defines \margins macro for setting page dimensions and margins comfortable. The following example sets all four margins to 1in, but the page format is changed.

\input opmac

\margins/1 a5 (1,1,1,1)in  % A5 portrait
% or: \margins/1 a5l (1,1,1,1)in  % A5 landscape
% or: \margins/1 a3 (1,1,1,1)in   % A3 portrait
% etc.
% or: \sdef{pgs:spec}{(200,200)mm}  
% \margins/1 spec (1,1,1,1)in     % special format 200x200 mm 

hello world.

\bye

See the opmac-u-en.pdf documentation if you need more features.

Note that if the DVI mode is active then page media dimensions isn't set by this macro \margins, because it is impossible (DVI doesn't store such information). I don't understand where your evince reads this information when it displays DVI. My evince isn't able display DVI so I can't try.

  • Thank's! I didn't know about opmac, but it seems good. I actually use eplain which does similar things. My evince displays dvi just like it displays pdf :) I don't know why yours can't do it – User Dec 8 '14 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.