1

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.

\documentclass{article}

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

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?

1 Answers1

3

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:

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

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.