luatex add tag
Caleb (imported from SE)
I have a series of files that I've been compiling with XeLaTeX. I recently attempted to compile with LuaLaTex and it made a royal mess of things. I traced the issue to the use of `\IfFileExists` in one of my macros. The bash script that is handling compile jobs out of the queue is doing a number of things such as retrieving and formatting LilyPond files for inclusion it the TeX document. If it is able to get everything together it creates a flag file in the build directory so TeX knows it can go ahead with processing music at that point.

This MWE acts as expected in XeLaTex but fails in LuaLaTex even when the file exists:



	Song XX:

		Typeset block for when music exists.
		Typeset block for when music doesn't exist.


LuaLaTex doesn't seem to have a problem with file paths as even running `\input` on things in the same directory shows that it can find things there. What's going on?
Top Answer
Caleb (imported from SE)
The LuaLaTeX engine makes some assumptions about file names that XeLaTeX does not. In particular it assumes that all files _should_ have a file extension segment following a period and that if such an extension is not otherwise specified that it _must_ be `.tex`. 

Based on this assumption it is munging the file name and the check `\IfFileExists{XX-has-music}` is actually executing something like `\IfFileExists{XX-has-music.tex}` and failing to find the file. The solution to make LuaLaTeX happy is to include at least one period in all file names. Even adjusting this example to use the filename `XX.has-music` will compile in either engine.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.