How to create a project in TexStudio

The TeXstudio team has already covered this in their FAQ.

The short answer is that the option to explicitly "create a project" is not available (not necessary) because projects are implicit in their philosophy: TeXstudio automatically infers the relations between your project files, and if that fails, there are alternatives like using "Magic commands" to specify project root files etc.

Explicitly declaring a document as root of a project

(when automatic fails)

As @Troy said, the project is automatically created by TexStudio, when in a .tex file, e.g. front-page.tex, you include another .tex files, e.g., \input{./chapters/motivation.tex}. Now, if you open in TexStudio the file motivation.tex, it should be automatically recognised as part of the project front-page.tex.

I had, however, many files included in my "main" file front-page.tex and some of them were not recognised as part of the project. My solution was to explicitly declare my "main" file as root file:

  1. Go to the side panel and select structure. If your desired root document is open should be listed there.
  2. Select your desired root document and open the context menu and click on Set as explicit root document.

enter image description here

In that way, TexStudio is forced to take the chosen document (in my case front-page.tex) as root of a project. And it will be always compiled as root no matter in which file you are editing in TexStudio.