In order to keep doc dir clean, I keep a master file in the top level of the doc, and other files in folders:
.
├── bib
│ └── refs.bib
├── img
│ ├── img1.png
│ └── img2.png
├── tex
│ ├── part1.tex
│ ├── part2.tex
│ └── part3.tex
├── tmp
└── master.tex
I import tex files from tex with:
% include from tex/
\usepackage{import}
\def\includeFromTex#1 {\subimport{tex/}{#1.tex}\include{#1}}
Example usage:
\begingroup\let\clearpage\relax % tweak that stops include from starting with newpage
\includeFromTex{10_-_calc}
\includeFromTex{20_-_disc}
\includeFromTex{30_-_app}
\endgroup
And every file under tex/ starts with:
% -*- TeX-master: "../master.tex" -*-
This works fine with tex, but breaks reftex ability to build toc, and reference things. Is it possible to notify reftex that I keep tex files under tex/?
Edit:
Since I can't tweak reftex to do that, I moved texs to the doc dir:
.
├── bib
│ └── refs.bib
├── img
│ ├── img1.png
│ └── img2.png
├── tmp
├── 10_-_part1.tex
├── 20_-_part2.tex
├── 30_-_part3.tex
└── master.tex
Now I'm using plain \input{} for files and everything works (latex and reftex).
(BTW if one numbers the parts, the the master file will always be the last one. In this case it is possible to make it TeX-master automatically:
% -*- eval: (setq TeX-master (car (last (directory-files default-directory nil ".*\\.tex$")))) -*-
one should put this line at the top of child tex files)

\include{tex/part1}? – David Carlisle Mar 03 '15 at 10:59importinstead ofinclude. – Adobe Mar 03 '15 at 11:01reftexparser only looks at\includeand\input, so it might simply be easier to store the normal value of\includein a macro via\let\oldinclude\include, and then redefine\include. I've used that trick before to get around exactly this issue where I wanted a specialized input command, but also wantedreftexandauctexto be able to find and parse stuff. – daleif Mar 03 '15 at 12:20{10_-_calc}with{..}so why define\includeFromTexwith a delimited argument delimited by space? That allows\includeFromTex 10_-_calcbut that's not really normal latex syntax and you don't use it anyway. But as it is if you were to use\includeFromTex{10_-_calc}%things would go very wrong as the end of line is required. – David Carlisle Mar 03 '15 at 12:50\begingroup\let\clearpage\relax % tweak that stops include from starting with newpageThat is not a tweak it breaks the include system totally and you will get corrupted aux files and incorrect numbering. There is an answer about that on site somewhere. – David Carlisle Mar 03 '15 at 12:53\newcommandinstead of\def? – Adobe Mar 03 '15 at 13:39\defif you must but\def\foo#1 {....}defines the argument of\foonot to be the next{}group but to be everything up to the next space.\def\foo#1{....}would be the thing to use to define a command as\newcommandwould define it with an argument delimited by{}– David Carlisle Mar 03 '15 at 13:43