The task is to identify latex main files to write a maven plugin processing latex files (conversion into various formats).
Currently, I identify the main file with the pattern
but this is wrong. What about
This would mean that apart from blanks,
\documentclass must be the very beginning of the file.
I remember that there was a second possibility: