Wednesday, September 28, 2011

Synctex in Kile and Okular

In my last post I had discussed about configuring gvim and okular with synctex. In this post I will discuss configuring kile and okular with synctex.

Configuration of Kile for pdflatex

Add the option -synctex=1 for building via pdflatex.

Kile > Settings > Configure Kile > Tools > Build 
            Command: pdflatex
            Options: -interaction=nonstopmode -synctex=1 '%source'
One can do the same configuration for latex as opposed to pdflatex. The ForwardPDF build config should already be present. If not then do the following:
Kile > Settings > Configure Kile > Tools > Build 
            Command: okular
            Options: --unique '%absolute_target'
            Run Outside of Kile
            Source extension: pdf
            Target extension: pdf
            State: Editor
            Add tool to Build menu: View
Finally configure the Quick build option.
Kile > Settings > Configure Kile > Tools > Build 
    Quick Build

Configuration of Okular

Okular > Settings > Configure Okular > 
    General > Program Features > Uncheck 
    "Reload document on file change"
    Editor > Editor: Kile


Open or create a new tex file in kile. Press QuickBuild (Shortcut: Alt+1) to compile via pdflatex. Okular automatically opens the pdf file in the exact page where your cursor is in kile.
For forward search (kile to okular), put your cursor in any text part of your tex file and click on ``ForwardPDF". Okular opens the file to the exact page of your text.
For reverse search (okular to kile), ``Shift+click" on any part of your pdf file in okular. Kile scrolls the file in the exact location.

Other kile configs

Couple of other kile configs which I found useful.
Kile > Settings > Configure Kile > Editor > Editing > General 
    # Tabs configuration
    Insert spaces instead of tabulators
    Highlight tabulators
    Tab Width 4 characters
    # For word wrap (static) 
    # To avoid a long line and also to justify text
    Enable static word wrap
    Show static word wrap marker (if applicable)
    Word wraps at 80 characters
This post however doesn't deal with multi-document projects (Eg: thesis). In my next post I will talk about how to implement handling multi-document projects in Kile + Okular with synctex.
This file was generated via LATEX2html.


  1. Thank you! This was very helpful. But you should add that the editor in the okular configuration has to be set to kile ;)

  2. Glad it helped you. But the editor settings for okular
    is already mentioned under "Configuration of Okular" heading :)

  3. This comment has been removed by the author.


  4. hello, nice, the backward search from okulat to kile works, but the forward search from kile to okular never works by following your suggestions. What could be the reason behind this?

    1. Could you send post your relevant kile configuration settings the way I have done in the blog?