-

@ | # News DFaria (RSS Feed)
2025-05-05 04:43:00
The Ridiculously Simple LaTeX Compiler Hack 🤯
Hello everyone! I want to share a very simple yet incredibly useful trick for those of us who work with different LaTeX compilers. In my case, I juggle both PDFLaTeX and LuaLaTeX files, so I often need to switch the compiler in TeXstudio – a task I used to do manually through the options menu, which was always a total nuisance. So I wondered: Is there a way to automate this without constantly tweaking TeXstudio’s settings? Turns out, yes – and the solution is ridiculously simple! All you need to do is add this one line of code at the very top of your document: % !TeX program = lualatex This single line overrides TeXstudio’s default compiler setting, no matter what’s configured in the program options. I believe this also works in other editors like TeXShop or Overleaf, though I haven’t tested those myself. It works with any compiler: PDFLaTeX, LuaLaTeX, XeLaTeX, BibTeX, etc. All you do is change the compiler at the end of the code line. This tiny hack has been a game-changer for me! Maybe everyone already knows it, but just in case – I’m sharing to save you all some headaches. Enjoy! 😊❤️ submitted by https://www.reddit.com/user/HacheComics
https://www.reddit.com/r/LaTeX/comments/1kf3but/the_ridiculously_simple_latex_compiler_hack/