Coder Social home page Coder Social logo

auctex-latexmk's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

auctex-latexmk's Issues

Cannot get it to work with LuaLaTeX

Hello, I have a strange problem with LatexMk and LuaLaTex together with Emacs and AUCTex. I have the following .latexmk file:

# $pdflatex = 'pdflatex -interaction=nonstopmode -synctex=1 %O %S';
$lualatex='lualatex -interaction=nonstopmode -synctex=1 %O %S';
$pdf_mode = 4;
$pdf_previewer = 'open -a skim';
$clean_ext = 'bbl rel %R-blx.bib %R.synctex.gz';

And I've configured AUCTex to automatically use LatexMk when compiling new .tex documents, but I keep getting this error message:

ERROR: Fatal fontspec error: "cannot-use-pdftex"

--- TeX said ---
! 
! The fontspec package requires either XeTeX or LuaTeX.
! 
! You must change your typesetting engine to, e.g., "xelatex" or
! "lualatex"instead of plain "latex" or "pdflatex".
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  
                                                  
l.28 \msg_fatal:nn {fontspec} {cannot-use-pdftex}

But I only get this error in Emacs, when I run latexmk -pvc file.tex in my terminal everything goes swimmingly and I get no error messages. Any idea why? It's fairly annoying since it messes the preview of the PDF-document because it doesn't align to where I'm actually editing it, it just jumps around.

How to add shell-escape option

Hi,

In my latexmkrc file I added this line for shell escape

$pdf_mode = 1;
$pdflatex = '--shell-escape';

but autctex-latexmk seems to overwrite my settings, this is the output from auctex

Running LatexMk' on DE_Rechtschreibung' with ``latexmk -pdf -pdflatex=xelatex --synctex=1 -interaction=nonstopmode -file-line-error DE_Rechtschreibung.tex''

How can I set shell escape correctly?

Regards
Thorsten

Add hook to run functions after latexmk is finished

It would be convenient to add a hook that calls user functions when the latexmk process has successfully finished. This would enable a scenario where one could refresh the buffer where a PDF is being displayed only after latexmk is finished and not every time a PDF is created throughout the execution of latexmk.

LatexMk: problems after [0] pages

I am using MikTeX on Windows, and the latexmk program from MikTeX. When I first run C-c C-c (with Latexmk) I receive the message:

LatexMk: problems after [0] pages

Then, I must run C-c C-c again to get:

LatexMk: nothing to do

On the third try, I am finally given the option to View by default. I think I should receive this option after the first invocation of C-c C-c. That is, I should only have to run LatexMk once.

Make latexmk the defautl for TeX-command-master

After installing auctex-latexmk, the user has the choice to use latexmk when activate TeX-command-master (C-c C-c). However, the default choice for compiling is still "LaTeX". If you create a new .tex document and do only C-c C-c RET, it will launch LaTeX. If you want latexmk, you have to use autocompletion to select it.

There is no really the need to compile with only latex when using latexmk. So installing auctex-latexmk should also make it the default for TeX-command-master. C-c C-c should call latexmk by default except if there is no need to compile, then it should launch the view command.

In the past, It was simple to modify TeX-command-default (setq TeX-command-default "LatexMk") but if seems to be more complicated nowadays. It is one more reason to include the feature request in auctex-latexmk package.

Support for XeTeX and LuaTeX

I think it would be nice if latexmk was called with the -xelatex parameter when TeX-engine is set to xetex, and with the -lualatexparameter when TeX-engine is luatex. This would make auctex-latexmk work out-of-the-box with XeLaTeX and LuaLaTeX documents.

adding support for latexmk -pvc (continuous preview)?

Hi, I am interested in adding support to auctex-latexmk for latexmk's -pvc (continuous preview) mode. I made a first attempt at modifying auctex-latexmk.el to do this. It seems to be working for me, but I am sure that I've not done it quite properly. I will paste the changed file here. Please feel free to contact me with questions about it. Most changed lines are marked with "neal".

;;; auctex-latexmk.el --- Add LatexMk support to AUCTeX

;; RETRIEVED June 2014 from https://github.com/tom-tan/auctex-latexmk

;; Copyright (C) 2013, 2014 by Tomoya Tanjo

;; Author: Tomoya Tanjo <[email protected]>
;; URL: https://github.com/tom-tan/auctex-latexmk/
;; Package-Requires: ((auctex "11.87"))
;; Keywords: tex

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; This library adds LatexMk support to AUCTeX.
;;
;; Requirements:
;;   * AUCTeX
;;   * LatexMk
;;   * TeXLive (2011 or later if you write TeX source in Japanese)
;;
;; To use this package, add the following line to your .emacs file:
;;     (require 'auctex-latexmk)
;;     (auctex-latexmk-setup)
;; And add the following line to your .latexmkrc file:
;;     # .latexmkrc starts
;;     $pdf_mode = 1;
;;     # .latexmkrc ends
;; After that, by using M-x TeX-command-master (or C-c C-c), you can use
;; LatexMk command to compile TeX source.
;;
;; For Japanese users:
;;
;; LatexMk command automatically stores the encoding of a source file
;; and passes it to latexmk via an environment variable named "LATEXENC".
;; Here is the example of .latexmkrc to use "LATEXENC":
;;     # .latexmkrc starts
;;     $kanji    = "-kanji=$ENV{\"LATEXENC\"}" if defined $ENV{"LATEXENC"};
;;     $latex    = "platex -interaction=nonstopmode $kanji";
;;     $bibtex   = 'pbibtex $kanji';
;;     $dvipdf   = 'perl -e "exec(\'dvipdfmx\', \$ARGV[0])"';
;;     $pdf_mode = 3;
;;     # .latexmkrc ends

;;; Code:

(require 'tex-buf)
(require 'latex)

(defgroup auctex-latexmk nil
  "Add LatexMk support to AUCTeX."
  :group 'AUCTeX
  :prefix "auctex-latexmk")

(defcustom auctex-latexmk-encoding-alist
  '((japanese-iso-8bit      . "euc")
    (japanese-iso-8bit-unix . "euc")
    (euc-jp                 . "euc")
    (euc-jp-unix            . "euc")
    (utf-8                  . "utf8")
    (utf-8-unix             . "utf8")
    (japanese-shift-jis     . "sjis")
    (japanese-shift-jis-dos . "sjis"))
  "Encoding mapping for platex."
  :group 'auctex-latexmk)

(setq neal-latexmk-flags " -pvc ") ;; neal
;; (setq neal-latexmk-flags "") ;; neal
(setq neal-cached-filter 'TeX-format-filter) ;; ??
(setq neal-waiting-string "=== Watching for updated files. Use ctrl/C to stop ...")

(defun neal-filter-wrapper (process string)
  "in ~/.emacs.d/auctex-latexmk.el"
  (apply neal-cached-filter process string ())

  (with-current-buffer (process-buffer process)
    (save-excursion
      (goto-char (- (point-max) (+ 1 (length neal-waiting-string))))
      (if (search-forward neal-waiting-string nil t)
          (progn
            (goto-char (- (point-max) (+ 1 (length neal-waiting-string))))
            (if (not (search-backward neal-waiting-string nil t))
                (goto-char (point-min)))
            (narrow-to-region (point) (point-max))
            (goto-char (point-max))
            (Latexmk-sentinel process "LatexMk")
            )))))

(defun TeX-run-latexmk (name command file)
  (let ((TeX-sentinel-default-function 'Latexmk-sentinel)
        (pair (assq buffer-file-coding-system auctex-latexmk-encoding-alist)))
    (unless (null pair)
      (setenv "LATEXENC" (cdr pair)))

    ;; (TeX-run-TeX name command file) ;; neal ->

    ;; (1) add pvc flag to latexmk command if set
    (let* ((command (concat command neal-latexmk-flags))
           (process (TeX-run-TeX name command file))
           (filter (process-filter process)))
      ;; (2) wrap neal-filter-wrapper around TeX buffer's filter 
      (setq neal-cached-filter filter)
      (set-process-filter process 'neal-filter-wrapper))

    (setenv "LATEXENC" nil)))

;;;###autoload
(defun auctex-latexmk-setup ()
  "Add LatexMk command to TeX-command-list."
  (setq-default TeX-command-list
                (cons
                 '("LatexMk" "latexmk %t" TeX-run-latexmk nil
                   (plain-tex-mode latex-mode doctex-mode) :help "Run LatexMk")
                 TeX-command-list)
                LaTeX-clean-intermediate-suffixes
                (append LaTeX-clean-intermediate-suffixes
                        '("\\.fdb_latexmk" "\\.aux.bak" "\\.fls"))))

(defun Latexmk-sentinel (process name)
  (save-excursion
    (let ((something-to-do nil)) ;; added -neal
      (goto-char (point-max))
      (cond
       ;; added "or" with first condition -neal
       ((or
         (search-backward neal-waiting-string nil t)
         (re-search-backward (format "^%s finished at" name) nil t))

        (if (re-search-backward "^Run number [0-9]+ of rule '\\(pdf\\|lua\\|xe\\)?latex'" nil t)
            (progn
              (setq something-to-do t) ;; added -neal
              (forward-line 5)
              (let ((beg (point)))
                (when (string= (current-word) "Latexmk")
                  ;; Special treatment for MiKTeX
                  (forward-line))
                (re-search-forward "^Latexmk:" nil t)
                (beginning-of-line)
                (save-restriction
                  (narrow-to-region beg (point))
                  (goto-char (point-min))
                  (TeX-LaTeX-sentinel process name)))))))
      ;; moved "nothing to do message" from above to below -neal
      ;; made this condition block independent of above -neal
      (cond
       ((re-search-backward (format "^%s exited abnormally with code" name) nil t)
        (re-search-backward "^Collected error summary (may duplicate other messages):" nil t)
        (re-search-forward "^  \\([^:]+\\):" nil t)
        (let ((com (TeX-match-buffer 1)))
          (cond
           ((string-match "^\\(pdf\\|lua\\|xe\\)?latex" com)
            (setq something-to-do t)  ;; -neal
            (goto-char (point-min))
            (TeX-LaTeX-sentinel process name)
            (when (string= TeX-command-next TeX-command-BibTeX)
              (setq TeX-command-default)))
           ((string-match "^bibtex " com)
            (setq something-to-do t)  ;; -neal
            (forward-line -1)
            (re-search-backward com nil t)
            (forward-line 5)
            (let ((beg (point)))
              (re-search-forward "^Rule" nil t)
              (beginning-of-line)
              (save-restriction
                (narrow-to-region beg (point))
                (TeX-BibTeX-sentinel process name))))))))
      ;; added: -neal
      (if (not something-to-do) 
          (message "LatexMk: Nothing to do")))))

;; a record of original unchanged function, no longer called: -neal
(defun Latexmk-sentinel-original (process name)
  (save-excursion
    (goto-char (point-max))
    (cond
      ((re-search-backward (format "^%s finished at" name) nil t)
       (if (re-search-backward "^Run number [0-9]+ of rule '\\(pdf\\|lua\\|xe\\)?latex'" nil t)
           (progn
             (forward-line 5)
             (let ((beg (point)))
               (when (string= (current-word) "Latexmk")
                 ;; Special treatment for MiKTeX
                 (forward-line))
               (re-search-forward "^Latexmk:" nil t)
               (beginning-of-line)
               (save-restriction
                 (narrow-to-region beg (point))
                 (goto-char (point-min))
                 (TeX-LaTeX-sentinel process name))))
         (message (format "%s: nothing to do" name))))
      ((re-search-backward (format "^%s exited abnormally with code" name) nil t)
       (re-search-backward "^Collected error summary (may duplicate other messages):" nil t)
       (re-search-forward "^  \\([^:]+\\):" nil t)
       (let ((com (TeX-match-buffer 1)))
         (cond
           ((string-match "^\\(pdf\\|lua\\|xe\\)?latex" com)
            (goto-char (point-min))
            (TeX-LaTeX-sentinel process name)
            (when (string= TeX-command-next TeX-command-BibTeX)
              (setq TeX-command-default)))
           ((string-match "^bibtex " com)
            (forward-line -1)
            (re-search-backward com nil t)
            (forward-line 5)
            (let ((beg (point)))
              (re-search-forward "^Rule" nil t)
              (beginning-of-line)
              (save-restriction
                (narrow-to-region beg (point))
                (TeX-BibTeX-sentinel process name))))))))))

(defadvice TeX-recenter-output-buffer (around recenter-for-latexmk activate)
  (setq ad-return-value
        (let ((buffer (TeX-active-buffer)))
          (if buffer
              (if (with-current-buffer buffer
                    (goto-char (point-max))
                    (re-search-backward "^latexmk" nil t))
                  (let ((old-buffer (current-buffer)))
                    (TeX-pop-to-buffer buffer t t)
                    (bury-buffer buffer)
                    (goto-char (point-max))
                    (re-search-backward "^Run number [0-9]+ of rule 'bibtex .+'"
                                        nil t)
                    (re-search-forward "^Rule" nil t)
                    (forward-line -1)
                    (recenter (if line
                                  (prefix-numeric-value line)
                                  (/ (window-height) 2)))
                    (TeX-pop-to-buffer old-buffer nil t))
                  ad-do-it)
              (message "No process for this document.")))))

(provide 'auctex-latexmk)
;;; auctex-latexmk.el ends here

Japanese error descriptions are given by default

Hi,
I just installed this package and noticed that if an error occurs in the compilation and I hit `C-`` the error is give in japanese:

ERROR: Undefined control sequence.

--- TeX said ---
<argument> \undefinedpagestyle 

l.38 \pagestyle{fancyplain}

--- HELP ---
TeXが未定義の命令名を発見しました.おそらく入力の誤りでしょう.もしこ
のエラーがLaTeX命令の処理中に生じた場合は,その命令は間違った位置に置か
れています.例えば,リスト環境の中でないのに\item命令が使われた場合など
です.また,\documentclass命令がない場合にもこのエラーが生じます.

The only setting I have in my init.el are

  (setq auctex-latexmk-inherit-TeX-PDF-mode t)
  (require 'auctex-latexmk)
  (auctex-latexmk-setup)

I also tried (setq japanese-TeX-use-kanji-opt-flag nil) to no avail. I think this might have something to do with commit 0ffeef4 from a few days ago. At least it looks like some settings were changed at this point concerning the encoding?

Any ideas to the origin of this or am I just missing a simple setting somewhere?
Thanks a lot!
Chris

latexmkrc settings are ignored

I found something similar here but the issue was closed so I open a new one, I hope this is ok

I got this settings in my latexmkrc file:

$pdf_mode = 1;
# Output directory
$aux_dir = 'Build'; # Works only in pdflatex
$out_dir = 'Build';
#$pdflatex = 'xelatex --shell-escape -interaction=nonstopmode -file-line-error -synctex=1 %O %S && cp --verbose %D %R.pdf'; 
$pdflatex = '&& cp %D %R.pdf'; --> This does not work.

When I compile the document the files go to Build, so this part works fine. But the second part

$pdflatex = '&& cp %D %R.pdf'

does not work. When I compile in a terminal and comment out the line
#$pdflatex = 'xelatex --shell-escape -interaction=nonstopmode -file-line-error -synctex=1 %O %S && cp --verbose %D %R.pdf'; all files go to Build and the pdf is copied to the source dir. But this does not work inside auctex.

What can I do?

Display only last run errors

At the end of the latexmk runs, auctex display all the errors that it can parse from the log file,
including errors and warnings of the first runs, that are not really relevant.
Is there a simple way to get rid of that and only get the errors from the last runs ?

auctex-latexmk does not work with auctex 3.1.1 anymore

Hi,
With current auctex I don't get latexmk to work anymore I find the following lines in my Messages buffer:

Starting new Ispell process aspell with german-new8 dictionary...done
apply: Wrong type argument: number-or-marker-p, nil
Starting new Ispell process aspell with german-new8 dictionary...done
No process for this document.
Starting new Ispell process aspell with german-new8 dictionary...done [4 times]
TeX-view-command-raw: Wrong number of arguments: (lambda (command file &optional list) "Expand COMMAND for FILE as described in LIST.
LIST default to `TeX-expand-list'.  As a special exception,
`%%' can be used to produce a single `%' sign in the output
without further expansion." (defvar TeX-command-pos) (let (pat pos entry TeX-command-text TeX-command-pos expansion-res case-fold-search string expansion arguments) (setq list (cons (list "%%" #'(lambda nil (setq pos (1+ pos)) "%")) (or list (TeX-expand-list))) pat (regexp-opt (mapcar #'car list))) (setq file (apply-partially #'TeX--master-or-region-file-with-extra-quotes file)) (while (setq pos (string-match pat command pos)) (setq string (match-string 0 command) entry (assoc string list) expansion (car (cdr entry)) arguments (cdr (cdr entry)) string ...) (if (stringp string) (setq command (replace-match string t t command))))) command), 1
Starting new Ispell process aspell with german-new8 dictionary...done
Quit

And I have no clue how to fix it. When I remove (auctex-latexmk-setup) from my .emacs auctex seems to work fine.

Applying #40 does not help.

Add install instructions

I installed this through the Emacs package manager, I believe from melpa. This possibility could be mentioned in the README?

Support for xelatex breaks PDF viewing

Calling xelatex via -xelatex breaks the viewing commands on my setup, probably because AUCTeX tries to view the .xdv file. This does not happen when setting the engine and compiling with AUCTeX's LaTeX command because only latexmk deliberately (their deliberation, not mine) generates first an .xdv file and then PDF. I am not sure whether this should be fixed in latexmk, AUCTeX or here, but would suffice to add:

                    ((and (eq TeX-engine 'xetex)
                          TeX-PDF-mode
                          auctex-latexmk-inherit-TeX-PDF-mode)
                     "-pdf -pdflatex=xelatex ")

in the engine command choice of auctex-latexmk.el to avoid that latexmk adds --no-pdf and then generation and viewing work as expected. This may be the cheapest fix. It may even be reasonable to choose this fix if [auctex-latexmk-inherit-]TeX-PDF-mode are nil because there is no XDV viewer anyway.

Support MELPA stable

Thanks for your great package!

Melpa stable accepts only stable versions of packages (while MELPA takes the latest commit of each package). So auctex-latexmk is not available via Melpa stable.
To make it happen, you should tag the latest commit vith a semver version.
For example, giving the following commands should suffice:

git tag v1.0.0 bda696babcf4f4df435415e2d6a9c54fa99b230c
git push

Since tagging cannot be done via a pull request, I cannot help you more.
Thanks!

Could not find file [%(file-line-error)]

Hi,
I've setup according to your instructions except I'm using MiKTEX instead of Tex-Live. I get the following error:
"main.tex"''
Latexmk: This is Latexmk, John Collins, 24 February 2016, version: 4.44.


Latexmk: Could not find file [%(file-line-error)].
-- Use the -f option to force complete processing.

LatexMk exited abnormally with code 11 at Wed Nov 16 13:06:20


Any idea what could be wrong here?

Link $aux_dir back from `latexmkrc` to auctex

Auctex is unaware of the $aux_dir I specified in my latexmkrc, which means the "go to error" command doesn't work because it can't find the log file. Could this option be linked back to auctex? Kind of the opposite of #45 in the sense that we want to communicate external latexmk configuration options back to auctex.

TeX-command-run-all fails

Hello, Thanks for the nice package!

However, I'm having one problem that I hope you can help me resolve. When I use C-cC-a to execute TeX-command-run-all, I get this error:

TeX-command-expand: Wrong type argument: stringp, nil

Any thoughts?

Here is my related .emacs config settings:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; AUCTeX settings
;;
(load "auctex.el" nil t t)
;;
(add-hook 'LaTeX-mode-hook
          (function (lambda ()
                      ;; general setup
                      (turn-on-reftex)
                      (LaTeX-math-mode)
                      (setq-local comment-column 0)
                      (setq-local comment-padding 1)
                      (setq-local TeX-parse-self t)
                      ;; set default indent values
                      (setq-local LaTeX-indent-environment-list ())
                      (setq-local LaTeX-indent-level 0)
                      (setq-local LaTeX-item-indent 0)
                      (setq-local TeX-brace-indent-level 0)
                      (local-set-key [return]
                                     'reindent-then-newline-and-indent)
                      ;; setup latexmk to work with auctex
                      (add-to-list 'load-path "~/share/emacs/site-lisp/auctex-latexmk")
                      (require 'auctex-latexmk)
                      (auctex-latexmk-setup)
                      (setq-local TeX-command-default "LatexMK")
                      (setq-local auctex-latexmk-inherit-TeX-PDF-mode t)
                      ;; settings to make interaction with Skim work
                      (TeX-source-correlate-mode)
                      (add-to-list 'TeX-view-program-selection
                                   '(output-pdf "PDF Viewer"))
                      (add-to-list 'TeX-view-program-list
                                   '("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b"))
                      ;; settings for clean up
                      (add-to-list 'LaTeX-clean-intermediate-suffixes
                                   "\\.spl" "\\.tex~")
                      )))

Error parsing no longer works for new version of Latexmk

After upgrading Latexmk to a new version (4.63b on Archlinux) the error parsing functionality does not work anymore. It seems that Latexmk changed the output format (see the attached log below).

I guess those lines

(re-search-backward "^Collected error summary (may duplicate other messages):" nil t)
(re-search-forward "^ \\([^:]+\\):" nil t)
(let ((com (TeX-match-buffer 1)))
might be relevant? Now there is no Collected error summary (may duplicate other messages): anymore.

By the way, thank you for making and maintaining this package!

Log of Latexmk:

Running `LatexMk' on `test' with ``latexmk -lualatex --synctex=1 -interaction=nonstopmode  -file-line-error  test.tex''
Latexmk: This is Latexmk, John Collins, 17 March 2019, version: 4.63b.
Latexmk: applying rule 'lualatex'...
Rule 'lualatex': File changes, etc:
   Changed files, or newly in use since previous run(s):
      'test.tex'
------------
Run number 1 of rule 'lualatex'
------------
------------
Running 'lualatex  --synctex=1 -interaction=nonstopmode -file-line-error -recorder  "test.tex"'
------------
This is LuaTeX, Version 1.10.0 (TeX Live 2019/Arch Linux)
 restricted system commands enabled.
(./test.tex
LaTeX2e <2018-12-01>

luaotfload | main : initialization completed in 0.058 seconds

! LaTeX Error: File `test.cls' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: cls)

Enter file name:
./test.tex:2: Emergency stop.
<read *>

l.2 

 267 words of node memory still in use:
   1 dir, 3 kern, 1 glyph, 1 attribute, 34 glue_spec, 1 attribute_list nodes
   avail lists: 2:10,3:1,4:1
./test.tex:2:  ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.
=== TeX engine is 'LuaTeX'
Latexmk: Missing input file: 'test.cls' from line
  '! LaTeX Error: File `test.cls' not found.'
Latexmk: Errors, so I did not complete making targets
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs, or warnings treated as errors.

TeX Output exited abnormally with code 12 at Thu Oct 10 10:15:13

Contents of the test file:

\documentclass{test}

Remove AUCTeX dependency

Please remove the AUCTeX dependency. I know, it sounds silly, but the dependency doesn't work out well.

The auctex package in ELPA is still at 11.86, which is over two years old, completely outdated, and unlikely to be updated soon. Most people install AUCTeX from the package manager, or from the release tarballs or Git checkouts.

However, package.el does not recognize a manual installation of AUCTeX, and thus installs AUCTeX again which can lead to all sorts of troubles.

No inherit settings of TeX-PDF-from-DVI

When I want to compile through the chain of "LaTeX dvips ps2pdf", I set the variable TeX-PDF-from-DVI to "Dvips". It works fine if I run C-c C-c with LaTeX command and follow the suggestion afterwards.

However LaTeXMK command can not recognize this settings and still use pdfLaTeX.
I personally make a new command using latexmk with -pdfps option.
How can I make the LaTeXMK command inherit Dvips settings without running my own command?

Thansk

Using auctex-latexmk with pdf?

I fail to use your nice code, and it seems like it is because I have to use pdf for my compilation. Therefore, these lines in .latexmkrc

$latex = "platex -interaction=nonstopmode";
$dvipdf = 'perl -e "exec('dvipdfmx', $ARGV[0])"';

seems to break my compilation. Is there a way to tell latexmk to use pdflatex using your work?

tex-buf.el has been merged into tex.el

I've noticed this because I maintain the Emacsmirror and the tools, that I use to do so, inform me when a dependency of a mirrored package isn't satisfied (anymore).

In auctex tex-buf.el was merged into tex.el but your package still requires tex-buf. You can probably fix this by depending on tex instead, or if you already do that by dropping the additional (require 'tex-buf).

latexmk with "nothing to do" overwrites `TeX-output-extension` to dvi

Hey! Thanks for providing this package, the only true way to compile latex documents :)

Recently I've discovered a weird problem. I am not entirely sure whether this has anything todo with auctex-latexmk.

I have a .latexmk file with luatex and pdf mode specification. If I compile the project everything works fine and TeX-output-extension is set to pdf. However if I invoke latexmk via TeX-command-run-all without any changes to the document, i.e. latexmk reports "there is nothing to do" the variable TeX-output-extension is set back to dvi and the next view command will fail. The tex-pdf-mode minormode is still active though.

Any idea whats happening there?

Do not enforce `-pdfdvi`

The -pdfdvi option to latexmk breaks with lualatex and xelatex, which directly build PDF. Please make it optional.

Support for %(output-dir)

Seemingly, AUCTeX's %(output-dir) can be forwarded to latexmk as-is.

I have replaced the line

  (setq-default TeX-command-list
                (cons
                 '("LatexMk" "latexmk %(-PDF)%S%(mode) %(file-line-error)  %(extraopts) %t" TeX-run-latexmk nil
                   (plain-tex-mode latex-mode doctex-mode) :help "Run LatexMk")
                 TeX-command-list)
                LaTeX-clean-intermediate-suffixes
                (append LaTeX-clean-intermediate-suffixes
                        '("\\.fdb_latexmk" "\\.aux.bak" "\\.fls")))

with

  (setq-default TeX-command-list
                (cons
                 '("LatexMk" "latexmk %(-PDF)%S%(mode) %(file-line-error) %(output-dir) %(extraopts) %t" TeX-run-latexmk nil
                   (plain-tex-mode latex-mode doctex-mode) :help "Run LatexMk")
                 TeX-command-list)
                LaTeX-clean-intermediate-suffixes
                (append LaTeX-clean-intermediate-suffixes
                        '("\\.fdb_latexmk" "\\.aux.bak" "\\.fls")))

and it seems to work.

Can this be added?

Drop auctex-latexmk with your own configs tips (replace `TeX-run-TeX` with `TeX-run-format`)

I'm dropping auctex-latexmk from my configuration as it's not maintained.
According to this report, we can replace TeX-run-TeX with TeX-run-format to avoid using the complex Latexmk-sentinel:

  (add-to-list 'TeX-expand-list
               '("%(-PDF)"
                 (lambda ()
                   (if TeX-PDF-mode
                       (cond
                        ((eq TeX-engine 'default) "-pdf")
                        ((eq TeX-engine 'xetex) "-pdfxe")
                        ((eq TeX-engine 'luatex) "-pdflua")) ""))))
  (add-to-list 'TeX-command-list
               '("LaTeXmk" "latexmk %(-PDF) -%(PDF)%(latex)='%`%l%(mode)%'' %(output-dir) %t"
                 TeX-run-format nil (latex-mode doctex-mode) :help "Run Latexmk"))
  (with-eval-after-load 'latex
    (setq LaTeX-clean-intermediate-suffixes
          (append LaTeX-clean-intermediate-suffixes '("\\.fdb_latexmk" "\\.fls"))))

Cannot view pdf when option $out_dir is set in latexmkrc

My latexmrc is just a single line:

$out_dir = 'build';

After I run the LatexMk command, if I try to view the output (C-c C-v), I get an error saying that the output file cannot be found. Would it be possible to parse the latexmkrc (in the current directory as well as in the home directory) to see if $out_dir is set, and then modify the view command?

Temporarily, I have fixed this by adding another line to my latexmkrc:

$pdflatex .= '&& (cp "%D" "%R.pdf"; cp "%Z%R.synctex.gz" "%R.synctex.gz")'

This line copies the output pdf and synctex files to the current directory. I'm able to C-c C-v successfully after this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.