1. Introduction

In this tutorial, we’ll describe the \include and \input commands in LaTeX, as well as their differences.

Both are used to insert content from other files into our main document.

2. Inserting Content From Other Files

\input and \include are two commonly used commands for inserting content into LaTeX. There are several reasons why we need to insert do that:

  • when working on a large document, inserting content from various files makes it easier to identify errors and debug our LaTeX code
  • it increases reusability since we can reuse the same file in different documents
  • it may speed up compilation, especially if we have many figures

One of the advantages is that multiple collaborators can write different parts of a document without conflict. For example, three people working on the same book can write three parts simultaneously:

Combining multiple files into the same LaTeX document.


All we have to do later is combine the three parts.

3. The \input Command

The \input command has the following syntax:


where filename is the name of the LaTeX file (with or without the .tex extension) that contains the content to be inserted. This way, we can insert text, equations, or images.

For example, let’s say we have a section in the file section1.tex:

\section{My First Section}
In a hole in the ground there lived a hobbit.

We can insert its content into our main document using \input:


The end result is the same as if the main document contains the content of section1.tex:

\section{My First Section}
In a hole in the ground there lived a hobbit.

Additionally, we can use \input in our document’s preamble. In that case, the included file should contain only the commands that are allowed to be in a preamble.

4. The \include Command

The \include command can be used to insert larger pieces of content such as chapters or major sections into a LaTeX document. We can use it for both figures and texts. Its syntax is the same as that of \input:


For example, let’s say we have three chapters. We can keep each chapter in its own file and compile the entire book by including them with \include:


The \include command starts a new .aux file for each included file and also adds a page break to the document before inserting a file. The included file will start a new page before processing the \include command. So, we can use it only between \begin{document} and \end{document}. We can’t use it in the preamble.

5. Key Differences Between \input and \include

While these two commands are similar, there are differences:

Rendered by QuickLaTeX.com

Overall, we can use \input for inserting small files or when a page break is not required, while the \include command is more suitable for large files.

6. Conclusion

In this article, we described the usage of both input and include in LaTeX. While \input can be used anywhere in a document, \include can’t be used in the preamble and inserts page breaks.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.