# “Predefine” a LaTeX file as master-file using Texmaker

Is there a way to put a command in either the master file or the subfiles in order to sort of predefine the master file? The reason I would like to do this is to avoid having to click on options and define the master file every time I continue working. I'm not sure if this depends on how I set up my scrartcl - but just in case, here is what the folder with the files and what the master file looks like:

"root" folder: report.tex, mystyle.sty, img folder (images), tex folder (subfiles.tex)

\documentclass[a4paper,fontsize=12pt]{scrartcl}
\usepackage{mystyle}

\begin{document}
\changefont{ppl}{m}{n}
\input{tex/titlepage}
\newpage
\input{tex/intro}
\input{tex/sec1}
\input{tex/sec2}
\newpage
\bibliographystyle{plainnat}
%\bibliography{../bib/clusters}   %%% LINUX
\end{document}


And the subfiles are really simple, just containing content.

If there is a way to predefine the master file - I suppose that this depends on the editor used. But is there some generell "LaTeX-command" to do this also? So that one can define the master file generally?

• Why no use Texstudio, it's better than Texmaker and it allows easily Set document as master document? – skpblack Aug 5 '14 at 11:00
• I can set the document as the master document easily in Texmaker, too. The question I am asking is whether or not there is a way I can avoid the two clicks necessary for this - by adding a command to the file or something like that. – menow Aug 6 '14 at 12:20
• You won't need something like this as a LaTeX command. Since LaTeX is basically a program that is run from command line (as well as pdfLaTeX), the user would always choose the 'master document' when s/he uses latex report.tex – HATEthePLOT Feb 20 '16 at 10:04
• As the developers to support magic comments like texshop, texworks, Emacs or arara uses – daleif Feb 20 '16 at 10:39
• No idea about texmaker but in texstudio it is possible to use such magic comments like % !TeX root = ../report.tex. So perhaps texmaker might also recognise it. – user36296 Feb 20 '16 at 10:50

A workaround in Texmaker is to use File -> Session -> Save Session rather than plainly saving the files upon closing the program. It will ask you to define a name and location for the Session-file, called .tks.

Make sure you associate the file-type .tks with Texmaker in case your OS doesn't recognize it automatically.

Next time you want to work on this project, do so by simply opening the .tks-session file (or opening Texmaker and clicking File -> Session -> Load Session). This way all the files from your previous session should be open in the editor AND your master document is also already defined as a master document.

In sum: One more click upon closing Texmaker, but way fewer clicks for starting to work on the project.

• I think this answer misses the point: The initiator asked for a "LaTeX-command" and not for a possibility to set this up in an editor like texmaker. However, I think the only way would be doing this in the editor. – HATEthePLOT Feb 20 '16 at 10:07

Just to have this question officially answered, this was the comment that worked for me:

No idea about texmaker but in texstudio it is possible to use such magic comments like

% !TeX root = ../report.tex

So perhaps texmaker might also recognise it. – samcarter Feb 20 '16 at 10:50