Re: LaTeX commands and packages names autocomplete.
On Fri, May 5, 2023 at 2:23 PM Arash Esbati wrote: > > Hongyi Zhao writes: > > > Now, I add the `:demand t` to the corfu's use-package configuration, > > but the problem still remains: > > I don't think this is a corfu/AUCTeX issue. Try: > > • emacs -Q > • M-x package-initialize RET > • eval (setq tab-always-indent 'complete) I tried both methods: `M-: (setq tab-always-indent 'complete)` in minibuffer. And `C-x C-e (setq tab-always-indent 'complete)` in scratch buffer. > • Open a .tex file and do 'M-x corfu-mode RET' > • In your .tex file, do '$\be $' I use the following tex file to do the test, but nothing is completed: \documentclass{article} \begin{document} $\be$ \end{document} %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% End: > I get the candidates instantly. > > Best, Arash
Re: Trigger Tex file compilation with latexmk automatically when its content is changed and saved.
On Sat, May 6, 2023 at 10:31 PM Ikumi Keita wrote: > > > Hongyi Zhao writes: > >> (1) Does "latexmk -pv FILENAME" work as expected when you issue the > >> command on some shell, in the directory the file is located? > > > In fact, my latexmk configuration, aka, `/home/werner/.latexmkrc` was > > set by me very long ago. > > > See below: > > [...] > > > It's very strange that I don't have any acroread related config in > > `/home/werner/.latexmkrc`, why does it complain the following: > > > sh: 1: acroread: not found > > Then it isn't an AUCTeX issue. Unfortunately, I don't know latexmk. I > hope someone familiar with latexmk chimes in. :-) > > If no one does, I'd recommend to ask at latexmk support commnunity. Thanks for the tip! Regards, Zhao > > See below for the real config of latexmk: > > > $ grep -Ev '^[ ]*(#|$)' ~/.latexmkrc > > $show_time=1; > > $pdf_mode = 4; > > $postscript_mode = $dvi_mode = 0; > > $lualatex = "lualatex -shell-escape -file-line-error -halt-on-error > > -interaction=nonstopmode -synctex=1 %O %S"; > > $bibtex = "bibtex %O %S"; > > $bibtex_use = 2; > > $makeindex = "makeindex %O -o %D %S"; > > $silence_logfile_warnings = 1; > >add_cus_dep( 'acn', 'acr', 0, 'makeglossaries' ); > >add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' ); > >$clean_ext .= " acr acn alg glo gls glg"; > >sub makeglossaries { > > my ($base_name, $path) = fileparse( $_[0] ); > > pushd $path; > > my $return = system "makeglossaries", $base_name; > > popd; > > return $return; > >} > > add_cus_dep( 'svg', 'pdf', 0, 'makesvg2pdf' ); > > sub makesvg2pdf { > > system( "inkscape \"$_[0].svg\" --export-pdf=\"$_[0].pdf\"" ); > > } > > Regards, > Ikumi Keita > #StandWithUkraine #StopWarInUkraine
Re: LaTeX commands and packages names autocomplete.
Hongyi Zhao writes: > I use the following tex file to do the test, but nothing is completed: >From your screenshot, you're using the built-in latex-mode provided by Emacs. You want to activate AUCTeX for your experiment. Then, the value of `completion-at-point-functions' should be: (TeX--completion-at-point t LaTeX--arguments-completion-at-point) and you should get in-buffer completion. Best, Arash
Re: Trigger Tex file compilation with latexmk automatically when its content is changed and saved.
On Thu, May 4, 2023 at 9:52 PM Ikumi Keita wrote: > > Hi Hongyi, > > > Hongyi Zhao writes: > > But after the TeX file has been changed and saved, I still haven't > > observed the automatic compilation progress. Any tips/comments will be > > appreciated. > > I'm not familiar with `use-package', so I'd like to ask some questions. Let us dug it step by step: > (1) Does "latexmk -pv FILENAME" work as expected when you issue the > command on some shell, in the directory the file is located? In fact, my latexmk configuration, aka, `/home/werner/.latexmkrc` was set by me very long ago. See below: $ cat test.tex \documentclass{article} \begin{document} This is a test. \end{document} %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% End: $ latexmk -C test $ latexmk -pv test Rc files read: /home/werner/.latexmkrc Latexmk: This is Latexmk, John Collins, 4 Apr. 2023. Version 4.80. No existing .aux file, so I'll make a simple one, and require run of *latex. Latexmk: applying rule 'lualatex'... Rule 'lualatex': Reasons for rerun Category 'other': Rerun of 'lualatex' forced or previously required Run number 1 of rule 'lualatex' Running 'lualatex -shell-escape -file-line-error -halt-on-error -interaction=nonstopmode -synctex=1 -recorder "test.tex"' This is LuaHBTeX, Version 1.16.0 (TeX Live 2023) system commands enabled. (./test.tex LaTeX2e <2022-11-01> patch level 1 L3 programming layer <2023-04-20> (/opt/texlive/2023/texmf-dist/tex/latex/base/article.cls Document Class: article 2022/07/02 v1.4n Standard LaTeX document class (/opt/texlive/2023/texmf-dist/tex/latex/base/size10.clo)) (/opt/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-luatex.def) (./test.aux) (/opt/texlive/2023/texmf-dist/tex/latex/base/ts1cmr.fd) [1{/opt/te xlive/2023/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)) 406 words of node memory still in use: 3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 48 glue_spec , 4 attribute_list, 1 write nodes avail lists: 2:23,3:4,4:2,5:22,6:2,7:58,9:18 Output written on test.pdf (1 page, 3410 bytes). SyncTeX written on test.synctex.gz. Transcript written on test.log. Latexmk: Getting log file 'test.log' Latexmk: Examining 'test.fls' Latexmk: Examining 'test.log' Latexmk: All targets () are up-to-date Running 'start start acroread "test.pdf"' 'lualatex': time = 0.64 'view': time = 0.01 Processing time = 0.70 Number of rules run = 2 sh: 1: acroread: not found It's very strange that I don't have any acroread related config in `/home/werner/.latexmkrc`, why does it complain the following: sh: 1: acroread: not found See below for the real config of latexmk: $ grep -Ev '^[ ]*(#|$)' ~/.latexmkrc $show_time=1; $pdf_mode = 4; $postscript_mode = $dvi_mode = 0; $lualatex = "lualatex -shell-escape -file-line-error -halt-on-error -interaction=nonstopmode -synctex=1 %O %S"; $bibtex = "bibtex %O %S"; $bibtex_use = 2; $makeindex = "makeindex %O -o %D %S"; $silence_logfile_warnings = 1; add_cus_dep( 'acn', 'acr', 0, 'makeglossaries' ); add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' ); $clean_ext .= " acr acn alg glo gls glg"; sub makeglossaries { my ($base_name, $path) = fileparse( $_[0] ); pushd $path; my $return = system "makeglossaries", $base_name; popd; return $return; } add_cus_dep( 'svg', 'pdf', 0, 'makesvg2pdf' ); sub makesvg2pdf { system( "inkscape \"$_[0].svg\" --export-pdf=\"$_[0].pdf\"" ); } > (2) In the emacs buffer of the tex file, is AutoTeX-mode really > activated? (Examine the value of the elisp variable `AutoTeX-mode'.) > (3) In the emacs buffer of the tex file, what's the value of the elisp > variable `after-save-hook'? > (4) Does `LaTeX-mode-hook' contain the expected form > (lambda () (AutoTeX-mode 1)) > ? (Examine the value of the elisp variable `LaTeX-mode-hook') > (5) Does the elisp function `run-latexmk' actually defined? (What does > emacs return when you evaluate > (fboundp 'run-latexmk) <- Type C-x C-e here and see echo area > after you open the tex file?) > (6) Does the elisp function `smart-compile-string' actually defined? > (What does emacs return when you evaluate > (fboundp 'smart-compile-string) <- Type C-x C-e here and see echo area > after you open the tex file?) > (7) If the answer to (6) is `t', what does emacs return when you > evaluate > (smart-compile-string "latexmk -pv %f") <- Type C-x C-e here and see > echo area > in the emacs buffer of the tex file? > > Regards, > Ikumi Keita > #StandWithUkraine #StopWarInUkraine Best, Zhao
Re: LaTeX commands and packages names autocomplete.
On Sat, May 6, 2023 at 7:58 PM Arash Esbati wrote: > > Hongyi Zhao writes: > > > I use the following tex file to do the test, but nothing is completed: > > From your screenshot, you're using the built-in latex-mode provided by > Emacs. Thank you for pointing this out to me. > You want to activate AUCTeX for your experiment. But, we are doing the test using `emacs -Q` and how can I in this scenario to enable AUCTeX? I mean, it seems that enabling AUCTeX needs complicated configurations, so we use `init.el` to do the trick. > Then, the > value of `completion-at-point-functions' should be: > > (TeX--completion-at-point t LaTeX--arguments-completion-at-point) > > and you should get in-buffer completion. > > Best, Arash Regards, Zhao
Re: Trigger Tex file compilation with latexmk automatically when its content is changed and saved.
> Hongyi Zhao writes: >> (1) Does "latexmk -pv FILENAME" work as expected when you issue the >> command on some shell, in the directory the file is located? > In fact, my latexmk configuration, aka, `/home/werner/.latexmkrc` was > set by me very long ago. > See below: [...] > It's very strange that I don't have any acroread related config in > `/home/werner/.latexmkrc`, why does it complain the following: > sh: 1: acroread: not found Then it isn't an AUCTeX issue. Unfortunately, I don't know latexmk. I hope someone familiar with latexmk chimes in. :-) If no one does, I'd recommend to ask at latexmk support commnunity. > See below for the real config of latexmk: > $ grep -Ev '^[ ]*(#|$)' ~/.latexmkrc > $show_time=1; > $pdf_mode = 4; > $postscript_mode = $dvi_mode = 0; > $lualatex = "lualatex -shell-escape -file-line-error -halt-on-error > -interaction=nonstopmode -synctex=1 %O %S"; > $bibtex = "bibtex %O %S"; > $bibtex_use = 2; > $makeindex = "makeindex %O -o %D %S"; > $silence_logfile_warnings = 1; >add_cus_dep( 'acn', 'acr', 0, 'makeglossaries' ); >add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' ); >$clean_ext .= " acr acn alg glo gls glg"; >sub makeglossaries { > my ($base_name, $path) = fileparse( $_[0] ); > pushd $path; > my $return = system "makeglossaries", $base_name; > popd; > return $return; >} > add_cus_dep( 'svg', 'pdf', 0, 'makesvg2pdf' ); > sub makesvg2pdf { > system( "inkscape \"$_[0].svg\" --export-pdf=\"$_[0].pdf\"" ); > } Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine
Re: Trigger Tex file compilation with latexmk automatically when its content is changed and saved.
On Sat, May 6, 2023 at 11:14 PM Hongyi Zhao wrote: > > On Sat, May 6, 2023 at 10:31 PM Ikumi Keita wrote: > > > > > Hongyi Zhao writes: > > >> (1) Does "latexmk -pv FILENAME" work as expected when you issue the > > >> command on some shell, in the directory the file is located? > > > > > In fact, my latexmk configuration, aka, `/home/werner/.latexmkrc` was > > > set by me very long ago. > > > > > See below: > > > > [...] > > > > > It's very strange that I don't have any acroread related config in > > > `/home/werner/.latexmkrc`, why does it complain the following: > > > > > sh: 1: acroread: not found > > > > Then it isn't an AUCTeX issue. Unfortunately, I don't know latexmk. I > > hope someone familiar with latexmk chimes in. :-) > > > > If no one does, I'd recommend to ask at latexmk support commnunity. > > Thanks for the tip! Now, all works smoothly. The problem reported here is caused by my mismatching configuration of latexmk and the Emacs smart-compile package. Here is the current working configuration: The latexmk configuration: werner@X10DAi:~$ grep -v '^[ ]*#' ~/.latexmkrc | awk 'NF >0' $show_time=1; $pdf_mode = 1; $pdflatex = "pdflatex -shell-escape -file-line-error -halt-on-error -interaction=nonstopmode -synctex=1 %O %S"; $bibtex = "bibtex %O %S"; $bibtex_use = 2; $makeindex = "makeindex %O -o %D %S"; $silence_logfile_warnings = 1; add_cus_dep( 'acn', 'acr', 0, 'makeglossaries' ); add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' ); $clean_ext .= " acr acn alg glo gls glg"; sub makeglossaries { my ($base_name, $path) = fileparse( $_[0] ); pushd $path; my $return = system "makeglossaries", $base_name; popd; return $return; } add_cus_dep( 'svg', 'pdf', 0, 'makesvg2pdf' ); sub makesvg2pdf { system( "inkscape \"$_[0].svg\" --export-pdf=\"$_[0].pdf\"" ); } $pdf_previewer = 'evince %O %S'; The Emacs init.el configuration: (defvar hz/AUCTeX-process nil) (use-package smart-compile :init (declare-function smart-compile-string "smart-compile") (defun run-latexmk () (when (string-match ".tex$" (buffer-file-name)) (unless (and (processp hz/AUCTeX-process) (eq (process-status hz/AUCTeX-process) 'run)) (let ((buf (get-buffer-create "*Background TeX proccess*"))) (with-current-buffer buf (erase-buffer)) ;; flush previous log (setq hz/AUCTeX-process (start-process-shell-command "Background TeX" buf ;; use an external application as the previewer (smart-compile-string "latexmk -pv %f") ;; use pdf-tools ;; (smart-compile-string "latexmk %f") )) (define-minor-mode AutoTeX-mode "Mode for compiling latex sources and creating PDFs after saving." :global nil :lighter " Auto" (if AutoTeX-mode (add-hook 'after-save-hook 'run-latexmk t t) (remove-hook 'after-save-hook 'run-latexmk t))) :hook (LaTeX-mode . (lambda () (AutoTeX-mode 1 N.B.: In fact, we discussed the similar question a long time ago on this list [1-2]. [1] https://lists.gnu.org/archive/html/auctex/2021-07/msg00013.html [2] https://tam5917.hatenablog.com/entry/2021/04/10/134230 Regards, Zhao
Re: LaTeX commands and packages names autocomplete.
On Sat, May 6, 2023 at 8:22 PM Hongyi Zhao wrote: > > On Sat, May 6, 2023 at 7:58 PM Arash Esbati wrote: > > > > Hongyi Zhao writes: > > > > > I use the following tex file to do the test, but nothing is completed: > > > > From your screenshot, you're using the built-in latex-mode provided by > > Emacs. > > Thank you for pointing this out to me. > > > You want to activate AUCTeX for your experiment. > > But, we are doing the test using `emacs -Q` and how can I in this > scenario to enable AUCTeX? I mean, it seems that enabling AUCTeX needs > complicated configurations, so we use `init.el` to do the trick. It seems that https://www.gnu.org/software/auctex/manual/auctex.html#Quick-Start gives some clues, but I'm not sure if eval the following in scratch or minibuffer is enough for testing with `emacs -Q`: (setq TeX-auto-save t) (setq TeX-parse-self t) (setq-default TeX-master nil) > > Then, the > > value of `completion-at-point-functions' should be: > > > > (TeX--completion-at-point t LaTeX--arguments-completion-at-point) > > > > and you should get in-buffer completion. > > > > Best, Arash > > Regards, Zhao