I figured out how to solve this. The problem was that the instance started by Synctex wasn't recognized by the command in my 'External Tools' script.
The Synctex instance was listed as /usr/bin/evince file:///path/to/my/file.pdf
, whereas the instance called by xdg-open was listed as evince file.pdf
.
So, I just changed my script such that it will also be listed as /usr/bin/evince file:///path/to/my/file.pdf
. My External Tools script now reads:
#!/bin/bash
if [ "$GEDIT_CURRENT_DOCUMENT_TYPE" == "text/html" ]; then
google-chrome $GEDIT_CURRENT_DOCUMENT_NAME
elif [ "$GEDIT_CURRENT_DOCUMENT_TYPE" == "text/x-tex" ]; then
filename=$GEDIT_CURRENT_DOCUMENT_NAME
shortname=`echo $filename | sed 's/\(.*\)\.tex$/\1/'`
path=file://$GEDIT_CURRENT_DOCUMENT_PATH
shortpath=`echo $path | sed 's/\(.*\)\.tex$/\1/'`
latex -synctex=1 -interaction batchmode -src $filename
dvips -t a4 $shortname.dvi
ps2pdf -sPAPERSIZE=a4 -dOptimize=true -dEmbedAllFonts=true $shortname.ps
rm --interactive=never $shortname.dvi $shortname.out $shortname.ps $shortname.blg $shortname.toc $shortname.log
#xdg-open $shortname.pdf
/usr/bin/evince $shortpath.pdf
else
echo "I don't know how to compile files of the type:" "$GEDIT_CURRENT_DOCUMENT_TYPE"
fi