When I compile with pdflatex.exe or latex.exe the empty document below, I get no errors, no warnings, and no pages of output.


Why is nothing produced? Is there no such thing as an empty .pdf or .dvi file?

(I'm just curious; I don't need an empty file.)

  • 4
    Because there are no paragraphs to output. If you want a blank pdf, write \null or \leavevmode after \begin{document}. Both commands start a paragraph, then TeX has something to output (even it visually empty) Commented Mar 28, 2022 at 12:37
  • There was a question somewhere about the difference of a blank LaTeX and a blank Plain TeX document, but I can't find it now. I think the answers there are what you're looking for Commented Mar 28, 2022 at 12:46
  • Interesting. Feels a bit like set theory, where the empty set {} is different than the set containing just the empty set, {{}}. TeX doesn't want to output an empty document, but it will output a document that contains only an empty paragraph.
    – GregH
    Commented Mar 28, 2022 at 13:00
  • 1
    Kind of, yes. When you write \null, you tell TeX to add an empty box to a (future) paragraph. Then, TeX builds that paragraph using that one (empty, but it doesn't care about that now) box. Then, when building the page it sees that paragraph. So it's more like {{{}}} :) Commented Mar 28, 2022 at 13:09
  • 1
    @PhelypeOleinik Only a single \null does not start a paragraph, nor will this empty box be added to a future paragraph. This \null is added while TeX is still in vertical mode, no? Thus, \leavevmode starts a paragraph, but \null adds an empty line (while still in vertical mode). Commented Mar 28, 2022 at 18:06


You must log in to answer this question.

Browse other questions tagged .