auctex-latexmk icon indicating copy to clipboard operation
auctex-latexmk copied to clipboard

Make latexmk the defautl for TeX-command-master

Open pprw opened this issue 5 years ago • 3 comments

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.

pprw avatar Aug 25 '18 10:08 pprw

Sorry for late reply.

There are mainly two ways to make TeX-run-latexmk (it is a function called in C-c C-c LatexMk) by default:

  • Make LatexMk default by taking care of related variables and functions. I guess it is an ideal solution. It will be OK if it could be done by just setting several variables but I guess it is not. It needs more work to achieve it. I am not sure it is a reasonable option comparing to the latter option.
  • Override the LaTeX command. auctex-latexmk does not do it because it may break other packages that depend on auctex. However, it is simple enough and less additional code to be maintained.

I suggest to overwrite LaTeX command by user code. For example:

(setq TeX-command-list
      (cons
       `("LaTeX" . ,(cdr (assoc "LaTexMk" TeX-command-list)))
       TeX-command-list))

tom-tan avatar Sep 09 '18 07:09 tom-tan

The overwriting solution (see below snippet) is not working,

(setq TeX-command-list
      (cons
       `("LaTeX" . ,(cdr (assoc "LaTexMk" TeX-command-list)))
       TeX-command-list))

It is giving following error on selecting "LaTeX",

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

HumHongeKamyaab avatar Oct 17 '20 22:10 HumHongeKamyaab

Another way to do it via a hook:

(add-hook 'TeX-mode-hook '(lambda () (setq TeX-command-default "LatexMk")))

UlrikBuchholtz avatar Oct 10 '21 08:10 UlrikBuchholtz