# Different margins for on-screen pdf and for printed pdf

Is it possible to have different margins for printing from those shown on screen? I'm writing my thesis and for the paper version I would like a larger inner margin to allow space for the binding, but when viewed on screen I'd like the text to be centred (so left margin = right margin).

Here's a MWE (with margins for printing and binding):

\documentclass[twoside,a4paper,12pt]{book}
\usepackage[bottom=3cm,top=3cm,outer=3cm,inner=4cm]{geometry}

\begin{document}

\include{Chapter1}
\include{Chapter2}

\end{document}


So for printing I would like

\usepackage[bottom=3cm,top=3cm,outer=3cm,inner=4cm]{geometry}


but for on-screen viewing I would like

\usepackage[bottom=3cm,top=3cm,outer=3.5cm,inner=3.5cm]{geometry}


Obviously I could just make two different pdf files, one for printing and one for on-screen viewing, but I think it would be pretty cool if this could be done with just one file (much like the ocgcolorlinks option for the hyperref package disables colours for printing).

\documentclass{article}

\begin{document}
\ifdefined\screenview
screenview % set margins for screen
\else
PDF % set margins for PDF
\fi

\end{document}


On command line

pdflatex "\def\screenview{} \input{whatever.tex}"


Note: I've no idea what the extra braces in \screenview{} are for, but they do seem to be necessary.

• I've added your suggestion to the preamble (ended with \fi, right?). The document compiles with the regular command pdflatex whatever.tex, giving the non-centred margins for printing, but when I try the command you suggested, the terminal starts its thing but then jams up after loading the Babel languages. This may well have something to do with the Linux on my machine though (it's a university network machine and I have no admin rights), rather than with the TeX code. Is there a alternative solution? – dwolfeu Jun 30 '16 at 16:11
• @DanielWolf See my updated answer for a solution I don't understand. – Ethan Bolker Jun 30 '16 at 19:30
• Without the curly brackets, you are trying to define \screenview as  \input{whatever.tex} which means every time you use \screenview it must be used as \screenview \input and it will then produce the text whatever.tex. I think. Certainly it won't do what you want, even if I'm wrong about what it does which you don't want. – cfr Jul 1 '16 at 0:05
• @cfr Once you explained it it makes perfect sense thanks. – Ethan Bolker Jul 1 '16 at 0:44
• @EthanBolker It now compiles okay. However, while it appears centred on screen, it also prints centred. Just to clarify, this is my preamble: \ifdefined\screenview \usepackage[bottom=3cm,top=3cm,outer=3.5cm,inner=3.5cm,headheight=16pt,heightrounded=true]{geometry} \else \usepackage[bottom=3cm,top=3cm,outer=3cm,inner=4cm,headheight=16pt,heightrounded=true]{geometry} \fi – dwolfeu Jul 1 '16 at 11:19