auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

## [AUCTeX] extending \input macro in AucTeX

 From: Ritesh Sood Subject: [AUCTeX] extending \input macro in AucTeX Date: Fri, 3 Oct 2008 23:30:06 -0700

Hi all,

Here's a snippet from my LaTeX "master" file main.tex

--------------Begin main.tex-----------------------

\documentclass{....}

etc,. etc, ....

\newcommand{f\homedir}{/home/ritesh}

\begin{document}

% Include files from Part1/writeup
\newcommand{\rootdir}{\homedir/Part1/writeup}
\input{\rootdir/local_macros}
\input{\rootdir/introduction}
\input{\rootdir/problem_formulation}

% Include files from Part2/writeup
\renewcommand{\rootdir}{\homedir/Part2/writeup}
\input{\rootdir/solution}
\input{\rootdir/examples}

% Back to Part1/writeup
\renewcommand{\rootdir}{\homedir/Part1}
\begin{appendices}
\input{\rootdir/appendix}
\end{appendices}

\end{document}

--------------End main.tex-----------------------

As you see, I am input'ing .tex files from different directories into
my  document. LaTeX itself has no problems with this mechanism:
main.tex compiles fine. Problem is that AucTeX does not know that
\homedir and  \rootdir can be expanded, and so the many wonderful
features of multifile parsing are not available. I have taken care
that  labels resolve uniquely across the different directories. For
instance, equation labels in Part1 are of the form \label{eq:P1-10},
while those in Part2 are of the form \label{eq:P2-10}, etc. In fact,
i've gotten so used to AucTeX taking care of labels and refs that i
find myself utterly helpless when this facility is not available :(

I've read the documentation of  TeX-add-symbols, etc. and also the
section on "Hacking the Parser", but what i want to achieve goes
beyond what is documented. I have some ideas:
1) It's only two macros i'm introducing that AucTeX needs to treat as
special. As in, I'm not asking that AucTeX expand every macro that it
comes across, only these two.
2) I don't know exactly how multifile parsing works, but surely the
contents of \input{<file>} are getting read and processed. So the
definition of  \input needs to be extended so that when AucTeX comes
across  \input{\rootdir/<file>}, it internally expands \rootdir,
constructs the full path to <file> and loads the .el  associated with
<file>.

I guess it would not be too hard to accomplish the above for someone
familiar with the inner workings of AucTeX, and I'd appreciate any
help that i can get.

Thanks a lot to the developers for this wonderful package :)

Ritesh.



reply via email to

 [Prev in Thread] Current Thread [Next in Thread]
• [AUCTeX] extending \input macro in AucTeX, Ritesh Sood <=