Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed handling of page layout over to geometry package #22

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 19 additions & 24 deletions edmaths.sty
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,29 @@

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{edmaths}[2024-08-30 Edinburgh maths thesis/report style v0.99]
\RequirePackage{calc,ifthen,setspace,amsmath,amsthm,amscd,amssymb}
\RequirePackage{geometry,ifthen,setspace,amsmath,amsthm,amscd,amssymb}



% PAGE SIZE AND MARGINS
% These settings control the size of the page and its margins. All measurements are
% compliant wih the school's typesetting requirements.

\setlength{\paperheight}{297mm} % A4 Paper
\setlength{\paperwidth}{210mm} %
\setlength{\oddsidemargin}{14.6mm} % Left/Inside: 4.0cm (rel. -1in)
\setlength{\evensidemargin}{-.4mm} % Right/Outside: 2.5cm (rel. -1in)
\setlength{\topmargin}{-17.4mm} % \
\setlength{\headheight}{6mm} % | Top: 2.0cm (rel. -1in), out of which 6mm for the header
\setlength{\headsep}{6mm} % /
\setlength{\textwidth}{145mm} % Margins: 2.5cm + 4cm
% Textheight delayed until we know the line spacing.
% For physical hardback binding, the University printing service demands 4cm inner
% and 2.5cm outer margins. FThis is specified below as 25mm margins on both sides
% plus a 15mm binding offset.

\geometry{
a4paper,
inner = 25mm, % inner margin if two-sided, left if one-sided.
outer = 25mm, % outer margin if two-sided, right if one-sided
bindingoffset = 15mm, % leaves space for physical binding
top = 20mm, % top margin
bottom = 40mm, % bottom margin
headheight = 6mm, % size of header
headsep = 6mm, % distance from top of text to top of header
nomarginpar = true, % zero space allocated for margin notes
heightrounded = true % prevents vbox errors due to textheight not being equal to height of inter number of lines.
}

% The following is removed in favour of the `report' class options "oneside/twoside".
% \@twosidefalse \@mparswitchfalse % Single-sided by default
Expand Down Expand Up @@ -75,7 +81,7 @@
\DeclareOption{masterph}{\renewcommand{\degreetext}{Master of Philosophy}}
\DeclareOption{mastersc}{\renewcommand{\degreetext}{Master of Science by Research}}

% Options relating to stretchfactor (used for margin spacing)
% Options relating to stretchfactor (used for line spacing)
\ifthenelse{\isundefined{\stretchfactor}}{\newcommand{\stretchfactor}{1}}{}
\DeclareOption{single}{\renewcommand{\stretchfactor}{1}}
\DeclareOption{onehalf}{\renewcommand{\stretchfactor}{1.5}}
Expand Down Expand Up @@ -147,20 +153,9 @@
\fi%
} {}



% BODY HEIGHT
% Set up the text body height. For the text height, we calculate the largest number of
% lines that gives us no more than 4cm bottom margin. This depends on the line spacing,
% which we need first.

% Set the line spacing
\setstretch{\stretchfactor}

% Debug only: In the next line, \XXXfactor contains the number of lines on a text-only page.
% \newlength{\XXXunit}\setlength{\XXXunit}{1pt}\newlength{\XXXfactor}\setlength{\XXXfactor}{1pt + ((672pt - \topskip) / \baselineskip) * \XXXunit}
\newlength{\scratchlength}\setlength{\scratchlength}{\topskip + ((672pt - \topskip) / \baselineskip) * \baselineskip + \baselineskip}
\setlength{\textheight}{\scratchlength}

Comment on lines -159 to -163
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current version, the text height adjusts based on the line spacing, set by stretchfactor. Is this preserved with the update to using geometry or no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is handled by \geometry{heightrounded = true} (which is likely to be more robust to other changes than the manual calculation).



% DOCUMENT COMPONENTS
Expand Down