Synctex forward search example

  1. make a multipage tex document with INPUT_PATH

    INPUT_PATH="/path/to/tex/file/asdf.tex"
  2. compile with:

    pdflatex -synctex=1 "$INPUT_PATH"

    this should generate “asdf.pdf” and the synctex file ( because of -synctex=1)

  3. run synctex as

    synctex view -i 77:1:/path/to/tex/file/./asdf.tex -o asdf.pdf

    77:1 means you are on line 77 column 1 of the tex file, and you want to get the position on the pdf. Note the ugly “/./” between the parent directory and the basename. It must be there!

  4. sample output

    This is SyncTeX command line utility, version 1.2
    SyncTeX result begin
    Output:report.pdf
    Page:2
    x:261.757507
    y:492.330658
    h:255.095062
    v:495.319450
    W:100.061378
    H:13.902562
    before:
    offset:0
    middle:
    after:
    SyncTeX result end

    amongst other things, this is telling you that this position on the tex file corresponds to Page 2 of your pdf.

  5. Now all you have to do is to tell your pdf viewer to open that page. In Okular this would be:

    okular -p 2 asdf.pdf
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s