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

Conversation

adkbeckett
Copy link

@adkbeckett adkbeckett commented Dec 12, 2024

Summary of changes

Changed handling of page layout over to geometry package, making it simpler and more transparent. This also makes it safe to call geometry alongside edmaths for customisation; previously, doing so would cause LaTeX to ignore the page layout specifications in edmaths.

Comparison of output

The total inner and outer margins remain set at 40mm and 25mm respectively (as specified by UoE printing services), but the inner is now specified as a 25mm page margin + a 15mm binding offset (thanks to @PatrickKinnear for suggesting this). These and other page layout specifications are now much more transparent. If desired, geometry can be used to set the binding offset to 0 for electronic versions or to customise the margins, binding offset and other page layout settings more generally; see below.

Previously, the text height was determined using the calc package and set manually. The geometry option heightrounded = true (which is generally recommended anyway) essentially serves the same purpose: where what would be the final line of text on the page does not exactly fill the body text box (which can lead to an underfull vbox warning), the box is allowed to stretch into the bottom margin just enough to fit another line of text.

Results obtained from edmaths before and after this update can be compared using showframe and layout (though unfortunately layout does not clearly display the dimensions we're interested in):
Old version:
old-showframe
old-layout
New version:
new-showframe
new-layout
Note that the output is almost identical, except that space for marginal notes was previously implicitly allowed but fell off the page; it is now removed completely by default (the outer margin is too narrow anyway).

Compatibility with geometry package

Although not previously noted as an issue on GitHub, the old version was incompatible with geometry. Although it would not throw an error, LaTeX would completely ignore the page specifications of edmaths if geometry was called after it, setting options not specified in the call to geometry's default. Compare the "old version" output above to the following, which is the result of using the old version of edmaths and calling geometry. The outer margin is wider than the inner and there is no binding offset.
old-showframe-geometry-called
old-layout-geometry-called
The update fixes this bug; now, if geometry is called after edmaths, the edmaths specifications remain default.

Customisation

As per the discussion at Pull Request #20 , the page layout specified by edmaths does not follow typical conventions for margin sizes and is sub-optimal for viewing on a screen. Other than making the binding offset explicit, this update does not make any changes to the default page layouts to address these issues, prioritising backward-compatibility and compliance with the specifications of the thesis printing service mentioned above.

That said, this update makes it possible to easily customise any of the page layout specifications using geometry from within the thesis .tex file. Since the package is called in edmaths, we can simply insert geometry{<options>} into the preamble. For example, if we want to get rid of the binding space (for on-screen viewing, for example), we can do

\geometry{bindingoffset=0mm}

(we might also want to change to oneside at documentclass for this), or if we want to keep the binding offset but make the outer margins larger than the inner and allow for marginal notes,

\geometry{inner=15mm,outer=35mm,marginparwidth=25mm,marginparsep=5mm}

Final notes

  • Requires the geometry package.
  • No longer requires the calc package.
  • Fixed compatibility with the geometry package.
  • Changes to existing documents which currently use edmaths are expected to be minimal as per the screenshots above, but behaviour of figures, math expressions etc. around page breaks should be checked.
  • Supercedes updates margins for twoside #20.
  • Not a fix for Hardcoded Page Geometry #21 but may be of assistance.

Type of changes

  • [ x] Bug fix (non-breaking change which fixes an issue)
  • [ x] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ x] This change requires a documentation update

adkbeckett and others added 3 commits September 2, 2023 00:42
…nstitutional nomenclature: Changed the implementation of the declaration to allow it to be edited within the document (and included an example from the University guidance documentin the example report); defined environments for lay summary, acknowledgements; added option for a sans-serif font (Computer Modern Bright); added option to declare a short version of the title for headers if the fancyhdr option is used.
…impler and more transparent. This also makes it safe to call geometry alongside edmaths for customisation; previously, it would cause latex to ignore the specifications in the stylefile.
@adkbeckett
Copy link
Author

Update re: breaking changes

Generating my old thesis (298 pages containing various types of complex multiline math expressions which split over page breaks as well as some figures and tables) with both versions of edmaths produces apparently identical output, confirming that there are no breaking changes expected for existing documents.

@Foggalong Foggalong added the report Relates to the edmaths document stylesheet label Dec 17, 2024
@Foggalong Foggalong self-requested a review December 17, 2024 20:24
Comment on lines -159 to -163
% 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}

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
report Relates to the edmaths document stylesheet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants