When I input

  Hello World!

and compile with pdfLaTex, the output .pdf file is created and looks good. My sourcefile doesn't.


  • 7
    Well don't name your tex file pdf! You are overwriting your file with the generated pdf.
    – Juri Robl
    Jan 14, 2015 at 22:03
  • 4
    As already noted, that's a PDF if viewed as a text file: you got a very badly chosen file name.
    – Joseph Wright
    Jan 14, 2015 at 22:08
  • helgso, the source file (with the tex extension) and the file produced (a pdf or a div) are two different things! From myfile.tex, (pdf)latex will produce a file called myfile.pdf. I find this mistake rather funny.
    – Clément
    Jan 14, 2015 at 22:16
  • Welcome to TeX.SE. Jan 14, 2015 at 22:32
  • I knew it was something as simple as that. You can't google this stuff! Thank you guys haha
    – helgso
    Jan 14, 2015 at 22:36

1 Answer 1


Output overwriting input...

In this case, it is obvious what happens because of using the output extension for the input extension. In olden times, one rather subtle but quite dreadful mistake you could commit was writing


which resulted in LaTeX writing auxiliary data on a file chapter1.tex.aux which the DOS file system abbreviated to chapter1.tex which was then gone.

Later versions of emTeX were smarter about what file names it would overwrite, and when it would refuse. But this trap was present in several DOS-based TeX distributions.

I'm still somewhat surprised by TeXWork's behavior: I'd have expected LaTex.pdf (cough cough) to be compiled into LaTex.pdf.pdf without conflict. Or at least, like emTeX in olden times learnt to do, to refuse overwriting the original file. I almost fear that this behavior could result in resuscitating the above-mentioned age-old \include catastrophe.

  • Well, try making a file test.pdf with contents Hello, World! \bye and run pdftex test.pdf. It will say at the end: Output written on test.pdf (1 page, 12037 bytes). This has nothing to do with TeXworks, this is simply pdftex's default behaviour: it expects user to know better than mess with the extensions so badly ;)
    – yo'
    Jan 15, 2015 at 17:27
  • The output filename is calculated by the tex engine not by the texworks editor, web2c tex has always discarded the extension and appended its output extension so you can have for example myfile.ltx for latex files, producing myfile.dvi Jan 15, 2015 at 17:27

You must log in to answer this question.

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