You are not logged in.

#26 2009-06-08 08:36:03

Tristero
Member
From: Germany
Registered: 2008-01-16
Posts: 33

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

Meanwhile I wrote an inverse-search-patch for epdfview that works quite good so far. I want to add forward search but for fs to make sense, the viewer must have the ability to pass commands like "reload" or "goto page x" to a single instance that is already running. (Because you do not want to open a new viewer instance everytime you do a fs in the editor.) The blueprint is xpdf's "-remote" option.

I chose epdfview because it's small and fast. I think it is closest to what I need but it lacks some of the features I described.  When the search patch is ready, I will submit it upstream and post it here!

Help is very welcome!  (For example I have no idea what is a simple, secure and performant method to pass commands to a running instance of a program (named pipes? lookup in /proc/stat? sockets? shared memory? ...). xpdf looks up the window name via some xlib functionality but I do not know how to do this in gtk...)


You might very well think that, I couldn't possibly comment.

Offline

#27 2009-06-14 10:42:12

Tristero
Member
From: Germany
Registered: 2008-01-16
Posts: 33

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

I updated the evince-gtk-synctex package to evince 2.26.2. Thanks thomaslundgaard for the evince-synctex patch and to skottish for the evince-gtk package. Enjoy!

I modified the patch to issue a call of "sh" instead of calling "bash" directly.

PKGBUILD

pkgname=evince-gtk-synctex
pkgver=2.26.2
pkgrel=1
pkgdesc="Simply a document viewer, GTK+ only version, inverse search with SyncTex, syncs to gvim"
url="http://www.gnome.org"
arch=('i686' 'x86_64')
license=('GPL')
depends=('gsfonts' 'poppler-glib>=0.10.7' 't1lib' 'libdjvu>=3.5.20' 'desktop-file-utils' 'libspectre>=0.2.2' 'hicolor-icon-theme' 'gtk2')
makedepends=('pkgconfig' 'texlive-bin' 'intltool' 'gnome-doc-utils')
optdepends=('texlive-bin: DVI support')
replaces=('gpdf')
provides=('evince')
conflicts=('evince')
install=evince-gtk-synctex.install
options=('!libtool' '!emptydirs')
source=("http://ftp.gnome.org/pub/gnome/sources/evince/2.26/evince-${pkgver}.tar.bz2"
        "evince-${pkgver}-gtk.patch"
        "evince-${pkgver}-synctex.patch")
md5sums=('ed8b9fb5c5d6feafd19f0114b736c9ef'
         '9fc10929997514cb83f38f689049f651'
         '7ec2197191c7f415c99334d814c5bf1d')

build() {
  cd "${srcdir}/evince-${pkgver}"

  patch -Np0 -i ../evince-${pkgver}-gtk.patch || return 1
  patch -Np0 -i ../evince-${pkgver}-synctex.patch || return 1

  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
          --enable-pdf --enable-dvi \
          --enable-djvu --enable-tiff \
          --enable-t1lib --enable-pixbuf \
          --enable-comics --enable-impress \
              --without-gconf --without-keyring \
              --disable-static --disable-schemas-install \
              --disable-scrollkeeper \
              || return 1
  make || return 1
  make DESTDIR="${pkgdir}" install || return 1
}

evince-gtk-synctex.install

pkgname=evince-gtk-synctex

post_install() {
  gtk-update-icon-cache -q -f -t usr/share/icons/hicolor
  update-desktop-database -q
}

post_upgrade() {
  post_install $1
}

post_remove() {
  update-desktop-database -q
  gtk-update-icon-cache -q -f -t usr/share/icons/hicolor
}

evince-2.26.2-gtk.patch (Functionally equivalent to skottish's rem_unused_makedeps.patch.)

diff -Naur ../evince-2.26.2-original/configure ./configure
--- ../evince-2.26.2-original/configure    2009-06-13 14:50:42.000000000 +0200
+++ ./configure    2009-06-13 14:53:29.000000000 +0200
@@ -842,7 +842,6 @@
 G_IR_SCANNER
 GOBJECT_INTROSPECTION_LIBS
 GOBJECT_INTROSPECTION_CFLAGS
-GCONFTOOL
 GCONF_SCHEMAS_INSTALL_FALSE
 GCONF_SCHEMAS_INSTALL_TRUE
 GCONF_SCHEMA_FILE_DIR
@@ -26114,11 +26113,11 @@
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
     { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= \$LIBXML_REQUIRED gtk+-2.0 >= \$GTK_REQUIRED gtk+-unix-print-2.0 >= \$GTK_REQUIRED gio-2.0 >= \$GLIB_REQUIRED gnome-icon-theme >= \$GNOME_ICON_THEME_REQUIRED gthread-2.0\"") >&5
-  ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gthread-2.0") 2>&5
+  ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED  gthread-2.0") 2>&5
   ac_status=$?
   $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-  pkg_cv_SHELL_CORE_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gthread-2.0" 2>/dev/null`
+  pkg_cv_SHELL_CORE_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED  gthread-2.0" 2>/dev/null`
 else
   pkg_failed=yes
 fi
@@ -26130,11 +26129,11 @@
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
     { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= \$LIBXML_REQUIRED gtk+-2.0 >= \$GTK_REQUIRED gtk+-unix-print-2.0 >= \$GTK_REQUIRED gio-2.0 >= \$GLIB_REQUIRED gnome-icon-theme >= \$GNOME_ICON_THEME_REQUIRED gthread-2.0\"") >&5
-  ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gthread-2.0") 2>&5
+  ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED  gthread-2.0") 2>&5
   ac_status=$?
   $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-  pkg_cv_SHELL_CORE_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gthread-2.0" 2>/dev/null`
+  pkg_cv_SHELL_CORE_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED  gthread-2.0" 2>/dev/null`
 else
   pkg_failed=yes
 fi
@@ -26152,14 +26151,14 @@
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-            SHELL_CORE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gthread-2.0" 2>&1`
+            SHELL_CORE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED  gthread-2.0" 2>&1`
         else
-            SHELL_CORE_PKG_ERRORS=`$PKG_CONFIG --print-errors "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gthread-2.0" 2>&1`
+            SHELL_CORE_PKG_ERRORS=`$PKG_CONFIG --print-errors "libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED  gthread-2.0" 2>&1`
         fi
     # Put the nasty error message in config.log where it belongs
     echo "$SHELL_CORE_PKG_ERRORS" >&5
 
-    { { $as_echo "$as_me:$LINENO: error: Package requirements (libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gthread-2.0) were not met:
+    { { $as_echo "$as_me:$LINENO: error: Package requirements (libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED  gthread-2.0) were not met:
 
 $SHELL_CORE_PKG_ERRORS
 
@@ -26170,7 +26169,7 @@
 and SHELL_CORE_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 " >&5
-$as_echo "$as_me: error: Package requirements (libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gthread-2.0) were not met:
+$as_echo "$as_me: error: Package requirements (libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED  gthread-2.0) were not met:
 
 $SHELL_CORE_PKG_ERRORS
 
@@ -27149,13 +27148,6 @@
 
 
 
-  if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then
-    GCONF_SCHEMA_CONFIG_SOURCE=`gconftool-2 --get-default-source`
-  else
-    GCONF_SCHEMA_CONFIG_SOURCE=$GCONF_SCHEMA_INSTALL_SOURCE
-  fi
-
-
 # Check whether --with-gconf-source was given.
 if test "${with_gconf_source+set}" = set; then
   withval=$with_gconf_source; GCONF_SCHEMA_CONFIG_SOURCE="$withval"
@@ -27200,54 +27192,6 @@
 fi
 
 
-
-# Extract the first word of "gconftool-2", so it can be a program name with args.
-set dummy gconftool-2; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GCONFTOOL+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  case $GCONFTOOL in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_GCONFTOOL="$GCONFTOOL" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_GCONFTOOL="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_GCONFTOOL" && ac_cv_path_GCONFTOOL="no"
-  ;;
-esac
-fi
-GCONFTOOL=$ac_cv_path_GCONFTOOL
-if test -n "$GCONFTOOL"; then
-  { $as_echo "$as_me:$LINENO: result: $GCONFTOOL" >&5
-$as_echo "$GCONFTOOL" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-if test "x$GCONFTOOL" = "xno"; then
-    { { $as_echo "$as_me:$LINENO: error: gconftool-2 executable not found in your path - should be installed with GConf" >&5
-$as_echo "$as_me: error: gconftool-2 executable not found in your path - should be installed with GConf" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
 # ***
 # GIR
 # ***

evince-2.26.2-synctex.patch

diff -Naur ../evince-2.26.2-original/libview/ev-view.c ./libview/ev-view.c
--- ../evince-2.26.2-original/libview/ev-view.c    2009-06-14 12:08:05.000000000 +0200
+++ ./libview/ev-view.c    2009-06-14 12:09:24.000000000 +0200
@@ -287,6 +287,10 @@
 static void       jump_to_find_page                          (EvView             *view, 
                                   EvViewFindDirection direction,
                                   gint                shift);
+static void       synctex_open_editor                        (EvView             *view,
+                                  gint page,
+                                  gint doc_point_x,
+                                  gint doc_point_y);
 
 /*** Selection ***/
 static void       compute_selections                         (EvView             *view,
@@ -1316,7 +1320,7 @@
                         view->current_page);
 }
 
-static void
+void
 ev_view_goto_dest (EvView *view, EvLinkDest *dest)
 {
     EvLinkDestType type;
@@ -2627,6 +2631,25 @@
     
     view->pressed_button = event->button;
     view->selection_info.in_drag = FALSE;
+ 
+    /* Doubleclick in document: open editor via synctex */
+    if( event->button==1 && event->type==GDK_2BUTTON_PRESS ){
+        /* First: get pagenumber and doc_point where doubleclick happened */
+        gint page=0;
+        gint offset_x=0, offset_y=0;
+        gint doc_point_x=0, doc_point_y=0;
+        
+        find_page_at_location(view, event->x+view->scroll_x, event->y+view->scroll_y,
+            &page, &offset_x, &offset_y);
+            
+        get_doc_point_from_offset(view, page, offset_x, offset_y,
+            &doc_point_x, &doc_point_y);
+
+        if ( page > -1 ){ /* Clicked inside a page: open editor and return */
+            synctex_open_editor(view, page, doc_point_x, doc_point_y);
+            return TRUE;
+        }
+    }
 
     if (view->scroll_info.autoscrolling)
         return TRUE;
@@ -4421,6 +4444,13 @@
     ev_pixbuf_cache_clear (view->pixbuf_cache);
     view_update_range_and_current_page (view);
 }
+ 
+void
+ev_view_set_uri (EvView *view, gchar *uri)
+{
+    view->uri = uri;
+    return;
+}
 
 /*** Zoom and sizing mode ***/
 
@@ -5151,6 +5181,76 @@
 {
     view->find_pages = NULL;
 }
+ 
+void
+ev_view_highlight_rect (EvView *view, EvRectangle *rect)
+{
+        gint i, page, n_pages;
+        gdouble width, height;
+        EvPoint point;
+
+        page = ev_page_cache_get_current_page (view->page_cache);
+        n_pages = ev_page_cache_get_n_pages (view->page_cache);
+
+        view->find_pages = (GList**)g_malloc( sizeof(gpointer) * n_pages );
+        for( i=0; i<n_pages; i++){
+            view->find_pages[i] = NULL;
+        }
+        view->find_pages[page] = g_list_append ( view->find_pages[page], rect );
+        view->highlight_find_results=TRUE;
+        
+        width = (gdouble)ev_view_get_width(view) / ev_view_get_zoom(view);
+        height = (gdouble)ev_view_get_height(view) / ev_view_get_zoom(view);
+        
+        point.x = (rect->x1+rect->x2)/2.0 - width/2.0;
+        if (point.x<0){
+            point.x=0;
+        }
+        point.y = (rect->y1+rect->y2)/2.0 - height/2.0;
+        if (point.y<0){
+            point.y=0;
+        }
+        view->pending_point = point;
+        view->pending_scroll = SCROLL_TO_PAGE_POSITION;
+        return;
+}
+
+#define MAX_SYNCTEX_ARG    2048
+
+static void 
+synctex_open_editor(EvView *view, gint page, gint doc_point_x, gint doc_point_y)
+{
+    GFile  *f = g_file_new_for_uri(view->uri);
+    GFile  *dir = g_file_get_parent(f);
+    gchar  *filename = g_file_get_path(f);
+    gchar  *dirname = g_file_get_path(dir);
+    gchar   synctex_arg[MAX_SYNCTEX_ARG];
+    gchar **argv;
+    gint    len;
+
+    g_object_unref(f);
+    g_object_unref(dir);
+
+    /* Build synctex argument with location information */
+    page += 1;  /* Page should be 1-based */
+    len = g_snprintf(synctex_arg, MAX_SYNCTEX_ARG, "%d:%d:%d:%s", page, doc_point_x, doc_point_y, filename);
+    g_free(filename);
+    if (len <= 0 || len > MAX_SYNCTEX_ARG) {
+        g_warning("synctex_open_editor: g_snprintf returned %d\n", len);
+        return;
+    }
+
+    /* Execute synctex command */
+    argv = g_new(gchar*, 7);
+    argv[0] = "synctex";
+    argv[1] = "edit";
+    argv[2] = "-o";
+    argv[3] = synctex_arg;
+    argv[4] = "-x";
+    argv[5] = "bash -c 'cd $(dirname %{output}); gvim --servername EVINCE --remote-silent +%{line} %{input}'";
+    argv[6] = NULL;
+    g_spawn_async(dirname, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
+}
 
 /*** Selections ***/
 
diff -Naur ../evince-2.26.2-original/libview/ev-view.h ./libview/ev-view.h
--- ../evince-2.26.2-original/libview/ev-view.h    2009-06-14 12:08:05.000000000 +0200
+++ ./libview/ev-view.h    2009-06-14 12:09:24.000000000 +0200
@@ -57,6 +57,8 @@
 void         ev_view_set_loading       (EvView       *view,
                            gboolean        loading);
 void            ev_view_reload            (EvView         *view);
+void            ev_view_set_uri           (EvView         *view,
+                                                           gchar *uri);
 
 /* Clipboard */
 void        ev_view_copy          (EvView         *view);
@@ -118,6 +120,8 @@
                            GList         **results,
                            gint            page);
 void            ev_view_find_cancel               (EvView         *view);
+void            ev_view_highlight_rect            (EvView *view,
+                           EvRectangle *rect);
 
 /* Cursor */
 void           ev_view_hide_cursor        (EvView         *view);
@@ -129,6 +133,8 @@
                        gboolean        horizontal);
 void           ev_view_handle_link        (EvView         *view,
                        EvLink         *link);
+void           ev_view_goto_dest          (EvView         *view,
+                                           EvLinkDest *dest);
 gboolean       ev_view_next_page      (EvView         *view);
 gboolean       ev_view_previous_page      (EvView         *view);
 gchar*         ev_view_page_label_from_dest (EvView *view, EvLinkDest *dest);
diff -Naur ../evince-2.26.2-original/libview/ev-view-private.h ./libview/ev-view-private.h
--- ../evince-2.26.2-original/libview/ev-view-private.h    2009-06-14 12:08:05.000000000 +0200
+++ ./libview/ev-view-private.h    2009-06-14 12:09:24.000000000 +0200
@@ -178,6 +178,8 @@
     GtkWidget *goto_entry;
 
     EvTransitionAnimation *animation;
+    
+    gchar *uri;
 };
 
 struct _EvViewClass {
diff -Naur ../evince-2.26.2-original/shell/ev-application.c ./shell/ev-application.c
--- ../evince-2.26.2-original/shell/ev-application.c    2009-06-14 12:08:05.000000000 +0200
+++ ./shell/ev-application.c    2009-06-14 12:09:24.000000000 +0200
@@ -358,16 +358,23 @@
 get_destination_from_args (GHashTable *args)
 {
     EvLinkDest *dest = NULL;
-    GValue     *value = NULL;
+    GValue     *page_value = NULL;
+    GValue     *absolute_value = NULL;
     
     g_assert (args != NULL);
     
-    value = g_hash_table_lookup (args, "page-label");
-    if (value) {
+    page_value = g_hash_table_lookup (args, "page-label");
+    absolute_value= g_hash_table_lookup (args, "use-absolute-page");
+    
+    if (page_value) {
         const gchar *page_label;
 
-        page_label = g_value_get_string (value);
-        dest = ev_link_dest_new_page_label (page_label);
+        page_label = g_value_get_string(page_value);
+        if ( g_value_get_boolean( absolute_value ) ){
+            dest = ev_link_dest_new_page( atol(page_label)-1 );
+        } else{
+            dest = ev_link_dest_new_page_label(page_label);
+        }
     }
 
     return dest;
@@ -384,6 +391,34 @@
     
     return value ? g_value_get_string (value) : NULL;
 }
+ 
+static EvRectangle *
+get_highlight_rect_from_args (GHashTable *args)
+{
+    GValue      *value = NULL;
+    EvRectangle *rect = NULL;
+    
+    g_assert (args != NULL);
+    rect = g_new(EvRectangle, 1);
+    
+    value = g_hash_table_lookup (args, "highlight-rect-x1");
+    if (!value) {    return NULL;    }
+    rect->x1 = g_value_get_double (value);
+
+    value = g_hash_table_lookup (args, "highlight-rect-x2");
+    if (!value) {    return NULL;    }
+    rect->x2 = g_value_get_double (value);
+
+    value = g_hash_table_lookup (args, "highlight-rect-y1");
+    if (!value) {    return NULL;    }
+    rect->y1 = g_value_get_double (value);
+
+    value = g_hash_table_lookup (args, "highlight-rect-y2");
+    if (!value) {    return NULL;    }
+    rect->y2 = g_value_get_double (value);
+
+    return rect;
+}
 
 /**
  * get_unlink_temp_file_from_args:
@@ -593,6 +628,7 @@
                  EvLinkDest     *dest,
                  EvWindowRunMode mode,
                  const gchar    *search_string,
+                 EvRectangle    *highlight_rect,
                  gboolean        unlink_temp_file,
                  const gchar    *print_settings, 
                  guint           timestamp)
@@ -619,7 +655,7 @@
     /* We need to load uri before showing the window, so
        we can restore window size without flickering */    
     ev_window_open_uri (new_window, uri, dest, mode, search_string, 
-                unlink_temp_file, print_settings);
+                highlight_rect, unlink_temp_file, print_settings);
 
     if (!GTK_WIDGET_REALIZED (GTK_WIDGET (new_window)))
         gtk_widget_realize (GTK_WIDGET (new_window));
@@ -660,12 +696,14 @@
     gboolean         unlink_temp_file = FALSE;
     const gchar     *print_settings = NULL;
     GdkScreen       *screen = NULL;
+    EvRectangle    *highlight_rect = NULL;
 
     if (args) {
         screen = get_screen_from_args (args);
         dest = get_destination_from_args (args);
         mode = get_window_run_mode_from_args (args);
         search_string = get_find_string_from_args (args);
+        highlight_rect = get_highlight_rect_from_args (args);
         unlink_temp_file = (mode == EV_WINDOW_MODE_PREVIEW &&
                     get_unlink_temp_file_from_args (args));
         print_settings = get_print_settings_from_args (args);
@@ -673,7 +711,7 @@
     
     ev_application_open_uri_at_dest (application, uri, screen,
                      dest, mode, search_string,
-                     unlink_temp_file,
+                     highlight_rect, unlink_temp_file,
                      print_settings, timestamp);
 
     if (dest)
@@ -693,7 +731,7 @@
     for (l = uri_list; l != NULL; l = l->next) {
         ev_application_open_uri_at_dest (application, (char *)l->data,
                          screen, NULL, 0, NULL,
-                         FALSE, NULL, timestamp);
+                         NULL, FALSE, NULL, timestamp);
     }
 }
 
diff -Naur ../evince-2.26.2-original/shell/ev-application.h ./shell/ev-application.h
--- ../evince-2.26.2-original/shell/ev-application.h    2009-06-14 12:08:05.000000000 +0200
+++ ./shell/ev-application.h    2009-06-14 12:09:24.000000000 +0200
@@ -69,6 +69,7 @@
                               EvLinkDest      *dest,
                               EvWindowRunMode  mode,
                               const gchar     *search_string,
+                              EvRectangle     *highlight_rect, 
                               gboolean         unlink_temp_file,
                               const gchar     *print_settings, 
                               guint32          timestamp);
diff -Naur ../evince-2.26.2-original/shell/ev-print-operation.c ./shell/ev-print-operation.c
--- ../evince-2.26.2-original/shell/ev-print-operation.c    2009-06-14 12:08:05.000000000 +0200
+++ ./shell/ev-print-operation.c    2009-06-14 12:09:24.000000000 +0200
@@ -774,6 +774,7 @@
                          NULL,
                          EV_WINDOW_MODE_PREVIEW,
                          NULL,
+                         NULL,
                          TRUE,
                          print_settings_file,
                          GDK_CURRENT_TIME);
diff -Naur ../evince-2.26.2-original/shell/ev-window.c ./shell/ev-window.c
--- ../evince-2.26.2-original/shell/ev-window.c    2009-06-14 12:08:05.000000000 +0200
+++ ./shell/ev-window.c    2009-06-14 12:09:24.000000000 +0200
@@ -200,6 +200,7 @@
     EvLinkDest       *dest;
     gchar            *search_string;
     EvWindowRunMode   window_mode;
+    EvRectangle      *highlight_rect;
 
     EvJob            *load_job;
     EvJob            *reload_job;
@@ -1374,6 +1375,7 @@
 
     g_assert (job_load->uri);
 
+    ev_view_set_uri(EV_VIEW (ev_window->priv->view), g_strdup (job_load->uri));
     ev_view_set_loading (EV_VIEW (ev_window->priv->view), FALSE);
 
     /* Success! */
@@ -1410,6 +1412,11 @@
             link = ev_link_new (NULL, link_action);
             ev_view_handle_link (EV_VIEW (ev_window->priv->view), link);
                 g_object_unref (link);
+            
+            if (ev_window->priv->highlight_rect) {
+                ev_view_highlight_rect ( EV_VIEW (ev_window->priv->view),
+                    ev_window->priv->highlight_rect );
+            }
 
             /* Already unrefed by ev_link_action
              * FIXME: link action should inc dest ref counting
@@ -1803,6 +1810,7 @@
             EvLinkDest     *dest,
             EvWindowRunMode mode,
             const gchar    *search_string, 
+            EvRectangle    *highlight_rect,
             gboolean        unlink_temp_file,
             const gchar    *print_settings)
 {
@@ -1813,6 +1821,19 @@
     if (ev_window->priv->uri &&
         g_ascii_strcasecmp (ev_window->priv->uri, uri) == 0) {
         ev_window_reload_document (ev_window);
+
+        if (dest){
+            if (ev_window->priv->dest){
+                g_object_unref (ev_window->priv->dest);
+            }
+            ev_window->priv->dest = dest ? g_object_ref (dest) : NULL;
+            ev_view_goto_dest(EV_VIEW (ev_window->priv->view), dest);
+
+            if (highlight_rect){
+                ev_window->priv->highlight_rect = highlight_rect;
+                ev_view_highlight_rect( EV_VIEW (ev_window->priv->view), highlight_rect );
+            }
+        }
         return;
     }
 
@@ -1848,6 +1869,8 @@
         g_object_unref (ev_window->priv->dest);
     ev_window->priv->dest = dest ? g_object_ref (dest) : NULL;
 
+    ev_window->priv->highlight_rect = highlight_rect;
+
     setup_size_from_metadata (ev_window);
 
     ev_window->priv->load_job = ev_job_load_new (uri);
@@ -2178,6 +2201,7 @@
                      dest,
                      0,
                      NULL, 
+                     NULL, 
                      TRUE,
                      NULL,
                      GDK_CURRENT_TIME);
@@ -2213,7 +2237,7 @@
     
     ev_application_open_uri_at_dest (EV_APP, uri,
                      gtk_window_get_screen (GTK_WINDOW (window)),
-                     NULL, 0, NULL, FALSE, NULL, 
+                     NULL, 0, NULL, NULL, FALSE, NULL, 
                      GDK_CURRENT_TIME);
 }
 
@@ -2224,7 +2248,7 @@
 {
     ev_application_open_uri_at_dest (EV_APP, uri,
                      gtk_window_get_screen (GTK_WINDOW (window)),
-                     NULL, 0, NULL, FALSE, NULL, 
+                     NULL, 0, NULL, NULL, FALSE, NULL, 
                      GDK_CURRENT_TIME);
 }
 
@@ -5563,6 +5587,7 @@
                      ev_link_action_get_dest (action),
                      0,
                      NULL, 
+                     NULL, 
                      FALSE,
                      NULL,
                      GDK_CURRENT_TIME);
diff -Naur ../evince-2.26.2-original/shell/ev-window.h ./shell/ev-window.h
--- ../evince-2.26.2-original/shell/ev-window.h    2009-06-14 12:08:05.000000000 +0200
+++ ./shell/ev-window.h    2009-06-14 12:09:24.000000000 +0200
@@ -78,6 +78,7 @@
                        EvLinkDest     *dest,
                        EvWindowRunMode mode,
                        const gchar    *search_string,
+                       EvRectangle    *highlight_rect,
                        gboolean        unlink_temp_file,
                        const gchar    *print_settings);
 gboolean    ev_window_is_empty      (const EvWindow *ev_window);
diff -Naur ../evince-2.26.2-original/shell/main.c ./shell/main.c
--- ../evince-2.26.2-original/shell/main.c    2009-06-14 12:08:05.000000000 +0200
+++ ./shell/main.c    2009-06-14 12:09:24.000000000 +0200
@@ -43,6 +43,8 @@
 #endif
 
 static gchar   *ev_page_label;
+static gboolean use_absolute_page = FALSE;
+static gchar   *ev_highlight_rect;
 static gchar   *ev_find_string;
 static gboolean preview_mode = FALSE;
 static gboolean fullscreen_mode = FALSE;
@@ -66,6 +68,8 @@
 static const GOptionEntry goption_options[] =
 {
     { "page-label", 'p', 0, G_OPTION_ARG_STRING, &ev_page_label, N_("The page of the document to display."), N_("PAGE")},
+    { "use-absolute-page", 'a', 0, G_OPTION_ARG_NONE, &use_absolute_page, N_("PAGE is absolute page number (first page is 1). Use with -p"), NULL},
+    { "highlight-rect", 'h', 0, G_OPTION_ARG_STRING, &ev_highlight_rect, N_("Highlight a rectangle in the document. Two possible formats: \"x:y\" ( x and y center of box) or \"x:y:w:h\" (x and y top-left corner of box, w and h width and height."), N_("COORDS")},
     { "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &fullscreen_mode, N_("Run evince in fullscreen mode"), NULL },
     { "presentation", 's', 0, G_OPTION_ARG_NONE, &presentation_mode, N_("Run evince in presentation mode"), NULL },
     { "preview", 'w', 0, G_OPTION_ARG_NONE, &preview_mode, N_("Run evince as a previewer"), NULL },
@@ -135,6 +139,7 @@
     g_hash_table_insert (args, g_strdup ("screen"), value);
 
     if (ev_page_label) {
+        /* ev_page_label */
         value = g_new0 (GValue, 1);
         g_value_init (value, G_TYPE_STRING);
         g_value_set_string (value, ev_page_label);
@@ -143,6 +148,64 @@
 
         g_free (ev_page_label);
         ev_page_label = NULL;
+
+        /* use_absolute_page */
+        value = g_new0 (GValue, 1);
+        g_value_init (value, G_TYPE_BOOLEAN);
+        g_value_set_boolean (value, use_absolute_page);
+
+        g_hash_table_insert (args, g_strdup ("use-absolute-page"), value);
+    }
+    
+    if (ev_highlight_rect) {
+        int i;
+        gdouble x1, x2, y1, y2;
+        gchar **strings;
+        
+        strings = g_strsplit( ev_highlight_rect, ":", 5);        
+        for (i=0; strings[i]!=NULL; i++);
+        
+        if ( i==2 ) {
+            x1 = atof(strings[0]) - 10;
+            x2 = atof(strings[0]) + 10;
+            y1 = atof(strings[1]) - 10;
+            y2 = atof(strings[1]) + 10;
+        } else if ( i==4 ) {
+            x1 = atof(strings[0]);
+            x2 = atof(strings[0]) + atof(strings[2]);
+            y1 = atof(strings[1]);
+            y2 = atof(strings[1]) + atof(strings[3]);
+        }
+
+        if ( (i==2||i==4) && (x2-x1)>0 && (y2-y1)>0 ){
+            value = g_new0 (GValue, 1);
+            g_value_init (value, G_TYPE_DOUBLE);
+            g_value_set_double (value, x1);
+            g_hash_table_insert (args, g_strdup ("highlight-rect-x1"), value);
+            
+            value = g_new0 (GValue, 1);
+            g_value_init (value, G_TYPE_DOUBLE);
+            g_value_set_double (value, x2);
+            g_hash_table_insert (args, g_strdup ("highlight-rect-x2"), value);
+            
+            value = g_new0 (GValue, 1);
+            g_value_init (value, G_TYPE_DOUBLE);
+            g_value_set_double (value, y1);
+            g_hash_table_insert (args, g_strdup ("highlight-rect-y1"), value);
+            
+            value = g_new0 (GValue, 1);
+            g_value_init (value, G_TYPE_DOUBLE);
+            g_value_set_double (value, y2);
+            g_hash_table_insert (args, g_strdup ("highlight-rect-y2"), value);
+        } else {
+            /* FIXME: Should GError or something else be used for error handling?
+             *           It would be best to quit after printing the error */
+            printf("Evince: Invalid argument for -h (or --highlight). Ignoring\n");
+        }
+
+        g_strfreev(strings);
+        g_free (ev_highlight_rect);
+        ev_highlight_rect = NULL;
     }
 
     if (ev_find_string) {

You might very well think that, I couldn't possibly comment.

Offline

#28 2009-06-14 11:28:26

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

Tristero,
Thanks for posting the Evince patch etc. However, I too would rather see a proper patch for ePDFView. The only viewer that I am aware of that fully support synctex (beside TeXWorks' viewer of course) is SumantraPdf for Windows. The developer of the synctex features website is here.

The above solution works great with Emacs-AUCTeX on Windows. I can double-click on source and it will take me to the corresponding line in the source. In Emacs I can hit F12 and will highlight the corresponding line in the pdf.

I do not have texlive on this system so I have not been able to try your path (or Thomas' patch for that matter). I applause your effort though; Linux is truly lacking a good LaTeX-centric pdf-viewer.

Thanks,
Rasmus


Arch x64 on Thinkpad X200s/W530

Offline

#29 2009-06-30 15:48:26

DarkVenger
Member
Registered: 2008-11-24
Posts: 35

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

Tristero,

I copied the files you posted but I was unable to build, I get this:

patching file ./configure
Hunk #4 FAILED at 26151.
patch unexpectedly ends in middle of line
Hunk #7 FAILED at 27192.
2 out of 7 hunks FAILED -- saving rejects to file ./configure.rej
==> ERROR: Build Failed.
    Aborting...

Is it possible the files you posted are not complete?

Ty

Offline

#30 2009-06-30 17:46:45

Tristero
Member
From: Germany
Registered: 2008-01-16
Posts: 33

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

DarkVenger, you are right. The PKGBUILD and the install file are okay, but the patch files have been messed up.

When I post the patches in code tags and try to copy the content of those code areas back from the preview into a text editor,  I end up with the patches messed up.

It seems code tags are no good method for releasing large patches. tongue Obviously I missed that and I apologize for the inconvenience! Is there a better way to release the files to the forum without launching a new PKGBUILD?


You might very well think that, I couldn't possibly comment.

Offline

#31 2009-06-30 18:09:20

SamC
Member
From: Calgary
Registered: 2008-05-13
Posts: 611
Website

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

Post them to a pastebin somewhere?

Offline

#32 2009-06-30 19:18:48

Tristero
Member
From: Germany
Registered: 2008-01-16
Posts: 33

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

evince-2.26.2-gtk.patch:
http://pastebin.ch/2018

evince-2.26.2-synctex.patch:
http://pastebin.ch/2020

sorry again

EDIT: Edited this to the correct URLs.

Last edited by Tristero (2009-06-30 22:03:26)


You might very well think that, I couldn't possibly comment.

Offline

#33 2009-06-30 21:44:00

DarkVenger
Member
Registered: 2008-11-24
Posts: 35

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

Still no luck.:rolleyes:

I'm going to send you and email through the link in the forum. That way I believe you will have my email address and be able so send me files big_smile

Offline

#34 2009-06-30 22:05:39

Tristero
Member
From: Germany
Registered: 2008-01-16
Posts: 33

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

I tested copying PKGBUILD and .install-file from the forum posts and the patches from the links above. For me it works.


You might very well think that, I couldn't possibly comment.

Offline

#35 2009-07-05 11:57:11

Mic92
Member
From: Germany
Registered: 2009-07-05
Posts: 21
Website

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

I use the software http://trac.emma-soft.com/epdfview/. It's the same code as Evince, but without the Gnome-depencies. It just need libpoppler, Gtk+ and Cups (optional). On my machine its verry fast and has a clean interface. The code was easy to read for me (i never code with Gtk). Maybe you port the patch to epdfview or I try it.

Last edited by Mic92 (2009-07-05 19:59:58)

Offline

#36 2009-07-06 00:43:58

haavard
Member
Registered: 2009-07-06
Posts: 5

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

emacs 23 (emacs-cvs in AUR) can view pdf, ps and dvi files using doc-view-mode.
I does not fulfill all the stuff on your wish list, and I see you are a vi user, but maybe someone else will like it.

Works great with auctex if you add
(server-start)
to your .emacs file and press in the emacs menu
LaTeX->Customize AUCTeX->(expand)->Tex command->Tex output view style
Somwhere there is a line
Extension: ^pdf$
Set the value below to
Command: emacsclient %o %(outpage)

Then C-c C-c in a tex buffer will bring up the pdf in a fraction of a second, to the same page you left it last time.

Or better yet,
just add
(add-hook 'doc-view-mode-hook 'auto-revert-mode)
to your .emacs file. The pdf will then automatically reload when it changes on disk, in other words each time you compile.
A split window with one frame of code and one frame showing the allways up to date pdf is nice.

Take 3:
Add to .emacs:
(server-start)
(add-hook 'doc-view-mode-hook 'auto-revert-mode)

Change the tex output view style to
Command: emacsclient -e "(find-file \"%o\")"
This just tells the running emacs server to evaluate (find-file "filename.pdf"), not opening a new client.

Pressing C-c C-c in a freshly compiled tex buffer now will raise the allready updated pdf buffer if it exists, or open a new buffer with the pdf file.
A doc-view-mode buffer can be moved to the background simply by pressing 'q'. The pdf buffer will be updated when the pdf is regenerated.

Håvard

Last edited by haavard (2009-07-07 16:05:38)

Offline

#37 2009-07-15 21:01:07

papounet
Member
Registered: 2009-06-14
Posts: 22

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

one feature I would really like to see in epdfView is a simple reload comand. evince had that.

So right now after I compiled my latex file I have to close and reopen the document in epdfView.

Am I missing something?

Had never heard of SyncTex but I'm now very interested especially since I will soon start on my Master Thesis and I also use vim.

Keep up the good work

Offline

#38 2009-07-16 08:59:07

wiley
Member
Registered: 2009-07-04
Posts: 3

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

papounet wrote:

one feature I would really like to see in epdfView is a simple reload comand. evince had that.

epdfView has such a command. Try ctrl-r.

Offline

#39 2009-07-16 21:28:17

papounet
Member
Registered: 2009-06-14
Posts: 22

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

thanks wiley, how could I possibly have missed that roll

Offline

#40 2009-09-15 19:40:48

fifafrazer
Member
Registered: 2008-02-18
Posts: 81

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

I have installed Tristeros pkgbuild and patches and it works great,
Why don't you put it on AUR Tristero?

Offline

#41 2009-09-15 20:25:21

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

I believe an AUR package is already available here.

Has anybody gotten the synctex-enabled evince working with Emacs and particularly AUCTeX?

Thanks,
Rasmus


Arch x64 on Thinkpad X200s/W530

Offline

#42 2009-09-18 09:16:04

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

haavard wrote:

emacs 23 (emacs-cvs in AUR) can view pdf, ps and dvi files using doc-view-mode.

Take 3:
Add to .emacs:
(server-start)
(add-hook 'doc-view-mode-hook 'auto-revert-mode)

Change the tex output view style to
Command: emacsclient -e "(find-file \"%o\")"
This just tells the running emacs server to evaluate (find-file "filename.pdf"), not opening a new client.

Pressing C-c C-c in a freshly compiled tex buffer now will raise the allready updated pdf buffer if it exists, or open a new buffer with the pdf file.
A doc-view-mode buffer can be moved to the background simply by pressing 'q'. The pdf buffer will be updated when the pdf is regenerated.

Håvard

This works very well here, using my packages emacs-otf and auctex-cvs. Thank you very much! smile

Offline

#43 2009-09-20 17:26:15

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

Have a look at gummi in AUR. It has an early version number and (yet) is not perfect, but surely a step in the synctex direction.

Offline

#44 2009-09-24 06:41:00

haavard
Member
Registered: 2009-07-06
Posts: 5

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

Pank wrote:

I believe an AUR package is already available here.

Has anybody gotten the synctex-enabled evince working with Emacs and particularly AUCTeX?

Thanks,
Rasmus

Yes, using Stefan's auctex-cvs package, with the following configs. Does not work with the package in community.

PKGBUILD(the default spawns new frame with a new buffer for each double click, this does not):

EDITOR="sh -c 'cd $(dirname %{output}); emacsclient -n +%{line} %{input}'"

.emacs. (My full auctex config. tex-correlate-mode is the relevant part. server-start is requiered if you use emacsclient in the PKGBUILD):

(server-start)
(setq-default ispell-program-name "aspell")

(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'tex-pdf-mode)
(add-hook 'LaTeX-mode-hook 'tex-source-correlate-mode)
(setq-default TeX-master nil) ; Query for master file

In .bashrc(to make emacs start if no server is running):

export ALTERNATE_EDITOR=emacs

Forward search does not work, but using compile region(C-c C-r on a marked region) and using emacs to view it like I showed above is a decent substitute.

Håvard

Last edited by haavard (2009-09-24 07:04:00)

Offline

#45 2009-09-24 08:08:39

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

Thanks for the comment on the evince-side. Håvard, are you aware of emacs --daemon for emacs>=23. It works beautifully and is much nicer than (server-start) imo.

>Forward search does not work, but using compile region(C-c C-r on a marked region) and using emacs >to view it like I showed above is a decent substitute.

Forward search should also work -- somehow; at least it is built into AUCTeX-cvs. I used it on Windows. However, I don't believe the capability has been tested on Linux since no synctex-enabled pdf-viewer was available when this feature was added.

Last edited by Pank (2009-09-24 08:08:57)


Arch x64 on Thinkpad X200s/W530

Offline

#46 2009-09-24 08:53:14

haavard
Member
Registered: 2009-07-06
Posts: 5

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

Pank wrote:

Thanks for the comment on the evince-side. Håvard, are you aware of emacs --daemon for emacs>=23. It works beautifully and is much nicer than (server-start) imo.

>Forward search does not work, but using compile region(C-c C-r on a marked region) and using emacs >to view it like I showed above is a decent substitute.

Forward search should also work -- somehow; at least it is built into AUCTeX-cvs. I used it on Windows. However, I don't believe the capability has been tested on Linux since no synctex-enabled pdf-viewer was available when this feature was added.

Hi,

I will check out the emacs --daemon stuff, thanks.

Forward search appear to work with tex-output-view-style set to:
evince %o -p %(outpage) -a
I imagined that would spawn a new evince process so I did not try it earlier. It seem to work quite beutifully, C-c C-v jumps to the correct page without spawning a new evince.

Håvard

Last edited by haavard (2009-09-24 09:00:40)

Offline

#47 2009-09-24 09:07:11

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

Håvard,
Funny, I was looking at the exact same variable this moment. You beat me to it, though smile
Do you know where I can find a list of recognized placeholders? I am only aware of %s.

Somehow we should be able to set the line-number as well. It should be supported by evince-synctex. See the kile-script.
Particularly:

# Call synctex
SYNCTEX_RESULT=$( synctex view -i "$LINE:$COLUMN:$FILE" -o "${MAINFILE}.pdf" -x "echo ::%{page}:%{h}:%{v}:%{width}:%{height}::" )

Also, C-c C-v doesn't work. It must be controlled by some other variable. . .

>I will check out the emacs --daemon
It works with both tty clients and gtk clients, which is great. Also, the deamon seems to start faster than a regular emacs and clients starts instantly!

--Rasmus


Arch x64 on Thinkpad X200s/W530

Offline

#48 2009-09-24 09:15:51

haavard
Member
Registered: 2009-07-06
Posts: 5

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

Pank wrote:

Håvard,
Funny, I was looking at the exact same variable this moment. You beat me to it, though smile
Do you know where I can find a list of recognized placeholders? I am only aware of %s.

Somehow we should be able to set the line-number as well. It should be supported by evince-synctex. See the kile-script.
Particularly:

# Call synctex
SYNCTEX_RESULT=$( synctex view -i "$LINE:$COLUMN:$FILE" -o "${MAINFILE}.pdf" -x "echo ::%{page}:%{h}:%{v}:%{width}:%{height}::" )

Also, C-c C-v doesn't work. It must be controlled by some other variable. . .

>I will check out the emacs --daemon
It works with both tty clients and gtk clients, which is great. Also, the deamon seems to start faster than a regular emacs and clients starts instantly!

--Rasmus

Did you include the -a? I forgot it in my first edit.

I have not found a good list, just found bits and pieces from google. It appears %n is the current line in the emacs buffer.

But does it help? Are there hidden opts to evince?


$evince --help
Usage:
  evince [OPTION...] [FILE...] GNOME Document Viewer

Help Options:
  -?, --help                      Show help options
  --help-all                      Show all help options
  --help-sm-client                Show session management options
  --help-gtk                      Show GTK+ Options

Application Options:
  -p, --page-label=PAGE           The page of the document to display.
  -a, --use-absolute-page         PAGE is absolute page number (first page is 1). Use with -p
  -h, --highlight-rect=COORDS     Highlight a rectangle in the document. Two possible formats: "x:y" ( x and y center of box) or "x:y:w:h" (x and y top-left corner of box, w and h width and height.
  -f, --fullscreen                Run evince in fullscreen mode
  -s, --presentation              Run evince in presentation mode
  -w, --preview                   Run evince as a previewer
  -l, --find=STRING               The word or phrase to find in the document
  --display=DISPLAY               X display to use

Offline

#49 2009-09-24 09:38:09

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

>Did you include the -a? I forgot it in my first edit.
No i did not smile

> But does it help? Are there hidden opts to evince?
I don't think the help messaged has been altered.
Unfortunately I am not able to 'read' the patch, so I am really not sure.

--Rasmus

Edit: More info; also here

Last edited by Pank (2009-09-24 09:49:51)


Arch x64 on Thinkpad X200s/W530

Offline

#50 2009-09-24 10:01:25

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: A little manifesto for the "perfect" PDF Viewer for LaTeX'ers

I feel quite stupid now smile
http://aur.archlinux.org/packages/evinc … x-emacs.sh

I guess this could be appended to the standard view command.

--Rasmus


Arch x64 on Thinkpad X200s/W530

Offline

Board footer

Powered by FluxBB