[Tex/LaTex] Arithmetic in arguments to the geometry package

calculationsgeometrymarginspaper-size

I'd like to use the geometry package to auto-crop the output of my LaTeX (so that it looks bigger on-screen as I'm editing). I have found a way to remove the margins completely and brutally:

\geometry{paperwidth=\textwidth,  paperheight = \textheight, margin=0cm}

However, I'd like to be somewhat more gentle. I tried the following, but it does not work:

\geometry{paperwidth=\textwidth + 1cm,  paperheight = \textheight+1cm, margin=1cm}

The reason is that arithmetic does not work inside these arguments. (LaTeX doesn't seem smart enough to do the addition).

What is the correct way to achieve this effect?

Best Answer

It works if you load the calc package.

\documentclass{article}

\usepackage{calc}

\usepackage{geometry}

\geometry{paperwidth=\textwidth+1cm,paperheight=\textheight+1cm, margin=1cm}

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\end{document}