6

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.

3

1 Answer 1

3

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

\usepackage[
        % exact values will vary by template
        paperwidth=\textwidth+0.2cm,
        paperheight=\textheight+2cm,
        text={\textwidth,\textheight} % without this line, errors occur
    ]{geometry}

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

\usepackage[<something>]{geometry}

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:

\geometry{
  paperheight=\dimexpr\textheight+1cm\relax,
  paperwidth=\dimexpr\textwidth+5cm\relax,
  marginparwidth=3.5cm,
  left=0.5cm,
  top=0.5cm
}

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 .