I have several tex files to create a pdf.

The root.tex use \input{} to import other tex files.

While I'm editing other tex files, I want to compile my tex by using some shortcut instead of using mouse to switch to root.tex and compile it.

My question is: Is there any shortcut that can help me compile the root.tex no matter which file I'm in in Kile?

  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – Speravir
    Feb 6, 2014 at 15:06
  • Create a project and specify the root file in the project preferences (or let Kile guess if it gets it right).
    – cfr
    Feb 6, 2014 at 15:06

3 Answers 3


You can create projects in Kile.

In Kile you can create and work with projects. A project is a group of LATEX, graphic, BibTEX or other files that contain all the information that is used to build your complete document. A typical project would be a document consisting of several chapters, written in different .tex files; all of them could be included in a project, to make the whole document easier to manage. The specifications of the project are stored in a special file, with extension .kilepr.

You can then either let Kile automatically find the root.tex or tell it where to look and then all the build commands work as expected.

  • Thank you very much! Can you give me a hink: which method I should use to let Kile to auto find the root.tex?
    – Mike
    Feb 7, 2014 at 0:47
  • @MikeXu if your root.tex file starts with \documentclass (and no other files in the project do, then Kile should automatically find it. If you have lots of files which start with \documentclass and/or root.tex does not start with documentclass, then you might need to tell Kile which file is root.tex. It is pretty easy, just try it.
    – StrongBad
    Feb 7, 2014 at 9:49
  • Thank you so much! I will try. Hmm, it did have root.tex only have the \documentclass...
    – Mike
    Feb 7, 2014 at 12:31

In case someone is still ending up here for a solution, you should know that now it is possible to set a master file in Kile.

Just go to: menu > Settings, and click on entry "Define Current Document as 'Master Document'".

From then on, any compile command that you run (either from shortcuts or by clicking on a button) will have as argument the master file.


If you don't like Kile Projects, you could do what I do:

At the bottom, below the \end{document} line, I have a line defining a shell alias that, for your case, could look somewhat like

alias rtx="cd home/mike/tex && pdflatex root.tex"

While I work in Kile, I have always a Konsole window open; at the beginning of my work session, I paste the text above into the Konsole window and then, for the rest of the day, I simply type rtx in the Konsole window. Or just use the up-arrow.

That could be made more sophisticated, making the alias persistent or turning it into a short shell script, but I like it exactly this way. Easy and flexible!

  • You may have your reasons for doing so, but compiling outside of Kile you miss at least the ability to click on errors and go to the corresponding line; also you have to constantly switch windows, which may not be so practical: it is far more convenient to just hit Ctrl+6 to run pdflatex than to switch to another window, compile, and switch back to Kile to continue writing.
    – nplatis
    Apr 7, 2014 at 22:16

You must log in to answer this question.

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