I've downloaded the comjnl template from the "Computer Journal" website. When I compile the template, it generates a pdf file without the page footer. I sent the template to a collegue which has a previous version of latex installed and it compiles fine. How can I resolve without re-installing my latex environment?

I'm using windows 10, last version of Miktex and last version of Texstudio.

ps: I also tried other IDE without results.

  • Is the bottom of the page empty, or has it been cut off? – Ian Thompson Nov 18 '16 at 13:40
  • Yes, see my answer. – Pieter van Oostrum Nov 18 '16 at 13:42
  • @IanThompson it's cut off! and the next page has the header shifted down! – bjorn Nov 18 '16 at 14:12
  • Try putting these in your preamble: \pdfpagewidth=210mm and \pdfpageheight=297mm – Ian Thompson Nov 18 '16 at 16:04

In newer releases of LaTeX, paperheight is taken as the value for the bounding box of the output PDF file. On the other hand, the class sets things up for printing on 210 x 276 paper format.

They apparently use DVI as output, with latex and, indeed, xdvi will show

enter image description here

You can cure the problem by adding


somewhere before \begin{document}.

Here's the output of a PDF viewer after the cure:

enter image description here

  • \AtBeginDocument{\pdfpageheight}{297mm} seems wrong. At least that should be \AtBeginDocument{\pdfpageheight297mm}without the inner braces. But there is no need for \AtBeginDocument. It can also be done by putting \pdfpageheight297mm after \begin{document}. Or use the more LaTeXy formulation: \setlength{\pdfpageheight}{297mm}. – Pieter van Oostrum Nov 18 '16 at 16:22
  • @PietvanOostrum Yes, thanks for noting the mistake. I prefer not to have general setup after \begin{document}, which explains \AtBeginDocument. – egreg Nov 18 '16 at 16:24
  • But even with this setting, and also with setting \paperheight to 297mm rather than 276mm, \layout shows that the footer is outside the paper area as defined by \paperheight. I think this is fundamentally wrong. – Pieter van Oostrum Nov 18 '16 at 16:38
  • @PietvanOostrum The class is apparently written with xdvi and dvips in mind, as the first image clearly shows. – egreg Nov 18 '16 at 16:42
  • Also with dvi as output, the \layout shows the footer below the lower paper edge, which is a wrong design, even if you print it on larger paper. NB. the original \paperheight was 276mm, which is about 2cm shorter. No wonder the footer fell of the paper. – Pieter van Oostrum Nov 18 '16 at 18:31

The class file comjnl.cls wrongly calculates the \textheight. If you add the layout package and the \layout call, it shows clearly.


It shows that the footer is outside the paper area. The \textheight calculation fails to account for the footer area. Adding


before or after


will resolve that. But I cannot understand why this would not be a problem on your colleague's system, unless he/she uses a pdf viewer that shows more than the paper size.

  • I think that the footer is actually taken into account since \@tempdima is set to 276mm. What I find very suspicious is the line which says \setlength\paperheight{276mm}. It should be 297mm. – Eric Domenjoud Nov 18 '16 at 13:50
  • @Piet van Oostrum I don't know why, but with a previous version of miktex it compiles perfectly! – bjorn Nov 18 '16 at 14:15

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.