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 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?

share|improve this question
add comment

1 Answer

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

#!/bin/bash                                                                     
emacsclient -a emacs --no-wait +$1 $2

fs=$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.

share|improve this answer
add comment

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.