Live Preview

From Kile
Jump to: navigation, search
Screenshot of Kile's Live Preview Feature

The live preview feature of Kile will automatically run (PDF)LaTeX as soon as the currently edited document changes and display the compiled output next to the LaTeX code. The compiled output that is shown in the preview window can be kept centered around the cursor position in the LaTeX code.

The prerequisites for trying out the live preview feature are:

  • PDFLaTeX with SyncTeX support (as provided in the TeX Live 2010 distribution, for example)
  • Development version of Okular, compiled from the 'master' branch in Okular's Git repository with PDF support
  • Development version Kile (compiled from the 'master' branch) in Kile's Git repository

Current Status

Currently, the implementation of the live preview feature is limited in the following ways:

  • only PDFLaTeX is supported at the moment

Compiling and Installing Okular & Kile

Just as usual, for compiling Okular and Kile a recent C++ compiler, the CMake tool and the development packages of certain libraries are required.

In particular, development packages of Qt, of kdelibs 4.6 (or newer) and of Poppler(-Qt4) (for PDF support in Okular) have to be installed. Also, see [1] and [2] for more information.

First of all, we create new directories. Then, we download the source code by cloning Kile's
and Okular's Git repositories, and by checking out the appropriate branches:
$ cd
$ mkdir -p kile-livepreview/src
$ cd kile-livepreview/src
$ git clone git://
$ git clone git:// -b master

We then create build directories, configure the build system, and compile & install Okular first:
$ cd ..
$ mkdir build-okular
$ cd build-okular
$ cmake ../src/okular -DCMAKE_INSTALL_PREFIX=$HOME/kile-livepreview/install -DCMAKE_BUILD_TYPE="Debug"
$ make install -j 2

and subsequently Kile:
$ cd ..
$ mkdir build-kile
$ cd build-kile
$ cmake ../src/kile -DCMAKE_INCLUDE_PATH=$HOME/kile-livepreview/install/include/ -DCMAKE_INSTALL_PREFIX=$HOME/kile-livepreview/install -DCMAKE_BUILD_TYPE="Debug"
$ make install -j 2

Then, the following lines have to be copied to a file "$HOME/kile-livepreview/":
export KDEDIRS=$HOME/kile-livepreview/install/:$KDEDIRS
export KDEHOME=$HOME/kile-livepreview/.kde
export LD_LIBRARY_PATH=$HOME/kile-livepreview/install/lib64:$HOME/kile-livepreview/install/lib:$LD_LIBRARY_PATH


and we have to set the correct permissions for the script "":
$ chmod +x $HOME/kile-livepreview/

Finally, Kile can be started with:
$ $HOME/kile-livepreview/

Updating the Source Code

From time to time it is recommended to update the source code of Okular and Kile in order to try out the most recent changes. This can be done as follows.

First, the source code of Okular and Kile is updated:
$ cd $HOME/kile-livepreview
$ cd src/okular
$ git pull
$ cd ../kile
$ git pull

Next, Okular and Kile are compiled and installed:
$ cd $HOME/kile-livepreview/build-okular
$ make install
$ cd ../build-kile
$ make install

After such an update it is recommended to reset the configuration of the tools. In order to do so, open the tool configuration section in the configuration dialog, which can be found under Settings / Configure Kile... / Tools / Build, and press the "Restore Default Tools..." button.