🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #11057

Re: Margin setting in TeX

#11057
From: Damian Cugley
Date: Fri, 08 Jan 1993 12:37
62 lines
2817 bytes
In article <charro.726478178@ee.ualberta.ca> charro@ee.ualberta.ca (Dan Charrois) writes:

   How does one change the default margin settings in TeX?

In Plain TeX, you use \hoffset and \voffset (qq.v.) to set the margins
at the left and right of the page.  The parameters \hsize and \vsize
control the size of the chunk of text on the page.

Here's one way to set the margins for a plain TeX document:

	%  choose some margins:
	\newdimen\sidemargin \sidemargin=20mm
	\newdimen\topmargin  \topmargin=\sidemargin
	\newdimen\botmargin  \botmargin=1.25\topmargin

	%  calculate size and offset parameters:
	\hsize=210mm \advance\hsize-2\sidemargin
	\vsize=297mm \advance\vsize-\topmargin \advance\vsize-\botmargin
	\hoffset=\sidemargin \advance\hoffset-1in
	\voffset=\topmargin \advance\voffset-1in

This example gives an A4 page (210mm * 297mm) with 20-mm margins at the
top and sides and a slightly larger margin at the bottom.  You might
want to change the assignments to \hsize and \vsize to 8.5in and 11in
(or whatever).

The above code has the flaw that it does not set \vsize to a multiple of
\baselineskip (which is important of you have \parskip=0pt and so very
little vertical glue).

In LaTeX you should in theory have style option files to do this for
you.  In practice you have to translate the above into LaTeX's
terminology and put it in your document preamble.  I think the following
is approximately right:

	\setlength{\oddsidemargin}{20mm}
	\setlength{\evensidemargin}{\oddsidemargin}
	\setlength{\topmargin}{\sidemargin}
	\newlength{\botmargin} \setlength{\botmargin}{1.25\topmargin}

	\addtolength{\oddsidemargin}{-1in}
	\addtolength{\evensidemargin}{-1in}
	\addtolength{\topmargin}{-1in}
	\addtolength{\botmargin}{-1in}

	\setlength{\textwidth}{210mm} 
		\addtolength{\textwidth}{-\oddsidemargin}
		\addtolength{\textwidth}{-\evensidemargin}
		\addtolength{\textwidth}{-2in}
	\setlength{\textwidth}{297mm} 
		\addtolength{\textwidth}{-\topmargin}
		\addtolength{\textwidth}{-\botmargin}
		\addtolength{\textwidth}{-2in}

LaTeX has built-in parameters \evensidemargin, \oddsidemargin and
\topmargin, all of which are set to be one inch less than you want the
margins to be.  The above code creates a new parameter \botmargin with
the same conventions.

Hope this helps

Damian
Technical Details
Message-ID: <DAMIAN.CUGLEY.93Jan8123747@pierrot.comlab>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!comlab.ox.ac.uk!inca!Damian.Cugley
References: <charro.726478178@ee.ualberta.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!comlab.ox.ac.uk!inca!Damian.Cugley
From: Damian.Cugley@comlab.ox.ac.uk (Damian Cugley)
Newsgroups: comp.text.tex
Subject: Re: Margin setting in TeX
Message-ID: <DAMIAN.CUGLEY.93Jan8123747@pierrot.comlab>
Date: 8 Jan 93 12:37:47 GMT
References: <charro.726478178@ee.ualberta.ca>
Organization: Computing Laboratory, Oxford University, UK
Lines: 62
In-reply-to: charro@ee.ualberta.ca's message of 8 Jan 93 07:29:38 GMT