The way I do it is I just copy the standard geany command, and replace "%f" with "main.tex", as in the screenshot here for the command "make main.tex": https://maths.lancs.ac.uk/grabows1/web/files/1.png
However I never get anywhere with it - if I run the command the compiler window just lists the command like in this screenshot: https://maths.lancs.ac.uk/grabows1/web/files/2.png and nothing ever happens.
Is main.tex in the directory listed in the message window after the command?
Yes, it is. But this gave me a push to try not putting "%d" at all in the working directory field, lo and behold, now it works.
It might be a bug or something very counterintuitive - I'm 100% sure that the file main.tex is in the directory listed in the message window, and I'm 100% sure that the file path is as in the screenshot, i.e. just main.tex, not the full path to main.tex etc. But perhaps geany passes the full path to the command?
In any case thank you very much for your help.
Best, Lukasz