2

Background. I have written a document with the report document class, where I've been using the twoside option for printing purposes (and other nice things that come with that option, such as openright, and the possibility to distinguish between even and odd pages when working with fancyhdr).

A (sort of) minimal example:

\documentclass[a4paper,twoside,openright,11pt]{report} 

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancypagestyle{MyStyle}{
\fancyhead[RO]{\nouppercase{\rightmark}}
\fancyhead[LE]{\leftmark}
\fancyfoot[C]{\thepage}
}
\usepackage{blindtext}

\begin{document}
\pagestyle{MyStyle}
\chapter{First chapter}
\blindtext[5]
\end{document}

Problem. I now want to create an online version of the report, identical to the printed version in all aspects except that the left and right margin should be 'evened out' (i.e. set to their average), to make it look better on a computer screen.

Changing to oneside instead of twoside doesn't seem to work without causing problems with openright and fancyhdr. I have also tried \usepackage[hmarginratio=1:1]{geometry} but that causes unwanted changes to other geometric parameters such as the textwidth.

Any ideas about what can be done here?

1

From the terminal I do

> latexdef -v -c [a4paper,twoside,11pt]report textheight textwidth

\the\textheight:
595.80026pt


\the\textwidth:
360.0pt

The “mysterious” value for the height is for accomodating 44 lines (43 times the 13.6pt baselineskip plus the 11pt topskip).

Add the information to the parameters to geometry (and don't forget to set the head height in any case):

\documentclass[a4paper,twoside,openright,11pt]{report}

\usepackage[hmarginratio=1:1,textwidth=360pt,textheight=595.8pt]{geometry}

\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\fancypagestyle{MyStyle}{%
  \fancyhead[RO]{\nouppercase{\rightmark}}%
  \fancyhead[LE]{\leftmark}%
  \fancyfoot[C]{\thepage}%
}
\setlength{\headheight}{13.6pt}

\usepackage{blindtext}

\begin{document}
\pagestyle{MyStyle}
\chapter{First chapter}
\blindtext[5]
\end{document}

Just for checking: in the log file I get

*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
*geometry* verbose mode - [ preamble ] result:
* driver: pdftex
* paper: a4paper
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* hratio: 1:1
* modes: twoside 
* h-part:(L,W,R)=(118.75394pt, 360.0pt, 118.75394pt)
* v-part:(T,H,B)=(99.69861pt, 595.80026pt, 149.54797pt)
* \paperwidth=597.50787pt
* \paperheight=845.04684pt
* \textwidth=360.0pt
* \textheight=595.80026pt
* \oddsidemargin=46.48395pt
* \evensidemargin=46.48395pt
* \topmargin=-9.57138pt
* \headheight=13.6pt
* \headsep=25.0pt
* \topskip=11.0pt
* \footskip=30.0pt
* \marginparwidth=103.0pt
* \marginparsep=10.0pt
* \columnsep=10.0pt
* \skip\footins=10.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidetrue
* \@mparswitchtrue
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)

If the call to geometry is changed to

\usepackage[pass]{geometry}

we get

*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
*geometry* verbose mode - [ preamble ] result:
* pass: disregarded the geometry package!
* \paperwidth=597.50787pt
* \paperheight=845.04684pt
* \textwidth=360.0pt
* \textheight=595.80026pt
* \oddsidemargin=22.0pt
* \evensidemargin=70.0pt
* \topmargin=18.0pt
* \headheight=13.6pt
* \headsep=25.0pt
* \topskip=11.0pt
* \footskip=30.0pt
* \marginparwidth=103.0pt
* \marginparsep=10.0pt
* \columnsep=10.0pt
* \skip\footins=10.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidetrue
* \@mparswitchtrue
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)

and you can check that the relevant parameters are exactly the same.

Do you need latexdef and the terminal? No: just add

text width: \the\textwidth

text height: \the\textheight

after \begin{document} and look up the values in the PDF file.

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.