I have multi files and each file refers to the master file properly and the document can be compiled without problems ....
RefTeX
can only refer to the environments , figures
, equations
, etc when it is stated in the master file ... rather than this C-c )
can't see the other labels in any other file than the master ... kindly advise.
The following are the minimal files
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
\documentclass{book}
\begin{document}
\chapter{chapter 1 }
\label{cha:chapter-1}
\ref{cha:chapter-1}
\end{document}
and the second file slave.tex
\chapter{Chapter 2 }
\label{cha:chapter-2}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% End:
init.el
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq TeX-save-query nil)
(setq TeX-PDF-mode t)
(setq-default TeX-master nil)
(require 'tex-site)
(setq reftex-enable-partial-scans t)
(setq reftex-save-parse-info t)
(setq reftex-use-multiple-selection-buffers t)
(setq reftex-plug-into-AUCTeX t)
(autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
(autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
(autoload 'reftex-label "reftex-label" "Make label" nil)
(autoload 'reftex-reference "reftex-reference" "Make label" nil)
(autoload 'reftex-citation "reftex-cite" "Make citation" nil)
(autoload 'reftex-index-phrase-mode "reftex-index" "Phrase Mode" t)
(add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
;(add-hook 'reftex-load-hook 'imenu-add-menubar-index)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq LaTeX-eqnarray-label "eq"
LaTeX-equation-label "eq"
LaTeX-figure-label "fig"
LaTeX-table-label "tab"
LaTeX-myChapter-label "chap"
TeX-auto-save t
TeX-newline-function 'reindent-then-newline-and-indent
TeX-parse-self t
TeX-style-path
'("style/" "auto/"
"/usr/share/emacs21/site-lisp/auctex/style/"
"/var/lib/auctex/emacs21/"
"/usr/local/share/emacs/site-lisp/auctex/style/")
LaTeX-section-hook
'(LaTeX-section-heading
LaTeX-section-title
LaTeX-section-toc
LaTeX-section-section
LaTeX-section-label))
(eval-after-load
"latex"
'(TeX-add-style-hook
"cleveref"
(lambda ()
(if (boundp 'reftex-ref-style-alist)
(add-to-list
'reftex-ref-style-alist
'("Cleveref" "cleveref"
(("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))))
(add-to-list 'reftex-ref-style-default-list "Cleveref")
(TeX-add-symbols
'("cref" TeX-arg-ref)
'("Cref" TeX-arg-ref)
'("cpageref" TeX-arg-ref)
'("Cpageref" TeX-arg-ref)))))
(add-to-list 'load-path "/home/msalem/.emacs.d/predictive")
(add-to-list 'load-path "/home/msalem/.emacs.d/predictive/latex")
(add-to-list 'load-path "/home/msalem/.emacs.d/predictive/texinfo")
(add-to-list 'load-path "/home/msalem/.emacs.d/predictive/misc")
(add-to-list 'load-path "/home/msalem/.emacs.d/predictive/html")
(require 'predictive)
(setq predictive-main-dict 'rpg-dictionary
predictive-auto-learn t
predictive-add-to-dict-ask nil
predictive-use-auto-learn-cache nil
predictive-which-dict t)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(TeX-source-correlate-method (quote synctex))
'(TeX-source-correlate-start-server t)
'(TeX-view-program-list (quote (("Okular" "okular -unique %o#src:%n%b"))))
'(TeX-view-program-selection (quote ((output-pdf "Okular") ((output-dvi style-pstricks) "dvips and gv") (output-dvi "xdvi") (output-pdf "Evince") (output-html "xdg-open"))))
'(inhibit-startup-screen t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
The reference only can see the labels in the master file , and C-c ) when invoked from the slave.tex can't recognize the label to the chapter in the same file..... ;; If there is more than one, they won't work right. )
Edit 1: Forgot to mention that I import and include the slave into the master file. It is pretty complex on my side as with this minimal file, I am able to reference whatever exists in master only or slave only. On the main document I am building, I am able to reference only whatever is in the master!
Edit 2: The problem was mainly due to using \import
to include the files rather than \input
.
I noticed also that there is a need to reset RefTex
every time I try to add a new file. I will try also to check \cite
and whether it is updated in the new scheme. I will also keep using the init.el
that you sent... again thanks a lot Jon and I do appreciate this feedback and resolution very much...
user33833 = mosalem2003
?init.el
file I included in my answer below: I only included it to show that the answer will even work with your originalinit
file (myinit.el
is identical except for all thepredictive
stuff, which I don't have on my computer). One other point, if my answer resolved the problem in your opinion, you should click on the checkmark beside the answer to mark it as 'resolved'; you can additionally 'upvote' it if you like, but marking the problem as solved gets this question off the unanswered list.