Hi there,

I would like to know if there is a way to
(1) set a master file (Master.tex) which includes other files (\input, \subfiles, \include or any other) with relative paths (2) those other files (header.tex, File1.tex, File2.tex...) have labels (as in \label{fig:NicePicture}) (3) set a cross-reference between those labels (File1.tex has \label{fig:NicePicture} somewhere, and File2.tex has \cref{fig:NicePicture}) (4) set a bunch of styles (\usepackage, \newcommand, etc.) in one of the external files (header.tex, for instance)
(5) use RefTeX to create those cross-references.

Say, something like this:
|-Master.tex
|-preamble.tex
|-File1.tex
|-File2.tex

But sometimes, I want to see how File2.tex looks like as a PDF before compiling the whole thing. So, I set \usepackage{subfiles} in preamble.tex and load it at the top of Master.tex with \input{preamble.tex}. This loads all my \newcommand, styles and package options when I run pdflatex. However, I am unable to use RefTeX between File1.tex and File2.tex. I have set the %%% TeX-master: "Methods" at the bottom of File1.tex and File2.tex. In case that someone is willing to help me out, I am adding the relevant sections of my .emacs. Thank you very much!

-------------------------------------------------

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features! 15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  
;;; emacs --- Initial configuration for emacs
;;; Comentary: This file is loaded everytime you run emacs
;; and helps to configure your settings
;;
(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.
 '(LaTeX-amsmath-label "eq:")
 '(LaTeX-clean-intermediate-suffixes
   (quote
    ("\\.aux" "\\.bbl" "\\.blg" "\\.brf" "\\.fot" "\\.glo" "\\.gls" "\\.idx" 
"\\.ilg" "\\.ind" "\\.lof" "\\.log" "\\.lot" "\\.nav" "\\.out" "\\.snm" 
"\\.toc" "\\.url" "\\.synctex\\.gz" "\\.bcf" "\\.run\\.xml" "\\.fls" 
"-blx\\.bib" "\\.mxp" "\\.mac" "\\.mxx" "-inc\\.eps" "\\.sta")))
 '(LaTeX-default-author "e-Dgar")
 '(LaTeX-default-environment "align")
 '(LaTeX-indent-environment-list
   (quote
    (("multlined")
     ("multline")
     ("tabularx" LaTeX-indent-tabular)
     ("gnuplot")
     ("maximacmd")
     ("dgroup")
     ("dmath")
     ("verbatim" current-indentation)
     ("verbatim*" current-indentation)
     ("tabular" LaTeX-indent-tabular)
     ("tabular*" LaTeX-indent-tabular)
     ("align" LaTeX-indent-tabular)
     ("align*" LaTeX-indent-tabular)
     ("array" LaTeX-indent-tabular)
     ("eqnarray" LaTeX-indent-tabular)
     ("eqnarray*" LaTeX-indent-tabular)
     ("displaymath")
     ("equation")
     ("equation*")
     ("picture")
     ("tabbing")
     ("table")
     ("table*"))))
 '(LaTeX-label-alist
   (quote
    (("multline" . "")
     ("dgroup" . "LaTeX-eqnarray-label")
     ("dmath" . "LaTeX-eqnarray-label")
     ("figure" . LaTeX-figure-label)
     ("table" . LaTeX-table-label)
     ("figure*" . LaTeX-figure-label)
     ("table*" . LaTeX-table-label)
     ("equation" . LaTeX-equation-label)
     ("eqnarray" . LaTeX-eqnarray-label))))
 '(LaTeX-verbatim-environments (quote ("verbatim" "verbatim*" "maximacmd")))
 '(TeX-command-list
   (quote
    (("TeX" "%(PDF)%(tex) %(file-line-error) %(extraopts) 
%`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil
      (plain-tex-mode texinfo-mode ams-tex-mode)
      :help "Run plain TeX")
     ("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil
      (latex-mode doctex-mode)
      :help "Run LaTeX")
     ("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil
      (texinfo-mode)
      :help "Run Makeinfo with Info output")
     ("Makeinfo HTML" "makeinfo %(extraopts) --html %t" TeX-run-compile nil
      (texinfo-mode)
      :help "Run Makeinfo with HTML output")
     ("AmSTeX" "amstex %(PDFout) %(extraopts) %`%S%(mode)%' %t" TeX-run-TeX nil
      (ams-tex-mode)
      :help "Run AMSTeX")
     ("ConTeXt" "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t" 
TeX-run-TeX nil
      (context-mode)
      :help "Run ConTeXt once")
     ("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t" TeX-run-TeX nil
      (context-mode)
      :help "Run ConTeXt until completion")
     ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX")
     ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
     ("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer")
     ("Print" "%p" TeX-run-command t t :help "Print the file")
     ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" 
:visible TeX-queue-command)
     ("File" "%(o?)dvips %d -o %f " TeX-run-dvips t t :help "Generate 
PostScript file")
     ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil t :help "Convert DVI 
file to PostScript")
     ("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil t :help "Convert PostScript file 
to PDF")
     ("Index" "makeindex %s" TeX-run-index nil t :help "Run makeindex to create 
index file")
     ("Xindy" "texindy %s" TeX-run-command nil t :help "Run xindy to create 
index file")
     ("Check" "lacheck %s" TeX-run-compile nil
      (latex-mode)
      :help "Check LaTeX file for correctness")
     ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil
      (latex-mode)
      :help "Check LaTeX file for common mistakes")
     ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help 
"Spell-check the document")
     ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated 
intermediate files")
     ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete 
generated intermediate and output files")
     ("Limpia para VCS" "rm -fr 
*.{gnp,bbl,blg,mxx,mxp,aux,log,ps,eps,upa,upbout} *-inc.eps 
*-eps-converted-to.pdf ../../Figures/*-eps-converted-to.pdf _region_* prv_*" 
TeX-run-command nil t)
     ("Other" "" TeX-run-command t t :help "Run an arbitrary command"))))
 '(TeX-debug-warnings t)
 '(TeX-expand-list (quote (("%raw" (find-file-other-window file)))))
 '(TeX-fold-unfold-around-mark nil)
 '(TeX-shell "/bin/bash")
 '(TeX-view-program-list (quote (("MuPDF" ("mupdf \"%o\"") nil))))
 '(TeX-view-program-selection
   (quote
    (((output-dvi has-no-display-manager)
      "dvi2tty")
     ((output-dvi style-pstricks)
      "dvips and gv")
     (output-dvi "xdvi")
     (output-pdf "MuPDF")
     (output-html "xdg-open"))))
 '(font-latex-math-environments
   (quote
    ("align" "alignat" "dcases" "display" "displaymath" "dgroup" "dmath" 
"equation" "eqnarray" "flalign" "gather" "math" "multlined" "multline" "split" 
"xalignat" "xxalignat")))
 '(latex-run-command "latex")
 '(predictive-latex-electric-environments t)
 '(safe-local-variable-values (quote ((TeX-command-extra-options . 
"-shell-escape"))))
 '(TeX-error-description-warning ((t (:foreground "brown" :weight bold))))
 '(font-latex-doctex-documentation-face ((t (:background "rosy brown"))))
 )

;; ********** LaTeX **********
(require 'reftex)
;; EmacsWiki AUCTeX
(setq TeX-auto-save t) ; Enable parse on save
(setq TeX-parse-self t) ; Enable parse on load
(setq-default TeX-master nil)

(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)

(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)

;; EmacsWiki LaTeX
(add-hook 'reftex-load-hook 'imenu-add-menubar-index)
(add-hook 'reftex-mode-hook 'imenu-add-menubar-index)

;; ;; To make sure that emaxima.el is loaded when necessary
;; ;; EMaximaIntro.ps
;; (autoload 'emaxima-mode "emaxima" "EMaxima" t)
;; (add-hook 'emaxima-mode-hook 'yas-minor-mode)

;; (add-hook 'LaTeX-mode-hook 'emaxima-mode)

;; ( add-hook 'LaTeX-mode-hook
;;         (lambda ()
;;           (when (y-or-n-p "EMaxima? ")
;;             (emaxima-mode))))

;; Fold code C-c C-o C-o
(add-hook 'LaTeX-mode-hook (lambda ()
                             (TeX-fold-mode 1)))
;; (add-hook 'LaTeX-mode-hook 'folding-mode)

;; To compile documents to PDF (pdflatex)
(setq TeX-PDF-mode 1)

;; Break long lines
(add-hook 'LaTeX-mode-hook 'auto-fill-mode)
;; (add-hook 'emaxima-mode-hook 'auto-fill-mode)

;; LaTeX Preview
;; (load "preview.el" nil t t)

;; Keep old preview visible when editing
(defadvice preview-inactive-string (around preview-show-old nil activate)
  "Show old preview when editing source code."
  (when (overlay-get ov 'preview-state)
    (let ((preview-icon (or (car-safe (overlay-get ov 'preview-image)) 
preview-icon)))
      (overlay-put ov 'preview-old-image preview-icon)
      ad-do-it
      )))
;;
(defadvice preview-disabled-string (around preview-show-old nil activate)
  "Show old preview when editing source code."
  (when (overlay-get ov 'preview-state)
    (let ((preview-icon (or (overlay-get ov 'preview-old-image) preview-icon)))
      ad-do-it
      )))

;; Activate YASnippet with LaTeX
(yas-global-mode 1)
(add-hook 'LaTeX-mode-hook 'yas-minor-mode)
;; (add-hook 'emaxima-mode-hook 'yas-minor-mode)
;; allow to insert a snippet within a snippet
(setq yas-triggers-in-field t)
_______________________________________________
auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex

Reply via email to