Hi Edgar,
2016-12-26 5:14 GMT+01:00 <address@hidden>:
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.
"Methods"? Did you "Master"?
Anyway, a few hours ago was installed in AUCTeX a new patch that
should improve your workflow with this package. For example, this is
my master file:
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{subfiles,amsmath}
\begin{document}
hello world!
\begin{equation}
\label{eq:1}
a + b = c
\end{equation}
\subfile{file1.tex}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---
and this is my file1.tex file:
--8<---------------cut here---------------start------------->8---
\documentclass[master.tex]{subfiles}
\begin{document}
Equation~\eqref{eq:1}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---
Inside file1.tex, now I can insert with RefTeX a reference defined in
another file (like what I did to insert the reference to "eq:1"
label). Is this what you would like?
Bye,
Mosè