I still have no idea how to exit the build process. It tells I need to type H or \end but it also just lies. I find the easiest way is to invoke Ctrl-Z and then kill the background process, and the younglings children
Yeah, what the hell is up with that? I always just echo | pdflatex to make it shut up and exit on error. Maybe one day I’ll learn how to actually use that interactive compilation thing, but not today lol.
So there are many different commands that compile LaTeX, right? pdflatex, pdftex, latexmk, etc. But they all do that thing where they ask for your input as soon as they encounter an error, right? Well, if you just pipe an empty echo command to them, it notices that stdin has reached end-of-file, and gives up trying to ask the user for input, and just exits on first error. So instead of pdflatex mydocument.tex, you can do echo | pdflatex mydocument.tex and it won’t ask you for input if it sees an error, it’ll just exit. There’s probably a “proper” way to achieve the same behaviour, but I can’t be arsed to read the docs.
Speaking of stupid TeX hacks, at one point I had a script called latex_compile_and_install_packages_until_it_works.sh. It’s essentially a loop that repeatedly tries to compile a document, searches the output of the compiler for anything that looks like a missing package error, and pipes it to sudo tlmgr install. The “fuck it” of package management, arbitrary code execution exploit included!
(Sorry for the screenshot, I lost the original script in text form, probably for the better)
Haha that’s brilliant! I have a similar script for Conda, where it tries to install R packages by first looking in bioconductor and then trying the rejects through conda-forge, and then the rejects from that are compiled from source or just outright rejected.
I would have thought you would have needed a (while :; do echo; done) | pdflatex or a yes "\end" | pdflatex, i.e. something that repeatedly generates output. It’s actually quite elegant that pdflatex checks if stdin is already EOF
tries to install R packages by first looking in bioconductor and then trying the rejects through conda-forge, and then the rejects from that are compiled from source
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
Posts must be relevant to programming, programmers, or computer science.
No NSFW content.
Jokes must be in good taste. No hate speech, bigotry, etc.
I still have no idea how to exit the build process. It tells I need to type
H
or\end
but it also just lies. I find the easiest way is to invokeCtrl-Z
and then kill the background process, and theyounglingschildrenYeah, what the hell is up with that? I always just
echo | pdflatex
to make it shut up and exit on error. Maybe one day I’ll learn how to actually use that interactive compilation thing, but not today lol.wait how does your hack work?
So there are many different commands that compile LaTeX, right?
pdflatex
,pdftex
,latexmk
, etc. But they all do that thing where they ask for your input as soon as they encounter an error, right? Well, if you just pipe an emptyecho
command to them, it notices thatstdin
has reached end-of-file, and gives up trying to ask the user for input, and just exits on first error. So instead ofpdflatex mydocument.tex
, you can doecho | pdflatex mydocument.tex
and it won’t ask you for input if it sees an error, it’ll just exit. There’s probably a “proper” way to achieve the same behaviour, but I can’t be arsed to read the docs.Speaking of stupid TeX hacks, at one point I had a script called
latex_compile_and_install_packages_until_it_works.sh
. It’s essentially a loop that repeatedly tries to compile a document, searches the output of the compiler for anything that looks like a missing package error, and pipes it tosudo tlmgr install
. The “fuck it” of package management, arbitrary code execution exploit included!(Sorry for the screenshot, I lost the original script in text form, probably for the better)
Haha that’s brilliant! I have a similar script for Conda, where it tries to install R packages by first looking in bioconductor and then trying the rejects through conda-forge, and then the rejects from that are compiled from source or just outright rejected.
I would have thought you would have needed a
(while :; do echo; done) | pdflatex
or ayes "\end" | pdflatex
, i.e. something that repeatedly generates output. It’s actually quite elegant that pdflatex checks if stdin is already EOFJust do all of these in parallel to maximise the change of installing the correct version
lmao, though it’s noticeably missing pacman, guix, and "pkg install "should be “pkg add” :P