(This answer was tested on Arch Linux with Geany 1.38; let me know if Ubuntu's version is different.)
Open a .tex
file in geany.
Go to Build > Set Build Commands.
Look under LaTeX commands, in the "LaTeX → PDF" row, in the commads column.
For me the default setting is:
pdflatex --file-line-error-style "%f"
Change it to:
xelatex --file-line-error-style "%f"
Or
lualatex --file-line-error-style "%f"
Click OK.
It should now use one of the other engines. If you want to have easy access to multiple engines, you can keep the original one, and add the other (with its own name) to the "Independent commands" section.
You can also add options like -interaction=nonstopmode
and -synctex
here if you want that (but I haven't used geany enough to know how well geany supports SyncTeX).
You could also consider using latexmk, e.g.:
latexmk -xelatex "%f"
This will handle things like calling BibTeX for you, recompilation to make sure all labels are defined, etc.
You could use the "Make custom target" row, but that would be misleading, since you're not using make
. It is possible to create makefiles for LaTeX, but most people don't bother unless they're already adept at using make
for software compilation.
However, the labels in the left column can be anything; that's just what it will appear as in the menu. You can change them too. E.g., if you're probably not going to need to create a .dvi
– and almost no one does in 2022 – you could rename "LaTeX → DVI" to "XeLaTeX → PDF" and use that row with the command above, and it'll get that key binding.
An aside: Be warned that your first time running lualatex often takes a long time since it has to build the font name database. It won't be so long every time!