You are not logged in.
Hi Archers! I am looking for a lightweight and fast PDF Viewer for Linux that has SyncTex support. I would also like to use this thread to discuss the properties and capabilities a PDF Viewer should have for LaTeX-users who do *not* use an IDE. This is of course radically subjective.
My time and my knowledge are not sufficient to write a PDF Viewer on my own from scratch but some dreaming must be allowed so let me explain:
1) SyncTex support means the viewer allows to synchronize the presented position in the document with the position currently edited in an
external editor. This means all of the following:
a) forward search: you edit a certain position in one of the .tex-source files of the document. Now you can issue a certain keycode in the
editor that "updates" the viewer to show the corresponding position in the document.
Either the Viewer is already running, and the document is loaded, then the view is refreshed. If the Viewer is running but the document is
not, then it loads the document and shows the correct position. If the Viewer is not running, start it and show the document on the right
position.
b) inverse search: you view the document in the viewer and issue some command (usually a CTRL-click) to a certain position. The editor
opens the corresponding .tex-source on the corresponding position. (If running, reload it, if not running start up, you know, like the
viewer in 1a).
Forward and also inverse search is perfectly usual for PDF Viewers on Mac OS like Skim, PDFView, TeXniscope and the viewers of TeXShop
and iTeXMac. I did not succeed so far in finding any viewer for Linux that supports SyncTex. A very comfortable forward/inverse search can be
done on Linux with xdvi and a good editor like Vim or Emacs but xdvi is not a PDF Viewer. (Since I use Vim/gVim for editing I am interested in
a seamless integration of the Viewer and Vim.)
Both searches can be implemented using the capabilities of SyncTex which is part of texlive 2008. SyncTex brings in a little command line tool
that yields for a given source position the corresponding document position and for a given document position a corresponding source file +
line position. An example parser and more information is available at:
http://itexmac.sourceforge.net/SyncTeX.html
2) "lightweight" (for me) means all of the following:
a) No heavy dependencies and therefore no predefinition to a certain desktop like GNOME or KDE.
Of course you have to choose a GUI framework component like Gtk, Qt, wxWidgets, Motif etc.
which implies dependencies but that's inevitable and hence ok.
b) Low memory footprint.
3) "fast" means - surprise! - fast
a) in starting up
b) in loading the document
c) in loading the new page of an already loaded document
d) well, in everything else
4) There are some other features on my list:
a) fullscreen/presentation mode
b) magnifier + ruler + textselection mode (like in xdvi)
c) configurable toolbar
d) on/off-switchable configurable sidebar which shows the hyperlinked TOC as a tree (if contained in PDF) or page thumbnails
e) printing capability
f) searching capability
g) configurable keycodes / mousebuttons
h) zooming
i) PostScript export
j) dvi import (like it is done by the Preview in Mac OS)
So far for my dreams. :-) I need a fast, little and configurable tool that can be controlled from the editor which usually means: by command line parameters.
I think, xdvi is the perfect blueprint concerning functionality, lightweightness and speed:
http://xdvi.sourceforge.net/customization.html
A PDF Viewer should of course also implement PDF specific capabilities like 4d.
The viewer I know that comes closest to this catalogue of capabilities is xpdf but it lacks SyncTex support and also does not have 4b and 4c. Since xpdf has a remote reload capability and understands document positions as command line parameters you can implement a forward search "by hand". Inverse search is AFAIK not possible since xpdf does not export sufficient data about the current document position. (The manpage is very informative about all.)
I think, also the current state of epdfview is a good starting point:
http://trac.emma-soft.com/epdfview/
Also Evince is a considerable viewer I think but its focus is a little bit different from what I need. (But it would also be nice to combine a viewer for PDF and DVI with all the capabilities I described.) I personally do not know Okular since I do not use KDE. (Regardless of this it would be nice to have a viewer that does not pull in KDE dependencies.)
So what about you? Do you need a PDF viewer with such a profile? Do you know some viewer with that properties? Do you know a project that has similar or exactly those goals? Do you think I'm totally into the wrong direction?
You might very well think that, I couldn't possibly comment.
Offline
Well I'd love to see such a thing too. Right now I stick with xpdf, but one can dream...
btw, evince pulls a lot of gnome dependencies, so for me it's far off the ideal pdf viewer.
There's another project that I like so far, namely mupdf. But it's in the very early stages, so for instance keybindings suck and it's not configurable at all, nevermind synctex.
Offline
Eventhough FoxitReader is properietary software it is fast and has many of the features you want. Try it out: http://aur.archlinux.org/packages.php?ID=23344
Offline
Many thanks, Ashren, for the hint. I was not aware of Foxit. Anyway, it does not seem to have SyncTeX support. The corresponding feature request on the related foxit forum is three days old. ;-)
Well, I didn't say explicitly that I search for free software/open-source software but simply implied it. To be honest: if there *were* a proprietary software that would perfectly meet my needs I perhaps would give it a trial but its not a fully considerable alternative for me in the long run. There should be some *free* xdvi-like PDF viewer that can function as a part of a bigger LaTeX development tool selection.
Perhaps this point needs explanation: SyncTeX support is a must-have for me since I need the viewer primarily for LaTeXing and at the moment I use LaTeX *heavily*. I write my LaTeX documents primarily under Arch. Currently I use dvi as my standard development document format because xdvi is simply what I need. If there were some tool with the capabilities of xdvi that could view PDF, I would use PDF as the standard format under Linux. The reason: when I release the document, it will be a PDF and not a DVI. So there is a distinct step in development implied: to check if the pdf is typeset identically as the dvi was and looks the same. This is not automatically guaranteed.
The lack of a PDF viewer with the indicated properties makes it quite hard to "develop" documents with LaTeX with PDF as standard output since you will never be really "fast" without forward and inverse search. Hence you either have to a) stick with dvi (my choice so far) b) switch to some IDE (which usually implies using the mouse for inserting LaTeX templates which feels strange for me and makes my editing slow) or c) choose Mac OS. (Well, somebody HAS to state this inconvenient truth finally! ;-)
I am crying for a lightweight, fast, standalone PDF viewer with reasonable rendering quality that can be controlled from the editor of my choice! No more, no less. Most developers of PDF viewers seem to consider a viewer as some kind of tool to simply "read" documents but I need a tool to "work" with the documents I develop, not just read or present them which of course is also a main task for a viewer.
I think it is not permanently acceptable that Mac OS users have a *choice* of such PDF tools while Linux users do not seem to have *any* such tool at hand. (You may well proove me wrong.)
Last edited by Tristero (2009-04-29 12:11:59)
You might very well think that, I couldn't possibly comment.
Offline
I guest the problem is that TeX-nicians don't know how to / don't have time to write software, and opensource programmers don't tex too much
Offline
Of course it is not my intention to put the blame on somebody or to fall back to simply uttering frustration! Usually the fact that a certain tool does not exist indicates that its absence does not cause enough pain in the community to motivate that somebody who has the time and the knowledge starts to work on it.
In this particular case, there is pain on my side. But I do not have enough time and I am not sure if my knowledge would be sufficient to solve this task alone without consuming infinite time. Hence the pain is not "enough". ;-) But I would be absolutely motivated to contribute to such a project! Perhaps there are other people who would like to see "their" tool implemented.
Last edited by Tristero (2009-04-29 12:40:38)
You might very well think that, I couldn't possibly comment.
Offline
http://code.google.com/p/lundgaard/
http://bugzilla.gnome.org/show_bug.cgi?id=543503
There are Synctex patches for Evince (the gnome pdf viewer). I don't know if it accomplish all of your requested features.
It should be easy to modify the evince PKGBUILD.
Last edited by Perry3D (2009-04-29 12:46:25)
Offline
Thank you so much, Perry3D! I will see if I can adjust this evince synctex patch to work with vim... this will take a moment...
You might very well think that, I couldn't possibly comment.
Offline
I would be glad about some feedback. I will write my degree dissertation this year and i am also using vim.
Offline
A first feedback. I tried to use brute force to make evince come closer to the kind of program I wish to have. I won't succeed but some customizations are possible and I describe how far I got.
First, the GNOME dependencies of evince can be reduced. Evince runtime dependencies can be reduced to gtk2 and the rendering libraries for the file formats you wish to use. This can be done by just using the configure script. Consider:
http://aur.archlinux.org/packages.php?ID=24416
Using "configure --help" gives more to know about what unneeded features can be customized away. (This also requires changes in the configure script itself when the compiler call with the dependencies is parametized. One can learn from the rem_unused_makedeps.patch.)
This does not make evince lightweight in the sense I described but it is a considerable first step in the right direction.
Second: the synctex patch. It is intended to integrate geany and evince to work together while LaTeX syncing.
From the link above I deduced a patch from evince-2.25.92 to evince-2.25.92-synctex. I changed the editor call to gvim and recompiled the gtk-version of evince based on the PKGBUILD linked above with the customized patch applied.
The patch does two things as far as I understand:
1) Inverse search: it makes evince catch a doubleclick on the document and connects the doubleclick event to an hardcoded editor call parametized with lineno, colno and sourcefilename. This means, you doubleclick on some position in the document and the editor of your choice opens with the sourcefile that contains the corresponding .tex-source. On first sight, this seems to work with reasonable precision. I played a little bit around but did not test in in depth so far.
2) Make evince capable of loading a document with some position highlighted. This is necessary for forward search. A call like:
evince -p 7 -a -h 310:165:6:10 mytheorems.pdf
will now load the document mytheorems.pdf, view page 7 and highlight a rectangle of width 6 and height 10 with (310,165) being its left upper corner. "evince --help" gives more information.
What is now left to do is completing the forward search capability:
a) One has to understand what the output of synctex gives to you. A call like
synctex view -i 85:46:include/some_included_tex_file.tex -o mytheorems.pdf
provides you with a matchlist for what position in mytheorems.pdf may represent the character on line 85, column 46 in the file some_included_tex.file. The coordinates synctex outputs have to be made to some coordinates like 310:165:6:10 in the above evince example call. I did not really understand the information synctex gives me, but I think this is surely a quite easy computation and could be done by perl/python/vimscript-component.
Question 1: I do not know HOW this is really to be done.
Question 2: Which of the matches in the synctex output I should choose for highlighting?
b) The editor (for example vim/gvim) has to connect some keycode with an evince call that contains the proper document filename and "x:y:w:h" value. (The page number can be taken from synctex output.)
In the case of vim this customization can be done in ~/.vim/ftplugin/tex.vim
b) will be quite easy when a) is done. Perhaps someone can help?
By the way: big sorry for all the details and my novel-like verbous style. I use this thread as a brainstorming.
Last edited by Tristero (2009-04-29 16:16:16)
You might very well think that, I couldn't possibly comment.
Offline
No, this is great! May you can figure out (or Skottish, if you're reading, since I think you maintain it) how to permenantly add this patch to the PKGBUILD for the evince-gtk package in the AUR (once you get it working -- perhaps with an interactive method before compilation of choosing the editor (or using an environment variable, as I think someone tried with the 'improved' patch listed in one of the links you posted)). Or maybe it should be a separate AUR package?
Good luck!
Scott
Offline
Definitely good news! However the synctex patch still evolves, for instance the editor is hardcoded in the patch (which makes in not really suitable for distribution)...
Offline
The developers of evince seem to have adopted the patch so we will see if they give them a try. I, personally, would really, definitely, positively appreciate this feature!
Although the patched-in highlighting feature is a good starting point, I think big parts of the functionality for forward search are still missing if I understand things right:
For forward search, there should be (1) a capability to address some running evince instance and pass to it the 3-tuple <lineno, colno, sourcefilename> and (2) the viewer *itself* should know how to use it for the "synctex view ..." call and (3) also understand what synctex yields as result! The user should not even think of synctex-related stuff when TeX'ing, only in cases where finetuning is necessary!
I missed to mention another capability the PDF viewer of my dreams should have! ;-)
5) continuous preview + remote reload.
Continuous preview means that the viewer detects a change of the document file it is viewing currently (think of libfam or gamin which can indicate file changes in the service of other programs). Of course the viewer should cope with that situation and immediatley reload the document, viewing the same position as before (if this is possible in the actual case). xdvi can do this with the "-watchfile", also gv has a "-watch". Continuous preview implies that you always see an updated document.
Remote reload is for the case where continuous preview is switched off (which of course, the viewer of my dreams can do). A good blueprint is xpdf, which can be started as a server named 'foo' using the "-remote foo" switch. Later on, I can issue "xpdf -remote foo -reload" and the running instance does the reload. Issuing 'xpdf -remote foo -cmd "gotoPage(7)"' then goto page 7. This mechanism can be used for a rudimentary forward search that selects the right page.
The "dumb mode" then has no continuous preview and no server capability: you still have to press some keys *in* the viewer and the file will be reloaded. The viewer should support these three variants of reloading.
You might very well think that, I couldn't possibly comment.
Offline
When I've used evince with latex, right after I recompile the .tex file evince will update the pdf display automatically. I don't have to manually reload the file/window. Is that what you mean?
Scott
Offline
This is what I meant. But "in my dreams" I would like it to be configurable in those 3 levels I described: (1) reload-fully-automatical (2) reload-manually-remote (3) reload-manually-directly. (Okay, let's be fair, each viewer has (3) trivially and (2) is not THAT important when you have (1).)
You might very well think that, I couldn't possibly comment.
Offline
I adopted the "improved patch" for stable version 2.26.1 of evince. I do not have the time to enhance it for using the SYNCTEX_EDITOR environment variable to customize the editor call, therefore gvim is hardcoded. It should be very easy to change line 134 in the patch according to the editor of choice. I also made a PKGBUILD based on the evince-gtk PKGBUILD.
PKGBUILD:
pkgname=evince-gtk-synctex
pkgver=2.26.1
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.5' 't1lib' 'libdjvu>=3.5.10' 'desktop-file-utils' 'libspectre>=0.2.2' 'hicolor-icon-theme' 'gtk2' 'gvim')
makedepends=('pkgconfig' 'texlive-bin' 'intltool' 'gnome-doc-utils>=0.16.0')
optdepends=('texlive-bin: DVI support')
replaces=('gpdf')
provides=('evince')
conflicts=('evince')
groups=('gnome-extra')
install=evince.install
options=('!libtool' '!emptydirs')
source=("http://ftp.gnome.org/pub/gnome/sources/evince/2.26/evince-${pkgver}.tar.bz2"
"evince-${pkgver}-synctex.patch"
"evince-${pkgver}-remove_unused_deps.patch"
"evince.install")
md5sums=('5508b1f1fc0b4b66de59b7af1e560d8b'
'f5fc5f1004a97de33332d4efe984ba0d'
'ed7a687d7ca853aab6488ef84be67d1c'
'6ae2cbd71f501968377736f15b178c97')
build() {
cd "${srcdir}/evince-${pkgver}"
patch -p1 -i ../evince-${pkgver}-synctex.patch || return 1
patch -p1 -i ../evince-${pkgver}-remove_unused_deps.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-2.26.1-synctex.patch [= inverse search with Synctex, editor is gvim]:
diff -Naur evince-2.26.1-original/libview/ev-view.c evince-2.26.1/libview/ev-view.c
--- evince-2.26.1-original/libview/ev-view.c 2009-04-15 22:11:01.000000000 +0200
+++ evince-2.26.1/libview/ev-view.c 2009-04-30 02:38:48.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.1-original/libview/ev-view.h evince-2.26.1/libview/ev-view.h
--- evince-2.26.1-original/libview/ev-view.h 2009-04-15 22:11:01.000000000 +0200
+++ evince-2.26.1/libview/ev-view.h 2009-04-30 00:25:00.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.1-original/libview/ev-view-private.h evince-2.26.1/libview/ev-view-private.h
--- evince-2.26.1-original/libview/ev-view-private.h 2009-04-15 22:11:01.000000000 +0200
+++ evince-2.26.1/libview/ev-view-private.h 2009-04-30 00:14:37.000000000 +0200
@@ -178,6 +178,8 @@
GtkWidget *goto_entry;
EvTransitionAnimation *animation;
+
+ gchar *uri;
};
struct _EvViewClass {
diff -Naur evince-2.26.1-original/shell/ev-application.c evince-2.26.1/shell/ev-application.c
--- evince-2.26.1-original/shell/ev-application.c 2009-04-15 22:11:02.000000000 +0200
+++ evince-2.26.1/shell/ev-application.c 2009-04-30 02:32:25.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.1-original/shell/ev-application.h evince-2.26.1/shell/ev-application.h
--- evince-2.26.1-original/shell/ev-application.h 2009-04-15 22:11:02.000000000 +0200
+++ evince-2.26.1/shell/ev-application.h 2009-04-30 00:38:59.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.1-original/shell/ev-print-operation.c evince-2.26.1/shell/ev-print-operation.c
--- evince-2.26.1-original/shell/ev-print-operation.c 2009-04-15 22:11:02.000000000 +0200
+++ evince-2.26.1/shell/ev-print-operation.c 2009-04-30 01:14:06.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.1-original/shell/ev-window.c evince-2.26.1/shell/ev-window.c
--- evince-2.26.1-original/shell/ev-window.c 2009-04-15 22:11:02.000000000 +0200
+++ evince-2.26.1/shell/ev-window.c 2009-04-30 00:50:12.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);
}
@@ -5556,6 +5580,7 @@
ev_link_action_get_dest (action),
0,
NULL,
+ NULL,
FALSE,
NULL,
GDK_CURRENT_TIME);
diff -Naur evince-2.26.1-original/shell/ev-window.h evince-2.26.1/shell/ev-window.h
--- evince-2.26.1-original/shell/ev-window.h 2009-04-15 22:11:02.000000000 +0200
+++ evince-2.26.1/shell/ev-window.h 2009-04-30 00:51:08.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.1-original/shell/main.c evince-2.26.1/shell/main.c
--- evince-2.26.1-original/shell/main.c 2009-04-15 22:11:02.000000000 +0200
+++ evince-2.26.1/shell/main.c 2009-04-30 01:17:44.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) {
evince-2.26.1-remove_unused_deps.patch [= remove superflous make dependencies]
--- evince-2.26.1/configure.orig 2009-04-30 00:09:05.000000000 +0200
+++ evince-2.26.1/configure 2009-04-30 00:10:07.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.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
}
This is undoubtedly an improvement but its far from being a solution, just a proof of concept that it's possible what I dream of. And the patch is not THAT long, so possibly it's not that much work to adopt SyncTex also for other viewers. So far, there is no forward search and syncing is not configurable. There is also no xdvi-like magnifier which is important to check the correct spacing in formulas.
Perhaps I should write a spec... Yes, I think this would *really* improve things... ;-) *kidding* I desparately cry for the PDF viewer of my dreams. I would patch Evince till its flavour is really xdvi'ish if this should turn out to be necessary.
Have I missed an important feature of the perfect viewer? Let's collect more characterization!
Last edited by Tristero (2009-05-02 17:49:33)
You might very well think that, I couldn't possibly comment.
Offline
If this thing doesn't introduce problems with Evince and add a bunch of overhead to the package, I'll consider adding it to the AUR package. I'm also a LaTeX user, so this may be helpful here. I'll take a look at it over the next couple of days.
Offline
I tried to implement a forward search but I did not really suceed so far.
I would really appreciate if somebody would give me some support in understanding and/or implementing a forward search patch for evince.
The above patch provided evince with the capability to highlight a rectangular area whose coords are given as parameters at startup. I used this as a starting point and tried to write an example that generates those coords correctly.
It would be nice if evince would only get the information the editor "knows" (texfile name, lineno, colno) for forward search and then compute the coords of the area to highlight on its own.
Here is what I already know:
Synctex provides a parser for the synctex format. This parser can be used to query the synctex file for information needed to implement inverse search and forward search. The parser is available here:
http://itexmac.sourceforge.net/SyncTeX.html
This parser consists of 5 files. It is very small and I think it could be integrated into evince such that it is no more required to call synctex in a separate subprocess but the viewer can query the file on its own.
The synctex_display_query() function yields some coords of nodes that have to be translated into PDF coords. I had a look at the forward search implementation of SumatraPDF which can be found here ():
http://sumatrapdf.googlecode.com/svn/tr … dfSync.cpp
So I tried to compute the coords of the top left corner of a box that highlights the correct line. Also width and height seem to work basically.
I do:
int x, y, W, H;
x = synctex_node_box_visible_h(node);
y = synctex_node_box_visible_v(node) - synctex_node_box_visible_height(node);
W = synctex_node_box_visible_width(node);
H = synctex_node_box_visible_height(node) + synctex_node_box_visible_depth(node);
Then I do
evince -p 21 -a -h x:y:W:H mytheorems.pdf
This works for highlighting the correct page and line in the document.
May somebody have a look and tell me if I'm right? Can I also highlight the correct single word? (This would be a nice fine tuning feature...)
Last edited by Tristero (2009-05-02 13:15:47)
You might very well think that, I couldn't possibly comment.
Offline
I wrote the original evince patch, and with it a patch to geany, so both backward and forward syncronization was posible. Back then I setup a homepage with a little info about it and guide on howto compile it. My (free)webhost went down a few months ago and i didn't had time to setup a new one. Now I finally got time to setup the homepage againt on a new host, find it at:
http://lundgaard.wep.dk
The guide uses the original patch, but it should be easy to use the improved patch from
http://bugzilla.gnome.org/show_bug.cgi?id=543503
There's also a script, that will compile your latex documents for you and open evince via synctex.
Hopy you enjoy.
Offline
I'm following progress here. I use latex heavily through vim and evince. I don't like using dvi because I prefer the way pdflatex handles graphics (maybe just because the way I usually do it doesn't work with regular latex but works fine with pdflatex).
I wasn't aware of synctex until I saw this thread and it sounds quite useful.
If only I could convince everyone I work with to use Latex. Most publications will now accept word or latex and everyone in my lab wants to use word. It makes me want to shoot myself trying to get things to look right in word, especially formula heavy papers.
Last edited by jowilkin (2009-05-26 10:48:25)
Offline
Also quite interested in this thread, as I've been hoping to get a more perfect TeX workflow going.
The SyncTeX support would come in quite handy with what I have so far, which is to use markdown initially, which I feed into pandoc, and then tweak settings to get looking right (I'm leaning towards ConTeXt for this). Live previewing would obviously be awesome.
So, in short, please keep posting new developments on this!
Offline
Also quite interested in this thread, as I've been hoping to get a more perfect TeX workflow going.
The SyncTeX support would come in quite handy with what I have so far, which is to use markdown initially, which I feed into pandoc, and then tweak settings to get looking right (I'm leaning towards ConTeXt for this). Live previewing would obviously be awesome.
So, in short, please keep posting new developments on this!
same markdown-> pandoc workflow here. I'm also following this thread...
Offline
You should have a look at Texworks. It includes its own PDF viewer (using Poppler) with SyncTex support.
Offline
You should have a look at Texworks. It includes its own PDF viewer (using Poppler) with SyncTex support.
Thanks for the link. Now if only I could detach that integrated pdf viewer.
I too am following this thread with great interest. AUCTeX in emacs has synctex support capabilities but I have not yet found a good pdf browser to match it.
The Texworks site speaks of TeXShop (OS X) as user friendly software. My brain must work strangely, because when I first learned LaTeX (I was an OS X user at the time) I checked out TeXShop and found it utterly bewildering, so I learned vim and emacs instead .
Offline
http://vim-latex.sourceforge.net/docume … ching.html
this is from the vim-latexsuite turorial, and it claims that "okular" from kde got this feature. I haven't tried it, but when i saw this thread i was positive i'd read about it somewhere lately. Well, now i found it....
Offline