Function: TeX-synctex-output-page

TeX-synctex-output-page is a byte-compiled function defined in tex.el.

Signature

(TeX-synctex-output-page)

Documentation

Return the page corresponding to the position in the current buffer.

This method assumes that the document was compiled with SyncTeX enabled and the synctex binary is available.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-synctex-output-page ()
  "Return the page corresponding to the position in the current buffer.
This method assumes that the document was compiled with SyncTeX
enabled and the `synctex' binary is available."
  (let* ((file (file-relative-name (TeX-buffer-file-name)
                                   (file-name-directory
                                    (TeX-active-master))))
         (abs-file (concat (expand-file-name (or (file-name-directory (TeX-active-master))
                                                 (file-name-directory (TeX-buffer-file-name))))
                           "./" file)))
    ;; It's known that depending on synctex version one of
    ;; /absolute/path/./foo/bar.tex, foo/bar.tex, or ./foo/bar.tex (relative to
    ;; TeX-master, and the "." in the absolute path is important) are needed.
    ;; So try all variants before falling back to page 1.
    (or (TeX-synctex-output-page-1 abs-file)
        (TeX-synctex-output-page-1 file)
        (TeX-synctex-output-page-1 (concat "./" file))
        "1")))