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:
Set up your editor — this is described below.
Add source file information to your DVI file, for example, by using the package srcltx. This has been described in the section Producing TeX files for inverse search.
If you use Emacs and
everything is properly set up, you just press
Ctrl+X Ctrl+J
, and KDVI pops up and jumps to the
place which corresponds to the place of the TeX file which you
are currently editing.
In order to use forward search in Emacs, follow these steps:
Download the following
Emacs script,
kdvi-search.el
(press
Shift and 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.
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.
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
.
Would you like to comment or contribute an update to this page?
Send feedback to the TDE Development Team