I intent to write a paper and have to use this template (contains working with placeholder text).

For editing it would be useful to crop the pages, in order to make viewing in TeXStudio's internal pdf viewer with "Fit to Width" or "Fit to Page" zoom level more convenient. Normally I would use the geometry package here, e.g. as described in Pdflatex: fit-page-to-contents or scale-contents-to-fit-page, but for this template this fails. Just importing the preview package - the basis of other solutions - fails likewise, yielding "undefined command" errors (it seems to interfere with some environment definitions from the template).

Are there more robust methods to crop a page to its contents? Ideally the solution would intercept a page after typesetting, but without requiring to run an external command.

For the cropping alone, I would be able to use pdfcrop (Postprocess pdf with \write18) but this breaks synctex, thus doing more harm than good.

  • Use the geometry package to change the page size to equal your desired textblock, with 0 or miniscule margins on all sides. Jul 17, 2015 at 20:56
  • Thanks, that one worked. In the end I used \usepackage[ paperwidth=\textwidth+0.2cm, paperheight=\textheight+2cm, text={\textwidth,\textheight} ]{geometry}
    – kdb
    Jul 20, 2015 at 9:30

1 Answer 1


When using default borders of a journal class

Despite interference of the template with the normal workings of the geometry package, with the hint from Andrew Cashner I got it working finally. I used

        % exact values will vary by template
        text={\textwidth,\textheight} % without this line, errors occur

It is however quite possibly no generally applicable solution; The text=... line seems unnecessary, but is necessary to prevent errors. Hence it is likely that the code will fail for yet other templates.

When trying to override \usepackage[..]{geometry}

In personal documents, where I control the template, I typically set up the page geometry with


but may want to change the geometry for the draft, for better interaction with my editor. In order not to accidentially change the text layout between draft and final version, I don't want to change the \usepackage statement.

For this purpose, the \geometry command is appropriate. E.g. in order to crop the page, except for a thin border and a margin-par for notes:


Here for some reason, an explicit \dimexpr is needed, without which LaTeX will try to typeset "+1cm +5cm".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .