This question already has an answer here:

I've been using Latexian for a while. Its LivePreview feature is very convenient, which is why I'm keeping using it.

Recently, I've heard about LuaTeX / LuaLaTeX. I tried a couple of examples but I couldn't make it work with Latexian.

Specifically, compiling the following code via terminal "lualatex test.tex" works ok.


The standard approximation $\pi = \directlua{tex.sprint(math.pi)}$

As expected, this doesn't compile in Latexian since it uses "pdflatex".

I tried to delete "pdflatex" file in /usr/texbin and create a symbolic link named "pdflatex" pointing to "lualatex" to trick Latexian, but it didn't work. I get the following error:

 This is LuaTeX, Version beta-0.76.0-2013061817 (rev 4627) 
 \write18 enabled.

---! pdflatex.fmt was written by pdftex
(Fatal format file error; I'm stymied) 

Even in terminal, trying to compile with "pdflatex" (now pointing to "lualatex") doesn't work. Same error as above.

Any ideas?

marked as duplicate by Alan Munn, Jesse, cmhughes, Guido, user31729 Jun 9 '14 at 5:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Could you be a bit more specific? What did you try, what didn't work? – Martin Schröder Feb 13 '14 at 9:01
  • Ok, I edited the question adding more information. Thanks. – Daniel R. Pipa Feb 13 '14 at 11:53
  • The error message is seriously confusing: LuaTeX asks for pdflatex.fmt? – Martin Schröder Feb 13 '14 at 11:56

Ok, I got it.

LuaTeX calls, at some time, pdflatex. If pdflatex is pointing to luatex, then we get an infinite recursion.

Instead, I replaced pdflatex with the following bash script:

PARENT_COMMAND=$(ps $PPID | tail -n 1 | awk "{print \$5}")
if [ $PARENT_COMMAND == '/Applications/Latexian.app/Contents/MacOS/Latexian' ]; then
        lualatex "$@"
        pdftex "$@"

It identifies who's calling pdflatex. Then, if Latexian calls pdflatex, it is redirected to lualatex. Else, it calls pdftex, to which pdflatex pointed before the modification.

Not the answer you're looking for? Browse other questions tagged or ask your own question.