Forward search
Prev
Next

Chapter 7. Forward search

The forward search functions allow you to jump from your editor directly into the associated position of the DVI file. Since forward search must be supported by your editor, only Emacs and XEmacs are currently supported. Other editors will hopefully join in soon.

To use forward search, you have to do the following:

Setting up your editor for forward search

Emacs

In order to use forward search in Emacs, follow these steps:

  • Download the following Emacs script, kdvi-search.el (press Shift and left mouse button the filename to download) and store it in a place where Emacs can access it — we recommend a folder emacs-scripts.

  • Add the lines

    (add-to-list 'load-path (expand-file-name "~/emacs-scripts/"))
    (require 'kdvi-search)
    (add-hook 'LaTeX-mode-hook (lambda () (local-set-key "\C-x\C-j" 'kdvi-jump-to-line)))
    (add-hook 'tex-mode-hook (lambda () (local-set-key "\C-x\C-j" 'kdvi-jump-to-line)))
    
    to your .emacs file. Restart Emacs.

  • Open Emacs, load a TeX file, produce the corresponding DVI file, and either enter the command M+xkdvi-jump-to-line or press Ctrl+X Ctrl+J. It may happen that Emacs asks you for the name of a “master file”. This is useful if you use a TeX file which includes other files: the master file is the top-level file which includes the others. Emacs will perhaps also ask to save the name of the master file “as a local variable”, that is, as a comment at the very end of the file. Type either yes or no to continue.

Tip

  • Make sure that Emacs is installed. Try to start emacs from the command line.

  • If Emacs fails to start KDVI, you can find its output in the Buffer kdvi-output.

Kile

If you use Kile, no further setup is necessary.

XEmacs

To set up XEmacs, follow the steps for Emacs above, but modify your .xemacs rather than your .emacs file. If you use a very recent version of XEmacs, .xemacs may be a folder. In that case, append the lines to .xemacs/init.el.

Prev
Next
Home


Would you like to comment or contribute an update to this page?
Send feedback to the TDE Development Team