New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto-refresh of pdf buffer after LaTeX #187

Closed
DrWaleedAYousef opened this Issue Feb 12, 2016 · 7 comments

Comments

Projects
None yet
6 participants
@DrWaleedAYousef

DrWaleedAYousef commented Feb 12, 2016

I think we had solved this issue before; however, after I updated emacs yesterday this issue re-appeared. When both the tex and the pdf are opened in emacs, re-compiling the LaTeX buffer does not auto-refresh the pdf buffer. My .emacs (that was already working very well) is:

(require 'subr-x)
(defun th/pdf-view-revert-buffer-maybe (file)
(when-let ((buf (find-buffer-visiting file)))
(with-current-buffer buf
(when (derived-mode-p 'pdf-view-mode)
(pdf-view-revert-buffer nil t)))))
(add-hook 'TeX-after-TeX-LaTeX-command-finished-hook
#'th/pdf-view-revert-buffer-maybe)

@tmalsburg

This comment has been minimized.

tmalsburg commented Feb 17, 2016

Why not use auto-revert-mode in the buffer showing the PDF. I think I tried this once and it worked well.

@DrWaleedAYousef

This comment has been minimized.

DrWaleedAYousef commented Feb 18, 2016

It reverts but the pdf goes to another page than the current. You have
to C-c C-g on the tex file.

What I wonder for is that it was working well until I just updated emacs!!

Titus von der Malsburg notifications@github.com writes:

Why not use auto-revert mode in the buffer showing the PDF. I think I tried this once and it worked well.


Reply to this email directly or view it on GitHub.*

@adouzzy

This comment has been minimized.

adouzzy commented Feb 22, 2016

I use latexmk. Latexmk monitors tex file changes and recompile when its changed. After compile, it triggered the pdf_previewer linked to a custom latex function. The function could be (pdf-sync-forward-search)

In the .latexmk:
$pdf_previewer="emacsclient -e '(my-pdf-sync)'";
$pdflatex='pdflatex %O -interaction=nonstopmode %S';

;; The following add latexmk to C-c C-c in auctex for the file change monitoring
(add-to-list 'TeX-command-list '("latexmk" "latexmk -pdf -pvc %t" TeX-run-TeX))

@et2010

This comment has been minimized.

et2010 commented Apr 17, 2016

@adouzzy Thanks for the nice solution.

@DrWaleedAYousef

This comment has been minimized.

DrWaleedAYousef commented Apr 17, 2016

I emailed AUCTEX authors, and surprisingly it appeared to be a
bug. Thanks to them, they fixed the bug and now the recent version of
AUCTEX on Elpa is bug-free. You have just to include the following line
in your .emacs and it everything works great.

(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)

et2010 notifications@github.com writes:

@adouzzy Thanks for the nice solution.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub*

@et2010

This comment has been minimized.

et2010 commented Apr 18, 2016

@DrWaleedAYousef Thanks for the heads up.

@gyps

This comment has been minimized.

gyps commented Oct 22, 2016

@adouzzy In your post you mention a custom lisp function to revert and sync the pdf buffer. Would you mind to give an example of the function that works for you?

Thanks a lot,
Alex

@politza politza closed this Aug 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment