On Mon, Jul 12, 2021 at 1:08 PM Tassilo Horn <t...@gnu.org> wrote: > > Hongyi Zhao <hongyi.z...@gmail.com> writes: > > >> > Or as a first step, you could also find the master file and all chapter > >> > files and eval the following in *stratch* and post the output: > >> > > >> > (delq nil (mapcar (lambda (buf) > >> > (with-current-buffer buf > >> > (when (eq major-mode 'latex-mode) > >> > (cons (buffer-file-name buf) > >> > (TeX-master-file "pdf"))))) > >> > (buffer-list))) > >> > >> See below: > >> > >> (delq nil (mapcar (lambda (buf) > >> (with-current-buffer buf > >> (when (eq major-mode 'latex-mode) > >> (cons (buffer-file-name buf) > >> (TeX-master-file "pdf"))))) > >> (buffer-list))) > >> (("/home/werner/Public/hpc/tools/thesis/gitlab.kwant-project.org/jbweston/thesis.git/thesis.tex" > >> . "thesis.pdf")) > > Here it seems that you've just had thesis.tex open in a buffer but not > the chapter files. I've asked you to "find the master file and *all > chapter files* and eval the following in *stratch*". >
Sorry for my misunderstanding. Really, it can pinpoint the problem: (delq nil (mapcar (lambda (buf) (with-current-buffer buf (when (eq major-mode 'latex-mode) (cons (buffer-file-name buf) (TeX-master-file "pdf"))))) (buffer-list))) (("/home/werner/Public/hpc/tools/thesis/gitlab.kwant-project.org/jbweston/thesis.git/content/josephson.tex" . "josephson.pdf") ("/home/werner/Public/hpc/tools/thesis/gitlab.kwant-project.org/jbweston/thesis.git/content/appendix.tex" . "../thesis.pdf") ("/home/werner/Public/hpc/tools/thesis/gitlab.kwant-project.org/jbweston/thesis.git/thesis.tex" . "thesis.pdf")) As you can see, only the chapter/master files which have been set the correct TeX-master variable will report the correct master PDF file. > > Why can't `(La)TeX-mode' return the correct result: > > > > (delq nil (mapcar (lambda (buf) > > (with-current-buffer buf > > (when (eq major-mode 'TeX-mode) > > (cons (buffer-file-name buf) > > (TeX-master-file "pdf"))))) > > (buffer-list))) > > Because the symbols latex-mode and LaTeX-mode or TeX-mode are not `eq' > (identical). `major-mode' is just a symbol, and in an AUCTeX LaTeX > buffer it'll be set to `latex-mode'. But see the following statement on <https://www.gnu.org/software/emacs/manual/html_node/reftex/Installation.html>: ``` 1.1.3 Entering RefTeX Mode To turn RefTeX Mode on and off in a particular buffer, use M-x reftex-mode RET. To turn on RefTeX Mode for all LaTeX files, add the following lines to your .emacs file: (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode ``` It says that the AUCTeX LaTeX mode should be called `LaTeX-mode', while the Emacs latex mode is called `latex-mode' Any hints on this description? Regards -- Assoc. Prof. Hongyi Zhao <hongyi.z...@gmail.com> Theory and Simulation of Materials Hebei Vocational University of Technology and Engineering No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province