Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm using the SyncTeX plugin in gedit and it seems that ctrl-clicking in gedit (forward-searching) opens up a new instance of Evince even if there was already an instance open.

Is there a way to prevent this from happening? The SyncTeX forward search clearly calls evince in a way that is not the same as e.g. nautilus would.

By the way, I compile my tex files with a script using the "external tools" plugin. The line that opens the pdf file uses xdg-open.

share|improve this question

1 Answer 1

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.