Kile-src-specials-HOWTO

Jurjen Bokma

Abstract

Explanation of a technique to point to a place in a DVI rendering and then automatically jump to the corresponding place in the LaTeX source.


Table of Contents

Introduction
Enabling Source Specials in LaTeX
Using Source Specials in Xdvi
Putting it all together in Kile

Introduction

Source-specials is a way to relate places in a DVI file to corresponding places in a TeX file. It enables you to click on a spot in the DVI file and have your editor jump to the corresponding place in the TeX file, or vice versa. Your editor and your viewer need to be configured in order to do so. This HOWTO explains how to enable source-specials in LaTeX, how to use some DVI viewers to point an editor to the right place, and how to put this all to use in the Kile and Emacs environments.

Enabling Source Specials in LaTeX

You can start LaTeX with the option -src-specials in order to have source specials available in the DVI file.

Using Source Specials in Xdvi

When reading a DVI file with source specials, Xdvi needs some options in order to tell your editor where to jump. You can start it like this: xdvi -editor '<editor>' dvi-file where you replace '<editor>' with the appropriate command.

Putting it all together in Kile

In Kile, making this work involved three steps. First you need to make the LaTeX that is started from Kile use source specials.

Procedure 1.  Make Kile's LaTeX use source specials

  1. After starting Kile, click "Settings", then "Configure Kile"

  2. In the "Configure- Kile" windows, click on the "Build" icon in the column on the left of the window

  3. In the "Select a tool" list, click "LaTeX"

  4. The line named "Command" should say something like latex

  5. The line named "Options" should say something like -src-specials -interaction=nonstopmode '%source'. The important part here is the -src-specials, but you may have used your own options to tune it.

  6. Click "OK"

If you click the "LaTeX" icon now, you will have Source Specials in your DVI file. (That is, if the document is processed without errors.)

Then you need to enable jumping from the LaTeX file to the appropriate area in the DVI file. If you use the embedded viewer, you don't need to do anything. I haven't figured out how to enable this using Xdvi, as the parameters passed from Kile seem to be incompatible with those Xdvi accepts. However, Lluis Alseda wrote a small script script that converts the parameters.

You can click "Build", then "View", then "ForwardDVI" to go from the LaTeX file to the appropriate place in the DVI file. You could create a shortcut key for this within Kile.

Now you need to enable jumping back from the dvi viewer to the right line in the LaTeX file. If you use the embedded viewer, you can press the middle mouse button in the DVI view to jump to the corresponding place in the LaTeX file.

Procedure 2.  Enable jumping back from Xdvi to the corresponding line in the LaTeX file

  1. After starting Kile, click "Settings", then "Configure Kile"

  2. In the "Configure- Kile" window, click on the "Build" icon in the column on the left of the window

  3. In the "Select a tool" list, click "ViewDVI"

  4. In the "Select a Configuration" menu, use "KDVI"

  5. The "Command" line should say: xdvi

  6. The "Options" line should say: -editor "kile --line %l %f" '%target'

  7. Click "OK"

You can now press the left mouse button while holding down the <CTRL> key in Xdvi in order to jump to the corresponding place in the LaTeX document.