I have a master document that has a lot of entries like the following:


I have each section in its own subdirectory under an entries subdirectory. The file in each subdirectory, as you can see, is called entry.tex. Because each subdirectory is dated, I can sort by the directory name to get the correct order.

I'd like to avoid having to modify this list in the master document every time I add an article. How can I write some LaTeX code to search subdirectories for these files and include them if found? I have been unable to find documentation that describes these kind of file search operations.

  • 2
    If you are prepared to use -shell-escape you could get latex to run ls -R to obtain a file list (or the equivalent in the operating system you use) and then use some macros to convert that to a list of includes. But really, I wouldn't it makes the document fragile and non-portable and the whole point of \include is to filter with \includeonly for which you need the names anyway. If you just want to concatenate them all do cat */*/*.tex > tmp.tex; pdflatex tmp – David Carlisle Feb 6 '15 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.