## LatexilaSynctex

LatexilaSynctex — SyncTeX support between GNOME LaTeX and Evince

## Functions

LatexilaSynctex * | latexila_synctex_get_instance ()
void | latexila_synctex_connect_evince_window ()
void | latexila_synctex_forward_search ()

## Signals

void | backward-search | Run Last

## Types and Values

| LatexilaSynctex

## Object Hierarchy

        GObject
        ╰── LatexilaSynctex

## Includes

    #include <latexila.h>

## Description

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.

## Functions

### latexila_synctex_get_instance ()

    LatexilaSynctex *
    latexila_synctex_get_instance (void);

#### Returns

the LatexilaSynctex singleton instance.

[transfer none]

### latexila_synctex_connect_evince_window ()

    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.

#### Parameters

synctex | the LatexilaSynctex instance. |
pdf_uri | the PDF URI. |

### latexila_synctex_forward_search ()

    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.

#### Parameters

synctex | the LatexilaSynctex instance. |
buffer | a GtkTextBuffer. |
buffer_location | the *.tex file of `buffer` . |
main_tex_file | the main *.tex file of `buffer` . |
timestamp | the timestamp of the event. |

## Types and Values

### LatexilaSynctex

    typedef struct _LatexilaSynctex LatexilaSynctex;

## Signal Details

### The `“backward-search”` signal

    void
    user_function (LatexilaSynctex *synctex,
                   gchar           *tex_uri,
                   gint             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.

#### Parameters

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