Top |
The LatexilaSynctex class (a singleton) implements the support of SyncTeX between GNOME LaTeX and the Evince PDF viewer. It is used to switch between the source file(s) and the PDF, at the same position in the document. It is called the forward search: source file -> PDF. And backward search: PDF -> source file.
It works only with PDF files, it doesn't work with DVI or PS or other generated document formats.
D-Bus is used to communicate between GNOME LaTeX and Evince. The implementation uses the asynchronous gdbus generated functions.
For the position, only the line is used, not the column. The column is a bit buggy.
void latexila_synctex_connect_evince_window (LatexilaSynctex *synctex
,const gchar *pdf_uri
);
Connects asynchronously the evince window for pdf_uri
. GNOME LaTeX will then
listen the signals emitted by the evince window when the user wants to switch
from the PDF to the corresponding *.tex file.
void latexila_synctex_forward_search (LatexilaSynctex *synctex
,GtkTextBuffer *buffer
,GFile *buffer_location
,GFile *main_tex_file
,guint timestamp
);
Does a forward search, i.e. switch from the *.tex file to the PDF file at the
same position as the cursor position in buffer
.
A correct timestamp
of the event is important. If GDK_CURRENT_TIME
is used
instead, Evince is sometimes not shown directly, a notification appears
instead saying that the "Document Viewer [...] is ready". It's more
convenient if the Evince window is presented directly, which should work if
the correct timestamp
is provided.
synctex |
the LatexilaSynctex instance. |
|
buffer |
||
buffer_location |
the *.tex file of |
|
main_tex_file |
the main *.tex file of |
|
timestamp |
the timestamp of the event. |
“backward-search”
signalvoid user_function (LatexilaSynctex *synctex, char *tex_uri, int line, guint timestamp, gpointer user_data)
The ::backward-search signal is emitted to perform a backward search, i.e. switching from the PDF to the source *.tex file.
synctex |
the LatexilaSynctex instance. |
|
tex_uri |
the *.tex file URI. |
|
line |
the line to jump to. |
|
timestamp |
timestamp of the event. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last