auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trigger Tex file compilation with latexmk automatically when its con


From: Hongyi Zhao
Subject: Re: Trigger Tex file compilation with latexmk automatically when its content is changed and saved.
Date: Sat, 6 May 2023 20:10:28 +0800

On Thu, May 4, 2023 at 9:52 PM Ikumi Keita <ikumi@ikumi.que.jp> wrote:
>
> Hi Hongyi,
>
> >>>>> Hongyi Zhao <hongyi.zhao@gmail.com> 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
</opt/texlive/2023/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf>
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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]