2

I tried some solutions but fail so far. I divide large data into multiple files and then include all of them in main file. I used emacs24. Here is general of my main.tex file

\include{chapter1}
\section{test} hello POS
\include{chapter2}
\include{chapter3}
\bibliographystyle{amsplain}
\bibliography{mybibliography}

In the main.tex file, i enable reftext-mode, and then ctrl+c+[, the reftex works for me and it asks me to type searched word for bibliography. However, this operation fail when i switch to the chaper1.tex buffer, the error message is:

 **byte-code: No valid bibliography in this document, and no default available**

The chaper1.tex is like:

\section{introduce}
....
\subsection{result}

Clearly, the error message shows that chapter1.tex does not contain any \bibliography{mybibliography}, which already is in main.tex.

Since i do not want add any \bibliography in my chapter1.tex, so how should i handle this error?

================================================

UPDATE: I also follow page: https://www.gnu.org/software/auctex/manual/auctex/Parsing-Files.html and tried below two solutions:

SOLUTION 1: Add these to .emacs/init.el file

(setq TeX-parse-self t) ; Enable parse on load.
(setq TeX-auto-save t) ; Enable parse on save.

OR SOLUTION 2: Add these declaration at beginning of each file

%%% Local Variables:
%%% TeX-parse-self: t
%%% TeX-auto-save: t
%%% End:

After restart emacs, enable reftex-mode in chapter1.tex, but the problem still occurs.

  • Are you using AUCTeX? If so, did you enable file parsing? – giordano Aug 5 '14 at 23:09
  • @giordano: Yes. I use AUCTEX. I have update but still fail. How to enable file parse? – shijie xu Aug 6 '14 at 1:27
  • It's described in the very first lines of the AUCTeX manual, see the sentence "If you want to make AUCTeX aware of style files and multi-file documents right away, insert the following in your .emacs file.". Guido's answer explain how to manually fix the problem for a single file, but adding those lines to your init file you'll be always automatically prompt for selecting the master file. – giordano Aug 6 '14 at 9:31
6

You can set a master file (main.tex). Thus you can include the following in all .tex files in your project.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "main"
%%% End: 

after that reflex will find the bibliography from the master (main.tex) file.

  • main and Main are two different files ;-) – giordano Aug 6 '14 at 9:31
  • Thanks @giordano. The Tex-master points to the main.tex file and then reftex works. – shijie xu Aug 6 '14 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.