Problem
I am using latexkm to compile .tex documents, and recently I got this error while compiling:
Running `latexmk' on `AF2021_serie5' with ``latexmk -bibtex-cond -pdf -synctex=1 AF2021_serie5'' Rc files read: NONE Latexmk: This is Latexmk, John Collins, 17 Apr. 2020, version: 4.69a. Latexmk: applying rule 'biber AF2021_serie5'... Rule 'biber AF2021_serie5': The following rules & subrules became out-of-date: 'biber AF2021_serie5' ------------ Run number 1 of rule 'biber AF2021_serie5' ------------ ------------ Running 'biber "AF2021_serie5"' ------------ sh: biber : commande introuvable Latexmk: Errors, so I did not complete making targets Collected error summary (may duplicate other messages): biber AF2021_serie5: Could not open biber log file for 'AF2021_serie5' 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 Tue Oct 6 21:15:40 I am apparently not the only one to have had this problem (1) but the solution in the link did not fix it for me.
Solutions tried that do not fix the problem
I figured that
- I am using
zshas my default shell when I open a terminal, while emacs seems to loadsh. - Compiling the
.texfiles withlatexmkfrom the terminal does not generate this error. - Launching emacs with
SHELL=/bin/zsh emacsand then usingC-c C-c latexmkdoes not generate this error. - Adding
(setq-default shell-file-name "/bin/zsh") (setq-default explicit-shell-file-name "/bin/zsh") to my .emacs does not fix the problem; however when I click on Run Shell Interactively, I can compile the .texwith latexmk and it does not generate this error.
- Adding
(setq tex-shell-file-name "/bin/zsh") (setq TeX-shell "/bin/zsh") to my .emacs does not fix the error. It still seems that latexmk is ran through /bin/sh.
Additional information
Part of my .emacs:
;; == AucTeX == ;; (setq TeX-auto-save t) (setq TeX-parse-self t) (setq preview-auto-cache-preamble t) ; stop preview pestering ; (setq-default TeX-master nil) (add-hook 'LaTeX-mode-hook 'visual-line-mode) ; Word wrapping (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) (setq LaTeX-electric-left-right-brace t) ; Automatic close parenthesis (add-hook 'LaTeX-mode-hook 'turn-on-reftex) (setq reftex-plug-into-AUCTeX t) (setq TeX-PDF-mode t) ; Compile as a PDF (setq reftex-ref-macro-prompt nil) ; Disable annoying reference prompt screen ;; == RefTeX == ;; (setq reftex-bibliography-commands '("bibliography" "nobibliography" "addbibresource")) ;; === LatexMK - automatically recompile and run bibtex ===;; (add-hook 'LaTeX-mode-hook (lambda () (push '("latexmk" "latexmk -bibtex-cond -pdf -synctex=1 %s" TeX-run-TeX nil t :help "Run latexmk on file") TeX-command-list))) (add-hook 'TeX-mode-hook '(lambda () (setq TeX-command-default "latexmk"))) result of which biber (from zsh)
/usr/bin/vendor_perl/biber
result of which biber (from sh)
/usr/bin/vendor_perl/biber
Final question, I guess
What can I add to my .emacs so that latexmk is ran inside of zsh instead of sh?
latexmkin a terminal that is runningsh?exec-paththat's wrong: what is its value?M-x describe-variable exec-path, it returnsexec-path is a variable defined in ‘C source code’. Its value is ("/usr/bin/vendor_perl" "/usr/local/bin" "/usr/local/sbin" "/usr/bin" "/usr/lib/jvm/default/bin" "/usr/lib/emacs/27.1/x86_64-pc-linux-gnu") Original value was ("/usr/local/bin" "/usr/local/sbin" "/usr/bin" "/usr/lib/jvm/default/bin" "/usr/lib/emacs/27.1/x86_64-pc-linux-gnu")