12

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.

2
  • 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. Jan 26, 2011 at 10:23
  • Are there any updates on that? I am using TexStudio on Debian with Xfce and I do not want to install Ocular with all its dependencies. I am using Atril (which was based on Evince) as my default pdf viewer but it seems it does not support forward and inverse search. Jan 13, 2019 at 12:41

2 Answers 2

6

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.

2
  • Here is a PPA for MuPDF I found.
    – JJD
    May 12, 2012 at 17:43
  • +1 for Gummi. Just installed it and its great! It also supports SyncTex now.
    – JJD
    May 12, 2012 at 18:00
3

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/

6
  • 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? Jan 26, 2011 at 9:52
  • Ctrl+F brings the search.... and you can select the direction.... or am I missing something?
    – luri
    Jan 26, 2011 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. Jan 26, 2011 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, 2011 at 11:33
  • What LaTeX or text editor are you using or do you want to use?
    – frabjous
    Jan 26, 2011 at 20:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .