During my thesis I have multiple md (markdown) files in a git repository. All these md files are chapters of a final book pdf that I want to generate. I would like to use XeLatex so I am thinking of converting all md files to tex files (using pandoc) and then include them in final book.tex file that will export the pdf. (An alternative is to hard copy paste the content of 10 md files in a Latex book template but I think there is a more generic way)
I wrote a Makefile in order to convert md files to tex like below:
I run the Makefile and as a result I took 10 tex files. After that, I tried to include them in the final book.tex file
Each one tex file,as generated from pandoc, has it's own documentclass and i as a result i am getting error during compilation (Latex error: file1 can be used only in preamble). I tried to hard copy-paste the text of the first file in another tex file without documentclass and works fine, without errors.
Is there a way to get the final tex file without copy-paste the content of each sub file? I believe that i need to add something in my Makefile in order to give only one tex file as a result.
Thanks for your attention. I’m looking forward to your reply.