[comp.sys.amiga] [RAYBRO%UTRC@utrcgw.utc.com: please forward to amiga-relay:re:LaTeX

@utrcgw.utc.com:mark@ardnt1 (mark) (05/30/90)

Pat,

	I'm forwarding an answer to your question about LaTeX
	from 'our resident GURU'.

				
				Mark

------------------------------------------------------------------------------
| Mark Stucky                         | Email:                               |
| United Technologies Research Center |   mark%ardnt1@utrcgw.utc.com         |
| East Hartford, CT.                  |   mast%utrc@utrcgw.utc.com           |
------------------------------------------------------------------------------




Date: Wed, 30 May 90 09:06 EST
From: "William R(ay) Brohinsky" <RAYBRO%UTRC@utrcgw.utc.com>
Subject: please forward to amiga-relay:re:LaTeX margins
To: MARK@ardnt1
X-Vms-To: MAST

>>>>>>>>>>orig. posting:
I need to make a document with precisely set margins (for camera-ready 
copy).  I cannot figure out how to control the margin in LaTEX.  (I have
the Amiga Radical Eye version, but the problem is exactly the same on our Sun
at work.)  \hsize sets the line length, but it does not produce output
centered on the page.  There is an extra about 1 inch offset which, I 
guess must come from the \documentstyle{article} macro; but, how can I 
change it?

I have all of the manuals, but cannot find anything helpful.  I would be very
greatful for the answer.

Pat Palmer (email: reply or ppalmer@oddjob.uchicago.edu)
>>>>>>>>>end.orig.posting

Pat,
Here is Layout.sty, a latex documentstyle option file. At the end of this 
response, there is a short file, layout.tex, which shows how I was using
layout.sty when I made modifications to book.sty to form novel.sty. Novel.sty
is a style file meant to simulate the page-layout of a paperback book.

To use layout.sty:

start the document with the normal \documentstyle declaration, but add
the layout option, thus:

\documentstyle[layout,12pt,twoside]{article}

Then, at some place in the file (usually just after the \begin{document}
add the following:

\layout
\newpage

If the document style is twoside, or the twoside option is in effect, do this:

\layout
\newpage
\layout
\newpage

That way, your text will start on page 3 (you can do things to the page
counter to avoid that.)

I usually use \layout as I do in layout.tex; as a single document. I have,
however, used it at various places in a complex document.

The nicest thing about this option is that it provides measurements of
all of the offset and size counters (expressed in pt), so you can mess with
them.

F'rinstance, since you're having problems with the left margin, you would
see that \leftoffset is set to 0pt. To center the text (assuming that you
need a half-inch shift to the left) you would just add 

\leftoffset=-.5in

in the pre-`begin{document}' declaration section. (Check the syntax---
I am writing this off-the-cuff!)

----------------8< cut here for layout.sty------------------------------------

%------------------------------------------------------------------------------
%
%    layout.sty    (from TUGboat Volume 9 No. 1)
%
% Modified 23-jan-90 by Johannes Braams (JL_Braams@pttrnl.nl)
%                    to check the status of the switch \if@reversemargin
%                    when computing the position of the marginal notes.
%                    Repaired a bug where a `\` was missing.
%
% This file should be called layout.sty and should be placed
% in the TeX_inputs directory.
%
% Define \bs if it is undefined, redefine it if it is already defined
%
\@ifundefined{bs}{\newcommand\bs{\char '134 }}{\renewcommand\bs{\char '134 }}
\@ifundefined{lb}{\newcommand\lb{\char '173 }}{\renewcommand\lb{\char '173 }}
\@ifundefined{rb}{\newcommand\rb{\char '175 }}{\renewcommand\rb{\char '175 }}
\newcount\hofset
\newcount\vofset
\newcount\hofref
\newcount\vofref
\newcount\omargin
\newcount\omarginref
\newcount\emargin
\newcount\emarginref
\newcount\marginref
\newcount\tmargin
\newcount\hheight
\newcount\hsep
\newcount\theight
\newcount\twidth
\newcount\mparsep
\newcount\mparwidth
\newcount\fskip
\newcount\fheight
\newcount\headref
\newcount\bodyref
\newcount\footref
\newcount\margnoteref
\newcount\oneinch
\newcount\topref
\newcount\paperwidth
\newcount\paperheight
%
% Constants
%
\oneinch=72
\paperwidth=600%A4, B4:615
\paperheight=845%A4, B4:795
\topref=\paperheight \advance\topref by -\oneinch
%
% Define calculations macro
%
\def\layout{%
%
%Convert dimensions to scalar values for use in the picture environment
%
\hofset=\hoffset \divide\hofset by 65536
\hofref=\hofset  \advance\hofset by \oneinch
\vofset=\voffset \divide\vofset by 65536
\vofref=\vofset  \vofset=\topref \advance\vofset by -\vofref
%
\tmargin=\topmargin \divide\tmargin by 65536
%
\hheight=\headheight \divide\hheight by 65536
\headref=\topref \advance\headref by -\vofref
\advance\headref by -\tmargin \advance\headref by -\hheight
%
\hsep=\headsep \divide\hsep by 65536
%
\theight=\textheight \divide\theight by 65536
\bodyref=\headref \advance\bodyref by -\hsep \advance\bodyref by -\theight
%
\fskip=\footskip \divide\fskip by 65536
%
\fheight=\footheight \divide\fheight by 65536
\footref=\bodyref \advance\footref by -\fskip
%
\omargin=\oddsidemargin \divide\omargin by 65536
%\omarginref=\omargin
\advance\omarginref by \oneinch
%\advance\omarginref by \hofref
%
\emargin=\evensidemargin \divide\emargin by 65536
%\emarginref=\emargin
\advance\emarginref by \oneinch
%\advance\emarginref by \hofset
%
\twidth=\textwidth \divide\twidth by 65536
%
\mparsep=\marginparsep \divide\mparsep by 65536
%
\mparwidth=\marginparwidth \divide\mparwidth by 65536
%
\if@twoside\ifodd\count\z@
%
% Twosided, odd page
%
   \typeout{Two sided document style, odd page.}
   \if@reversemargin%% JB added
    \margnoteref=\oneinch
      \advance\margnoteref by \hofref \advance\margnoteref by \omargin
    \marginref\margnoteref
      \advance\margnoteref by -\mparsep \advance\margnoteref by -\mparwidth
   \else
    \margnoteref=\oneinch
      \advance\margnoteref by \hofref \advance\margnoteref by \omargin
    \marginref\margnoteref
      \advance\margnoteref by \twidth \advance\margnoteref by \mparsep
%
   \fi
  \else
%
% Twosided, even page
%
   \typeout{Two sided document style, even page.}
   \if@reversemargin%% JB added
    \margnoteref=\oneinch
      \advance\margnoteref by \hofref \advance\margnoteref by \emargin
    \marginref\margnoteref
      \advance\margnoteref by \twidth \advance\margnoteref by \mparsep
   \else
    \margnoteref=\oneinch
      \advance\margnoteref by \hofref \advance\margnoteref by \emargin
    \marginref\margnoteref
      \advance\margnoteref by -\mparsep \advance\margnoteref by -\mparwidth
   \fi
  \fi
\else
%
% Not twosided, do odd page
%
 \typeout{One-sided document style.}
 \if@reversemargin%% JB added
   \margnoteref=\oneinch
     \advance\margnoteref by \hofref \advance\margnoteref by \omargin
   \marginref\margnoteref
     \advance\margnoteref by -\mparwidth \advance\margnoteref by -\mparsep
 \else
   \margnoteref=\oneinch
     \advance\margnoteref by \hofref \advance\margnoteref by \omargin
   \marginref\margnoteref
     \advance\margnoteref by \twidth \advance\margnoteref by \mparsep
 \fi
\fi
Dashed lines represent {\tt \bs hoffset} and {\tt voffset}.

\medskip
%
% Define the picture to be drawn
%
\setlength{\unitlength}{0.5pt}
\begin{picture}(\paperwidth,\paperheight)
\centering
\thicklines
%
% Page box and reference lines
%
\put(0,0){\framebox(\paperwidth,\paperheight){\mbox{}}}
\put(0,\vofset){\dashbox{10}(\paperwidth,0){\mbox{}}}
\put(\hofset,0){\dashbox{10}(0,\paperheight){\mbox{}}}
%
% Header
%
\put(\marginref,\headref){\framebox(\twidth,\hheight){\footnotesize Header}}
%
% Body
%
\put(\marginref,\bodyref){\framebox(\twidth,\theight){Body}}
%
% Footer
%
\put(\marginref,\footref){\framebox(\twidth,\fheight){\footnotesize Footer}}
%
% Marginal notes
%
\put(\margnoteref,\bodyref){\framebox(\mparwidth,\theight)%
{\footnotesize \shortstack{Margin\\Notes}}}
\end{picture}

\medskip
%
% Display the settings used to make the picture.
% Note: fractional points are truncated, i.e. 72.27pt is displayed as 72pt
%
{\tt\begin{tabular}{l@{\hspace{20pt}}l}
\bs hoffset = \number\hofref pt & \bs voffset = \number\vofref pt \\
\bs%
  \if@twoside%
    \ifodd\count\z@ oddsidemargin
    \else evensidemargin
    \fi
  \else oddsidemargin
  \fi
= \number%
  \if@twoside%
    \ifodd\count\z@ \omargin
    \else \emargin%% JB the \ was missing here
    \fi
  \else \omargin
  \fi
pt & \bs topmargin = \number\tmargin pt \\
\bs headheight = \number\hheight pt & \bs headsep = \number\hsep pt \\
\bs textheight = \number\theight pt & \bs textwidth = \number\twidth pt \\
\bs marginparsep = \number\mparsep pt &%
 \bs marginparwidth = \number\mparwidth pt \\
\bs footskip = \number\fskip pt & \bs footheight = \number\fheight pt \\[10pt]
\multicolumn{2}{c}{72pt $\approx$ 1 inch}
\end{tabular}}
} % end of \def\layout

---------------8< cut here for layout.tex------------------------------------

%driver file for using layout.sty when you're not
%doing anything else...

\documentstyle[layout]{novel}
%If you're not me, notice that I haven't distributed novel.sty! use
%book.sty, or something you have...
\begin{document}

\layout
\newpage
\layout

\end{document}