[OS X TeX] Autocompletion with \includes
Charilaos Skiadas
cskiadas at iwu.edu
Thu Jul 13 02:36:10 CEST 2006
On Jul 12, 2006, at 6:34 PM, Adam Maxwell wrote:
> There are a number of issues with this; it would involve parsing
> the master file to find the included files, determining the
> encoding to use (guesswork), and then parsing each included file to
> find the \label commands. This is doable, but it would only work
> in the master file, and is likely to be really slow.
This is exactly what we do in TextMate. There is an environment
variable, individually defined for each “project”, called
TM_LATEX_MASTER, that points to the master file, and a “simple” ruby
script that goes through all the \include'd and \input'ed files, and
picks out all the \label's out of there and prints them as a flat
list, or optionally filters with respect to an initial segment of the
word, for instance it could find all labels starting with “eqn:”.
The script can be found here:
http://macromates.com/svn/Bundles/trunk/Support/bin/
LatexLabelCompletions.rb
We use some wrappers around it, but that's where the hard work is
being done. It currently uses some environment variables that have to
do with with TextMate, but it can probably be modified for other
purposes.
Not sure how easy it would be to incorporate it into TeXShop, if at
all possible.
In terms of speed, it is not lightning fast, but it is reasonably
quick to respond, definitely under a second, on my thesis which is 50
pages and has 8 different included files. It definitely beats looking
for the label in some other way.
It does not however deal with encoding issues at all, so I don't know
if there are cases where it will break, or how to modify it to make
it work. I've never had to deal with encoding issues on my files.
> I think the iTeXMac2 wrapper structure could go a long ways towards
> solving this problem, since it maintains a property list of all
> files associated with a given project (and presumably their encoding).
>
> Adam
Haris
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
More information about the macostex-archives
mailing list