KDE Environment Variable Configuration for Configuring Kile with TexLive 2011

In my previous post I had described the different desktop options with different Linux distributions. The readers surely got a clue about the desktop I might be using. To inform others, I mostly use the KDE desktop, in my workplace as well as in my home. When using KDE desktop one may find a common problem of setting the Path variable for KDE applications. Let me tell you one of those problems when I feel to set the environment variable.

In my lab, and even in my home, I use Kile to writing my scientific articles and presentations. Kile is a KDE application, an IDE for Latex typesetting. Those do not heard about Latex the following quote from the official web site would give some idea about it,

"LaTeX is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation. LaTeX is the de facto standard for the communication and publication of scientific documents."

Using Kile you can create, compile and organize your "tex" files within a single window. Installation of Kile includes required base TexLive (A distribution of Latex) compilers. However, I don't like to use the base compiler because I want to use the latest version of TexLive. The TexLive installed with Kile is TexLive 2009. But I have TexLive 2011 in a DVD. I installed the latest version, added the require path in the "~/.bashrc" file, open a new terminal and run "latex" command. Thats it! The new 2011 compiler is working fine.

Now, I open my Kile project and try "Alt+1" (the shortcut for quick compile) and it fails because require packages are not installed. When examine the cause I found that Kile is still using the 2009 version. [Note: If you install the TexLive 2009 full with Kile you may not find any compilation error.] So, I started Googling for a possible solution. Then I came to know that the KDE application does not use the bash (for information bash is one of the terminals available in Linux. Windows user may consider it as command prompt.) configuration files for initiate the environment variable. I am using Kubuntu. So, thought of setting the path using "/etc/environment" file. It also has no effect on the KDE application viz on Kile.

I got few other complex solutions like recompile Kile from the source code, or install it without recommended packages etc. However the solution is very simple. You only need to set the KDE environment variable that is the PATH variable of the KDE environment. The process is also very simple.

  1. Find the KDE folder for the current user in your system using the command kde4-config --localprefix.
  2. Open the folder.
  3. Find folder "env". If no folder exists with the name, create one folder with the name.
  4. Create a ".sh" file with any name you wish. I create it with the name "path.sh". Note: You do not need to create it as executable. A simple .sh file will do the trick.
  5. Write the PATH variable as you require. Ex. export PATH=<yourpath>:$PATH. Note: In bash the paths are separated with ":" (not ";" like windows) and it is recommended to add ":$PATH" at the end which will add any path sets through other configuration files (if any).
  6. Thats it.

I use the trick for my laptop with Kubuntu and even in my office system with Fedora. However I use this only for setting up the Latex path. All other purpose could be easily solved using this trick if you know that the solution is to setting up an environment variable. Hope this information helps.

Tags: KDE, KDE Path, TexLive, Latex, Kile, Kile With TexLive 2011