I have occasionally encountered a very mysterious problem that really bugs me and is also kind of dangerous if one creates a large document. However, although I have tried very hard, I'm not able to create a MWE. [But see updates below!]
The general problem is that sometimes the end of a line simply disappears in my PDF output. I'll show one example here for reference, hoping that someone has an idea what the cause might be. This is an excerpt from the second page of a chapter of the book I'm working on and it looks like this if I only compile this chapter with \includeonly:
However, if I comment out the \includeonly line and change nothing else, it suddenly looks like this:
If I only make a minimal change, like changing one word or the spacing, the problem disappears.
My first suspect was the microtype package, but if I use it with the draft option, the problem persists. The font is from the libertinus package, but I've had this problem with other fonts as well. FWIW, I'm using pdfTeX from MiKTeX on a Windows machine. The whole document consists of more than 100 files with lots of packages and tweaks. As I said, I've desperately tried to create a MWE, but to no avail.
Any ideas?
Added because of question in comments: FWIW, the PDF viewer is not the problem. I usually use SumatraPDF, but with Adobe Acrobat oder PDF Annotator, the text is also invisible.
Update (2022-08-17): If some expert wants to dig into this, information on a way to reproduce the problem can be found at http://weitz.de/files/problem_old.zip. (Look at the README file and the comments below.)
Update (2022-09-07): I just came across exactly the same problem again and this time I made sure to create a MWE with which you should be able to reproduce the problem with the latest MiKTeX version (as of today). It is at http://weitz.de/files/problem.zip.
Additional information. In my source file I have Erst im 20.\ Jahrhundert and the problem of the vanishing text goes away if I remove the backslash and make it Erst im 20. Jahrhundert.
Update (2022-09-09): As some people seem to be offended by the files being encoded as Latin-1, I have now changed them to UTF-8. The problem is still there and the MWE is still at http://weitz.de/files/problem.zip.
FWIW, I can reproduce the problem with MiKTeX as described, but not with TeX Live (pdfTeX, Version 3.14159265-2.6-1.40.20) on Ubuntu/WSL.
Update (2024-04-06): For further information see here and here.


%?Like some stray byte got copied in, maybe. Does re-typing that line help? – Cicada Aug 17 '22 at 15:56\includeonly, would it? – Frunobulax Aug 17 '22 at 16:115c00(+next half glyph) goes to 尀, which won't be in a roman font. - I was thinking something like a ZWNJ got in. PDF itself will help. – Cicada Aug 17 '22 at 16:12[(Erst)]TJ -32626.8 0 Td [(im)-250(20.)which means that your line is outside the media box. – Ulrike Fischer Aug 17 '22 at 16:30This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex 2022.9.4), and TL packages as of today. – AlexG Sep 07 '22 at 11:14luainputenccan be used for both and it obviously works. But I think that's orthogonal to the problem at hand. – Frunobulax Sep 07 '22 at 14:42luainputencautomatically loadsinputencif called with an old engine." – Frunobulax Sep 07 '22 at 14:45