Как заставить latexmk работать с emacs и okular

Я только начал использовать emacs, поэтому не знаю, правильно ли я это делаю.C-c C-c тогда подсказка говорит Command [pdflatex]: поэтому я набираю latexmk, Это даже то, что он ожидает? Тогда я даю следующую ошибку:

Latexmk: Initialization file '/home/dustin/.latexmkrc' gave an error:
     Substitution pattern not terminated at (eval 10) line 1, <GEN0> chunk 1.

Latexmk: Stopping because of problem with rc file

Вот мой .latexmk файл:

$pdflatex = 'pdflatex -interaction=nonstopmode -file-line-error -synctex=1' -pdf %s;

а вот мой .emacs файл:

(add-to-list 'load-path "~/.emacs.d/plugins")
(setq py-install-directory "~/.emacs.d/plugins")
(require 'python-mode)

;; ========== Prevent Emacs from making backup files ==========                        

(setq make-backup-files nil)

;; ========== Enable Line Numbering ==========                                         

(line-number-mode 1)

;; ========== Set the fill column ==========                                           

(setq default-fill-column 80)

;; ===== Turn on Auto Fill mode automatically in all modes =====                       

;; Auto-fill-mode the the automatic wrapping of lines and insertion of                 
;; newlines when the cursor goes over the column limit.             

;; This should actually turn on auto-fill-mode by default in all major                 
;; modes. The other way to do this is to turn on the fill for specific modes           
;; via hooks.                                                                          

(setq auto-fill-mode 1)

;; ========= Set colours ==========                                                    

;; Set cursor and mouse-pointer colours                                                
(set-cursor-color "white")
(set-mouse-color "goldenrod")

;; Set region background colour                                                        
(set-face-background 'region "blue")

;; Set emacs background colour                                                         
(set-background-color "black")

(defun run-latexmk ()
  (interactive)
  (let ((TeX-save-query nil)
        (TeX-process-asynchronous nil)
        (master-file (TeX-master-file)))
    (TeX-save-document "")
    (TeX-run-TeX "latexmk"
         (TeX-command-expand "latexmk -pdflatex='pdflatex -file-line-error -synctex=1'\
                               -pdf %s" 'TeX-master-file)
                 master-file)
    (if (plist-get TeX-error-report-switches (intern master-file))
        (TeX-next-error t)
      (progn
    (demolish-tex-help)
    (minibuffer-message "latexmk: done.")))))

2 ответа

Решение

Я нашел то, что нужно было сделать. На этот пост, как позвонить latexmk, мне просто нужно было добавить

(add-hook 'LaTeX-mode-hook (lambda ()
  (push
    '("Latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
      :help "Run Latexmk on file")
    Tex-command-list)))

Теперь у меня просто есть возможность создать файл PDF после завершения. У кого-нибудь есть идеи по этому поводу?

Полученная ошибка связана с вашим файлом.latexmkrc. Вместо предоставления опции командной строки -pdf Вы можете использовать эквивалентный вариант конфигурации $pdf_mode = 1;, Кроме того, добавив исходный файл, %sВ конфигурационном файле, кажется, путают latexmk. Таким образом, попробуйте использовать:

$pdf_mode = 1;
$pdflatex = 'pdflatex -interaction=nonstopmode -file-line-error -synctex=1';

Если вы хотите связать latexmk с ключом в Emacs и заставить его показывать ошибки, если они есть, вас могут заинтересовать ответы на этот вопрос.

Другие вопросы по тегам