I am new to TexStudio. I want to create a new project so I can compose all the projects files inside a single directory or folders. When I open the File menu, it create a new file and there is no option to create a new directory. I also looked at the tool bar and all the icons. I can not see anything that allow me create a new project (directory or folder). Can you help me please? this is important to me. There is no way I can make the projecs files mixed in one place.

  • 1
    Projects are implicit in TeXstudio's philosophy. See here
    – Troy
    Aug 30, 2018 at 18:14

3 Answers 3


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.


If you want to create a project in TeXstudio for some reason, you can do with a hack. Add the following to your "main" project file:

% !TeX TXS-SCRIPT = openproj
% //Trigger = ?load-this-file
% files = [
%   "./file1.tex",
%   "./file2.tex",
% ]
% for (i in files) {
%   files[i] = app.getAbsoluteFilePath(files[i]);
% }
% for (i in files) {
%   app.load(app.getAbsoluteFilePath(files[i]));
% }

This script opens the specified files, as soon as the main file is opened. It is pretty much self-explanatory javascript code. To explain the non-obvious parts:

  • The //Trigger statement activates the script (when it is loaded).
  • The separation in two for loops is needed in case the project files are in separate directories. If you merge the loops and give files = ["./foo/bar.tex", "./baz.tex"], it will try to load ./foo/bar.tex and ./foo/baz.tex

In case you are looking for further info for the scripting, have a look at their docs

This should not be necessary, if TeXstudio correctly recognizes your project. I'd advise against this script if it is not necessary, you'll save yourself some headache.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .