Algunos editores de TeX / LaTeX tienen soporte para incrustar el visor de PDF y soporte de búsqueda hacia adelante / hacia atrás.
Quiero configurar AUCTeX y pdf-tools para este resultado.
Encontré una discusión en la lista de correo.
https://lists.gnu.org/archive/html/auctex/2015-02/msg00013.html
Ofrece un método para implementar este archivo PDF de apertura con herramientas pdf en Emacs. Seguí eso, pero no funciona.
Aquí está mi configuración:
(require 'tex-site)
(require 'latex)
;;; AUCTeX config
(setq TeX-auto-save t
TeX-parse-self t)
(setq-default TeX-master nil)
;; automatic detection of master file
(defun guess-TeX-master (filename)
"Guess the master file for FILENAME from currently open .tex files."
(let ((candidate nil)
(filename (file-name-nondirectory filename)))
(save-excursion
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(let ((name (buffer-name))
(file buffer-file-name))
(if (and file (string-match "\\.tex$" file))
(progn
(goto-char (point-min))
(if (re-search-forward (concat "\\\\input{" filename "}") nil t)
(setq candidate file))
(if (re-search-forward (concat "\\\\include{" (file-name-sans-extension filename) "}") nil t)
(setq candidate file))))))))
(if candidate
(message "TeX master document: %s" (file-name-nondirectory candidate)))
candidate))
(add-hook 'LaTeX-mode-hook
'(lambda ()
(setq TeX-master (guess-TeX-master (buffer-file-name)))
))
;; enable RefTeX in AUCTeX (LaTeX-mode)
(setq reftex-plug-into-AUCTeX t)
(add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
;; view generated PDF with `pdf-tools'.
(unless (assoc "PDF Tools" TeX-view-program-list-builtin)
(add-to-list 'TeX-view-program-list-builtin
'("PDF Tools" TeX-pdf-tools-sync-view)))
(add-to-list 'TeX-view-program-selection
'(output-pdf "PDF Tools"))
;; LaTeX source code block syntax highlighting.
;; [ minted ]
;; toggle shell escape using [C-c C-t x].
(defun TeX-toggle-escape ()
"Toggle Shell Escape"
(interactive)
(setq-local LaTeX-command
(if (string= LaTeX-command "latex") "latex -shell-escape"
"latex"))
(message (concat "shell escape "
(if (string= LaTeX-command "latex -shell-escape")
"enabled"
"disabled"))
))
(add-hook 'LaTeX-mode-hook
'(lambda ()
(local-set-key (kbd "C-c C-t x") 'TeX-toggle-escape)))
TeX-PDF-mode
está activo por defecto desde AUCTeX 11.88.emacs -q
y cargo paquetes. pero tiene un problema con mis configuraciones. ¿Hay alguna manera de averiguar por qué?TeX-after-TeX-LaTeX-command-finished-hook
.TeX-after-compilation-finished-functions
ahora parece ser el gancho relevante (o eso dice la cadena de documentación).TeX-after-compilation-finished-hook
en el manual de AUCTeX . Creo que es ya sea sinTeX-after-TeX-LaTeX-command-finished-hook
oTeX-after-compilation-finished-functions
.