How to designate the single .tex file that Coauthor compiles for a LaTeX folder, and what happens when no main file is set.

LaTeX Main Files

Coauthor compiles one main .tex file per folder. The main file is the one that contains \documentclass and \begin{document} and pulls in the rest of the project with \input, \include, or \bibliography. Everything else in the folder (other .tex files, .bib, .sty, .cls, images) is sent along to the compiler as supporting input.

Set the Main File

  1. In the workspace panel on the left, open the folder that contains your LaTeX project.
  2. Hover over the .tex file you want to compile and click More options (the vertical dots).
  3. Choose Set as main.

The file now shows a main badge in the file tree. Only .tex files offer Set as main; .bib, .sty, .cls, and other supporting files cannot be the main file.

When you import a project with more than one .tex file, the import dialog has a Select main file dropdown. Coauthor preselects a file named main.tex if there is one. See Importing Files and Folders.

Templates from the template gallery come with their main file already set.

One Main File Per Folder

Each folder has at most one main file. Choosing Set as main on another .tex file in the same folder moves the badge to that file and the previous file loses its main status.

Subfolders are included in the compile: everything below the main file's folder (for example chapters/ or figures/) is sent to the compiler, so \input{chapters/intro} works. However, the main-file lookup is per folder, so when you are editing a file inside a subfolder the toolbar reports No main file set and saving that file does not trigger auto compile. Switch to any file in the main file's folder and compile from there, or keep your section files next to the main file.

Compiling From Any File in the Folder

Once a folder has a main file, compiling works from any LaTeX file in that folder:

  • If you are editing the main file, the toolbar button reads Compile.
  • If you are editing another file in the same folder, such as sections/methods.tex or references.bib, the button reads Compile main and still builds the main file.

Auto compile behaves the same way: saving any file in the folder triggers a rebuild of the main file. See Compiling and PDF Preview.

When No Main File Is Set

If the folder has no main file, the editor toolbar shows an amber No main file set warning and the Compile button is disabled. Hover over the warning to read the hint: open the file menu next to the .tex file in the workspace panel and choose Set as main.

A LaTeX file that is not inside any folder cannot be compiled at all. Clicking Compile on such a file opens a Move LaTeX Project To A Folder dialog asking you to move the file and its supporting files into a folder first. See Organizing Folders and Files.

Tips

  • Keep the main file at the top level of the project folder and use relative paths such as \input{sections/intro} and \includegraphics{figures/plot.png}. Section files stored in the same folder as the main file get the full Compile main and auto compile behavior. See Multi-File Projects.
  • If the AI coauthor creates a new .tex file for you, it lands in the folder as a regular document; the main file designation does not change.

Related articles

Compiling and PDF Preview
Multi-File Projects
Importing Files and Folders
Creating Documents and Folders

Prefer to ask?

Inside Coauthor, ask the AI coauthor how any feature works — it answers from these same help articles. For anything else, use the ? button in the top-right corner of the app.

Ready to Write Better Research Papers?

Let Coauthor help you with your next manuscript

7 days free, with €2.50 of AI usage on your own paper