Solve #3: Better way of finding main tex file

Instead of searching for predefined main tex file names, I now use a
simple search for files that input or include the current tex file.