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 am looking for a PDF viewer for working with LaTeX and SyncTeX (forward and inverse search) under Gnome. I know from previous questions in various forums that Okular has this feature, but I prefer not to drag KDE dependencies just for this.

Is there an alternative that would work nicely in Gnome, without too many dependencies? I don't mind using PPAs, building from source, using old X-style tools or writing small scripts - But I need something that is known to work and won't clutter my setup too much.

share|improve this question
    
I use Emacs. I know enough to hack my way with it, but I can't find out what have in Gnome the basic functionality of responding to a click in the PDF according to SyncTeX data. –  Little Bobby Tables Jan 26 '11 at 10:23
add comment

2 Answers

As I noted in a comment, it would help to know if you have a particular editor in mind you want to use along with it.

The gedit-latex-plugin adds a built in PDF preview to gEdit, and I gather it supports SyncTeX forward/reverse searches. Certainly that's what jumps to mind to me when I think of something for GNOME users.

There are other LaTeX editors with built-in previewers that support SyncTeX jumps such as: TeXworks, Texmaker, TeXmakerX. These are all Qt-based rather than GTK-based, but still, none of them require KDE or its libraries like Kile/Okular do. (gummi is GTK based and has a built in previewer -- a live updating one at that -- but I don't think it supports synctex...)

As the other answer notes, evince is supposedly getting this feature, and people are working on the necessary plugins for interaction on the editor side. I gather it uses DBus for interaction--a big mistake if you ask me--but like you can't figure how it works. However, there is an older version of evince in the Arch Linux User Repository which has patched to provide SyncTeX support more directly. I've never tried compiling it on Ubuntu, though theoretically it should be possible. I have used it on Arch though, and it works fine.

I personally, however, use MuPDF as my viewer for LaTeX composition, which I choose because it's the fastest PDF viewer I know, and the only one fast enough for the live-updating-preview script I use with Vim as my editor.

While MuPDF doesn't support SyncTeX directly, I hacked together some xdotool scripts that provide partial SyncTeX support. Basically, for forward search, the scripts call synctex from vim to figure out what page matches the spot in the source, and then sends the appropriate keystrokes to MuPDF to jump to that page. I do this with a vim script, but with bash, something like this might do the trick:

#!/bin/bash
# mupdf-forward.sh
# usage mupdf-forward.sh <line number> <column number> <tex file> <pdf file>
SEARCHLINE="$1"
SEARCHCOL="$2"
TEXFILE="$3"
PDFFILE="$4"
PAGEFORWARD=0
PAGEFORWARD="$(synctex view -i $SEARCHLINE:$SEARCHCOL:"'"'"$TEXFILE"'"'" -o "'"'"$PDFFILE"'"'" | grep -m1 'Page:' | sed 's/Page://' | tr -d '\n'")"
if [ $PAGEFORWARD -gt 0 ] ; then
   xdotool search --class MuPDF type --window %@ "${PAGEFORWARD}g"
fi

If you have the newest version of xdotool (newer even than the one in the Maverick repos), you can kludge up a similar kind of reverse search by having xdotool read the page number that MuPDF is showing from its title bar, call synctex, and then send the appropriate command to the editor to jump to where the code for that page is (--not nearly as precise as you'd get with a real SyncTeX-compliant PDF viewer, but not too shabby for something as lightweight as MuPDF).

Anyway, you can read about and download the scripts I actually use for vim in this blog post. But if you want to use a different editor, you'll have to adapt the idea as necessary.

But hopefully the situation with evince will straighten itself out sometime soon too.

share|improve this answer
    
Here is a PPA for MuPDF I found. –  JJD May 12 '12 at 17:43
    
+1 for Gummi. Just installed it and its great! It also supports SyncTex now. –  JJD May 12 '12 at 18:00
add comment

Simply use Evince, the default document viewer for GNOME and Ubuntu. Since GNOME 2.32 (found in Ubuntu 10.10 and the upcoming Ubuntu 11.04), Evince supports SyncTex. For more, see http://library.gnome.org/misc/release-notes/2.32/

share|improve this answer
    
I have these versions (Ubuntu 11.04 and Gnome 2.32), but I didn't find how to config Evince to perform forward or backward search. What am I missing? –  Little Bobby Tables Jan 26 '11 at 9:52
    
Ctrl+F brings the search.... and you can select the direction.... or am I missing something? –  luri Jan 26 '11 at 9:53
4  
"forward search", in the context of LaTeX syncing, means that you can jump from the editor to the correct page in the PDF viewer. "Inverse search" means jumping from the PDF viewer to the source code of a selected paragraph. –  Little Bobby Tables Jan 26 '11 at 9:58
    
I'm sorry for my ignorance (actually, it's a language misunderstanding). Thanks for putting that clear for me. –  luri Jan 26 '11 at 11:33
    
What LaTeX or text editor are you using or do you want to use? –  frabjous Jan 26 '11 at 20:04
show 1 more 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.