Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using Pluma (basically gedit) with a plugin I found to help with tex documents and it does this very well, I just started a new one and activated the preview (because I'll want it at some point) and I have found that an empty document is an error!

\documentclass{report}

\begin{document}

\end{document}

This gives an error about the PDF file not existing, why?

Is it some bug, what could possibly require there to be text for it to work? Adding even a single letter fixes this.

The engine used was "rubber" by the way.

share|improve this question
    
There is an "error" - the file doesn't exist. I spoke about an error not something that was erroneous. This is still helpful though, thank you. addendum the PDF reader isn't upset, rubber is. @egreg –  Alec Teal Feb 5 at 16:24
3  
Welcome to TeX.SX! –  egreg Feb 5 at 16:24

2 Answers 2

The LaTeX code you show produces no page, so no PDF file is written. The PDF viewer can't find it, because it doesn't exist.

It is no error on the LaTeX side; if the front-end is not able to manage the situation, it's a problem of the front-end.

Doing

pdflatex teal && echo $?

where teal.tex is your example file, the terminal reports

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
 restricted \write18 enabled.
entering extended mode
(./teal.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 78 languages loaded.
(/usr/local/texlive/2013/texmf-dist/tex/latex/base/report.cls
Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2013/texmf-dist/tex/latex/base/size10.clo)) (./teal.aux)
(./teal.aux) )
No pages of output.
Transcript written on teal.log.
0

so it's evident that the exit code is 0 (no error).

A program such as rubber (which has been unmantained for several years) or latexmk will signal you a non zero exit code, because they expect some output and assume that a missing PDF file is due to some error. This is wrong, in my opinion, because they could examine the exit code of the pdflatex process (which is only 0 or 1, by the way).

In this case latexmk exits with code 12, but, again, this is not a TeX/LaTeX error. And I don't think there's a workaround, other than making a feature request/bug report to the developers. You'll probably be unlucky with rubber.

share|improve this answer

As @egreg says in the answer: If you don't make PDFLaTeX shipout any page, it cannot produce a PDF, since by PDF specs, it has to contain a page.

Even if you could make a PDF file with no pages, it is a fair decision of PDFLaTeX designers that no PDF file is produced. Because in some cases you don't want any ocument to be produced, for example when running .dtx/.ins file to produce a package .sty file, or when running makebst. However, in such cases, it makes no sense to use pdflatex, one should use latex or tex, depending on which is the proper format to be used in each case.

And needed to add, there's a big difference between no page and one empty page, from the point of view of TeX core. Notice that pdftex won't produce any page with this code:

\bye

(Yes, that was a complete plain-TeX document). However, it will produce a page with only the page number (and one empty whence invisible paragraph if you care) in this case:

\leavevmode\bye

So producing an empty page from an empty document would be a non-sense.

TL;DR

To answer your question: Why rubber treats it as an error? Because its designers/programmers chose it so.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.