GeneralPDF has empty pages when rendered by system

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

PDF has empty pages when rendered by system

Post by DavidDaily »

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

#!/bin/bash

cd "$(dirname "$0")"

/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=All4 All4.tex
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=All4 All4.tex
rm All4.aux All4.out All4.toc
mv All4.pdf /home/david/fileshare/Anders/

cd "book-1"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book1 "Main.tex"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book1 "Main.tex"
rm Book1.aux Book1.out Book1.toc
mv Book1.pdf /home/david/fileshare/Anders/
cd ..

cd "book-2"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book2 "Main.tex"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book2 "Main.tex"
rm Book2.aux Book2.out Book2.toc
mv Book2.pdf /home/david/fileshare/Anders/
cd ..

cd "book-3"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book3 "Main.tex"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book3 "Main.tex"
rm Book3.aux Book3.out Book3.toc
mv Book3.pdf /home/david/fileshare/Anders/
cd ..

cd "book-4"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book4 "Main.tex"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book4 "Main.tex"
rm Book4.aux Book4.out Book4.toc
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
Screenshot of the resulting broken PDF
Screenshot of the resulting broken PDF
2020-01-10 09_03_31.png (8.68 KiB) Viewed 4611 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

PDF has empty pages when rendered by system

Post by Ijon Tichy »

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.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
DavidDaily
Posts: 7
Joined: Thu May 09, 2019 5:56 pm

PDF has empty pages when rendered by system

Post by DavidDaily »

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.
Post Reply