LaTeX forum ⇒ GeneralPDF has empty pages when rendered by system Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
DavidDaily
Posts: 7
Joined: Thu May 09, 2019 5:56 pm

PDF has empty pages when rendered by system

Postby DavidDaily » Fri Jan 10, 2020 5:05 pm

Okay, this one has me completely stumped.
Here's my current setup for rendering:
Gitea in a docker container (Project: https://daviddaily.dev/david/anders)
Project files stored locally in ~/anders
Output stored at ~/fileshare/Anders (this is here: https://files.daviddaily.dev/Anders/)
Texlive installed at ~/texlive
CentOS 7, no gui, using vim to edit files

I have it set up so that theoretically when I push to the master branch, the PDFs for the project rerender using pdflatex. This is done with render.sh:
Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. #!/bin/bash
  2.  
  3. cd "$(dirname "$0")"
  4.  
  5. /usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=All4 All4.tex
  6. /usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=All4 All4.tex
  7. rm All4.aux All4.out All4.toc
  8. mv All4.pdf /home/david/fileshare/Anders/
  9.  
  10. cd "book-1"
  11. /usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book1 "Main.tex"
  12. /usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book1 "Main.tex"
  13. rm Book1.aux Book1.out Book1.toc
  14. mv Book1.pdf /home/david/fileshare/Anders/
  15. cd ..
  16.  
  17. cd "book-2"
  18. /usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book2 "Main.tex"
  19. /usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book2 "Main.tex"
  20. rm Book2.aux Book2.out Book2.toc
  21. mv Book2.pdf /home/david/fileshare/Anders/
  22. cd ..
  23.  
  24. cd "book-3"
  25. /usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book3 "Main.tex"
  26. /usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book3 "Main.tex"
  27. rm Book3.aux Book3.out Book3.toc
  28. mv Book3.pdf /home/david/fileshare/Anders/
  29. cd ..
  30.  
  31. cd "book-4"
  32. /usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book4 "Main.tex"
  33. /usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book4 "Main.tex"
  34. rm Book4.aux Book4.out Book4.toc
  35. mv Book4.pdf /home/david/fileshare/Anders/

I have a git hook for post-recieve set up to do date > anders. This file is watched by incrond, and whenever it is modified it runs the above render.sh as me.

Here's the problem. When I run render.sh myself from the command line, it works wonderfully and all PDFs are beautiful and as they should be.
When it is run by incrond (which I checked, its still running as my user) the output is really messed up to a level I haven't seen described.
The first PDF will render properly, but the other ones in the subfolders will have no data where there should be pages, and where it does show pages they are blank. This is for all 4 subfolders, and it is very consistent.

I have made a copy of the resultant Book1.pdf (and its accompanying Book1.log) when it is run automagically here: https://files.daviddaily.dev/Anders/broken/

Someone is guaranteed to say something about me using \input instead of \include, but I disagree with you. Each include generates an additional garbage file that I would then have to get rid of for no tradeoffs.
Attachments
2020-01-10 09_03_31.png
Screenshot of the resulting broken PDF
2020-01-10 09_03_31.png (8.68 KiB) Viewed 1683 times


User avatar
Ijon Tichy
Posts: 282
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Tue Feb 11, 2020 10:41 am

IMHO this is more a CentOS question than a LaTeX question. Differences in the result of a LaTeX run depending on whether pdflatex is called via GUI or terminal or by different users or using sudo, cron etc. mostly is the result of different permissions or different environments, e.g., setting of PATH, TEXMFCNF, TEXMFINPUTS etc.

BTW: Saving a changed file while a LaTeX run is reading this file could result in errors. This does not happen often but sometimes.

I would suggest to carefully compare a copy of the log files of a working call of your script with a copy of the log files of a not working call of your scripts. Don't forget to delete all temporary/auxiliary files between the tests, not only aux, out, and toc.

BTW: If you'd add an error handler you won't need a second run, if the first one results in errors. Depending in the document you may also need more than two runs. For books I usually need three or four. You can increase speed using option --draftmode for all but the last run.

DavidDaily
Posts: 7
Joined: Thu May 09, 2019 5:56 pm

Postby DavidDaily » Mon Feb 17, 2020 9:47 am

Thank you, I'll look into the logs with a fine-toothed comb. I think if anything is modifying the files it would be the git pull, since this happens even when I push to master from the CLI.

Thanks for the tip, I need to run it a couple times for the ToC to create.

I've been messing around and thought maybe the script wasn't waiting for each command to finish before starting the next, so I added some sleep's in there and somehow that made everything much worse. I think I'm just gonna go with manually running the script until I can find a better way.

In the mean time I moved the broken stuff to https://files.daviddaily.dev/Anders/.broken/, just cause I don't like seeing it all the time.


Return to “General”

Who is online

Users browsing this forum: No registered users and 3 guests