From 1727e157ec913467445daa137bad620b8f666c0b Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Wed, 12 Feb 2014 23:24:12 -0500 Subject: Add function to find PDF for TeX file --- lisp/init-tex.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lisp/init-tex.el') diff --git a/lisp/init-tex.el b/lisp/init-tex.el index db8cde0..7e58cf7 100644 --- a/lisp/init-tex.el +++ b/lisp/init-tex.el @@ -63,4 +63,17 @@ The point should be beyond \"\\section\"." (interactive) (km/latex-narrow-to-single-tag "section")) +(defun km/latex-find-pdf () + "Find the PDF file for the current LaTeX file." + (interactive) + (let ((pdf-file (concat (file-name-base (buffer-file-name)) + ".pdf"))) + (unless (file-exists-p pdf-file) + (error "%s does not exist" pdf-file)) + (start-process "tex-pdf" nil "xdg-open" pdf-file))) + +(add-hook 'LaTeX-mode-hook + '(lambda () + (local-set-key (kbd "C-c m p") 'km/latex-find-pdf))) + (provide 'init-tex) -- cgit v1.2.3