3

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.

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

2 Answers 2

4

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

% THE FOLLOWING LINE MUST BE ADDED OR PDF VIEWERS CUT THE OUTPUT
\AtBeginDocument{\setlength{\pdfpageheight}{297mm}}

somewhere before \begin{document}.

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

enter image description here

8
  • \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}. Commented Nov 18, 2016 at 16:22
  • @PietvanOostrum Yes, thanks for noting the mistake. I prefer not to have general setup after \begin{document}, which explains \AtBeginDocument.
    – egreg
    Commented Nov 18, 2016 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. Commented Nov 18, 2016 at 16:38
  • @PietvanOostrum The class is apparently written with xdvi and dvips in mind, as the first image clearly shows.
    – egreg
    Commented Nov 18, 2016 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. Commented Nov 18, 2016 at 18:31
2

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

\usepackage{layout}
\begin{document}
\layout

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

\addtolength\@tempdima{-\footskip}

before or after

\addtolength\@tempdima{-\headsep}

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.

2
  • 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. Commented Nov 18, 2016 at 13:50
  • @Piet van Oostrum I don't know why, but with a previous version of miktex it compiles perfectly!
    – bjorn
    Commented Nov 18, 2016 at 14:15

You must log in to answer this question.

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