I have Tex live 2011 installed with Emacs 23. AUCTeX and Okular. I have also configured Emacs/AUCTeX to work with Okular supporting forward and inverse search.

But. Here's my question. If I have Emacs and Okular docked side by side and when I click on Okular, the cursor is taken to Emacs. But. If I have Okular and Emacs in two maximized windows, and when I click Okular, the Emacs window is not brought up to the front.

Have I configured SyncTeX correctly or is this how it is supposed to work?


I came across the same problem today on Ubuntu 12.04. The main problem is that the Emacs window is not brought to front.

I am using Ubuntu 12.04 with Emacs/AucTex/Okular/TexLive 2011. I found that if I press Shift+LeftMouse twice in Okular, the Emacs window will be brought front. So this can be seen as a workaround.

You could also configure the Custom Text-Editor in Okular.

First install xdotool

sudo apt-get install xdotool

Then save the following script

emacsclient -a emacs --no-wait +$1 $2

filename=$(basename "$fs")
pathname=$(dirname "$fs")
xdotool search --name $filename windowactivate

The script will first call emacsclient, then bring a window whose title contains the filename of the TeX source to front.

Make the script executable and write the following command (don't include ~ in your path) in the Custom Text-Editor in Okular.

<absolute-path-to-script> %l %f

Hope it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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