Merge LaTeX Files

Quick answer

To merge LaTeX files online, add up to 50 .tex files below, drag them into order and click Merge and Download. The tool keeps the first \documentclass, merges the preambles without duplicate lines, and joins every document body in order. Compile the result to check for package conflicts.

  • Runs in your browser, nothing uploaded
  • No sign-up
  • Up to 50 .tex files

Click here or Drop files to upload

How to use it

  1. 1 Click the upload area, or drag your .tex files onto it.
  2. 2 Drag the files into the order you want the content in.
  3. 3 Click Merge and Download to save merged-file.tex, then compile it.

What to expect

  • Only the first file's \documentclass is used.
  • Identical preamble lines are kept once. Different options for the same package are both kept, so resolve any clashes.
  • Files without \begin{document} (chapter fragments) are added to the body as they are.
  • Images and \input files are not bundled. Keep them in the same folder as the merged file.

Frequently asked questions

Should I merge LaTeX files or use \input?

For a project you keep editing, a main file with \input or \include per chapter is cleaner. Merge into one file when a journal or tool needs a single .tex.

Why does the merged file fail to compile?

Usually two files load the same package with different options, or define the same command. Remove the duplicate from the preamble.

What if two files use different document classes?

Only the first file's \documentclass is kept. Put the file with the class you want first, and check class-specific commands in the others.