[OS X TeX] Autocompletion with \includes
Adam Maxwell
amaxwell at mac.com
Wed Jul 12 21:00:04 EDT 2006
On Wednesday, July 12, 2006, at 05:36PM, Charilaos Skiadas <cskiadas at iwu.edu> wrote:
>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 BibDesk plugin works at the NSTextView level, so it has no way to track files per-project; this is a front end task. As far as that goes, it has no way of determining the path to the currently loaded file; I only added the \label autocomplete as a bonus feature, though, so I'm not too concerned, frankly. The main focus is the \cite completion, and our support for that is pretty good, I think, including natbib/jurabib detection.
If Cocoa front end developers are interested in collaborating on autocomplete that would work with BibDesk, I'd be happy to stop supporting our plugin, since the input manager is a nasty hack that really belongs in an application. They could then add proper multi-file \ref autocomplete.
>The script can be found here:
>http://macromates.com/svn/Bundles/trunk/Support/bin/
>LatexLabelCompletions.rb
I get an authentication dialog at this link; can you post it somewhere accessible?
>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.
We've had to deal with lots of encoding issues with BibDesk over the years. Since TeX commands are limited to ASCII, you're likely not going to have much of a problem to just grab \labels.
Adam
------------------------- 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 MacOSX-TeX
mailing list