Since I’m so paranoid about the up-to-dateness of my tools, I want to install LyX from their official PPA and TeX Live from CTAN and let them work together.

But LyX tend to depend on TeX Live from Ubuntu repository, so I modified the last command to avoid apt from downloading gigabytes of out-dated texlive package:

# add-apt-repository ppa:lyx-devel/release
# apt-get update
# apt-get install --no-install-recommends lyx

But when I ran LyX and tried to compile an article, LyX complained about something:

The external program xelatex finished with an error. It is recommended you fix the cause of the external program’s error (check the logs).

Sadly, no logs produced as “Document -> LaTeX Log” is grayed out. But if I export the LaTeX code and compile from command line, all went fine. And if I launch LyX from command line instead of App Launcher. So definitely the problem lies in the PATH variable: LyX can’t find LaTeX executables!

After install TeX Live 2016 from CTAN, the installer suggested adding this to my PATH variable:

/usr/local/texlive/2016/bin/x86_64-linux/

And all I’ve done was adding it to my ~/.bashrc, so if I don’t launch LyX from bash, the PATH is not correctly set. Then I went to “Tools -> Preferences -> Paths” and filled it to “PATH prefix” as follows

Screenshot_20161014_165605

Save and restart LyX.

Deal!