Showing posts with label kile. Show all posts
Showing posts with label kile. Show all posts

Wednesday, October 12, 2011

Multi-document project in Kile+Okular

This is a continuation of my last post on synctex via kile and okular. In this post I will discuss how to handle multi-project documents while still having synctex facility.

Required scripts

For multi-document project one can do the following: First download the scripts latexmk and the script makelatex2. If the names of the downloaded scripts have extensions, then remove those extensions such that the name of the scripts are ``latexmk" and ``makelatex2". Make the scripts executable and copy them to your $HOME/bin. Create this directory if you don't have it and then log out and login back.

Kile Configuration

Open kile and do the following configuration
Kile > Settings > Configure Kile > Tools > Build 
  New
    Tool Name: makelatex2
    Class: LaTeX
    General:
        Command: makelatex2
        Options: -e- -w- -b- '%source'
    Advanced:
        Type: Run Outside of Kile
        Class: Compile
        Targe extension: pdf
        State: Editor
    Menu:
        Add tool to Build menu: Compile

  Quick Build
    General:
        makelatex2
Now for any sub-documents in the multi-document project include a line
%!TeX root=master.tex
within the first 5 lines. Here master.tex is your main latex file. The makelatex2 script sees the above line and compiles the master.tex file.


Changing the default typesetting command

Default compilation command is pdflatex. However if you want to change the compilation command, then you can do it from the document itself without changing any configuration. Just include the line
%!TeX program=latex+dvipdf
Other compilation commands supported by the makelatex2 script are
pdflatex
    latex
    latex+dvips
    latex+dvipdf
    latex+dvips+ps2pdf
    xelatex
Note that
  • Forward and reverse search however doesn't work with ps file, i.e. with latex+dvips.
  • For multi-document the typesetting comment %!TeX program has to be specified only in the master tex file.

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 
    PDFLaTeX
        General:
            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 
    ForwardPDF
        General:
            Command: okular
            Options: --unique '%absolute_target'
        Advanced:
            Run Outside of Kile
            ForwardDVI
            Source extension: pdf
            Target extension: pdf
            State: Editor
        Menu:
            Add tool to Build menu: View
Finally configure the Quick build option.
Kile > Settings > Configure Kile > Tools > Build 
    Quick Build
        General:
            PDFLaTeX
            ForwardPDF

Configuration of Okular


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

Usage

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.