# Connecting GEdit and xdvi

I'm trying to connect GEdit and xdvi. I don't use the gedit LaTeX plugin as I don't use LaTeX, but plain TeX. Well, for the inverse search I compile the TeX file with the "external tools" plugin and the following code:

``````#!/bin/bash
TEXFILE=\$GEDIT_CURRENT_DOCUMENT_NAME
DVIFILE=\${TEXFILE/%.*/.dvi}
LOGFILE=\${TEXFILE/%.*/.log}
if pdftex -output-format=dvi -src-specials -halt-on-error \$TEXFILE; then
xdvi -editor gedit \$DVIFILE
else gedit \$LOGFILE
fi
``````

and the inverse search works quite well.

BUT I'm not able to set the direct search correctly. I'm trying the following code

``````#!/bin/bash
TEXFILE=\$GEDIT_CURRENT_DOCUMENT_NAME
DVIFILE=\${TEXFILE/%.*/.dvi}
xdvi -sourceposition \$GEDIT_CURRENT_LINE_NUMBER \$DVIFILE
``````

but it doesn't work. The error message is "No reference to source file "test.dvi" in DVI file."

Where is the fault?

-
If you are happy to use Evince rather then xdvi you can checkout askubuntu.com/q/68015/19490 –  N.N. Aug 6 '12 at 16:06
@N.N. Sorry, it doesn't works. Thanks anyway. –  Jean Baldraque Aug 6 '12 at 20:15