Hi all-
Here is a first attempt to make a slightly RefTeX-esque citation command. I worked it up to fit my writing style a little more: It's not bound to the cite context, so you invoke it after typing, say, a last name or a word from a title. It will prompt for any of a set of citation formats (many of which will require natbib to typeset), and then complete the cite with the existing cite completion command. Output is as a snippet so you can tab through to add page numbers or additional citekeys (invoke it again while within a cite command, and it will skip the format selection and prompt for another citekey match -- though that breaks the ability to tab out of the cite command). I like it.
It's a quick hackup, and improvements/suggestions are welcome --- but it scratches an itch, for now. I'd like to have a default of \cite, for example, so you can invoke it and just hit enter to move right past the format selection and on to citekey completion.
Cheers- -Alan
Simply outstanding! This is the best citation chooser ever (better than RefTeX, don't be modest).
That's it. With TextMate we shall have in a few months the perfect TeX machine (we still miss a flexible pdf viewer, although PDFView.app seems on the right track).
I get an error:
Applications/TextMate.app/Contents/SharedSupport/Support/bin/ LatexCitekeys.rb:157: command not found: kpsewhich -show-path=tex /Applications/TextMate.app/Contents/SharedSupport/Support/bin/ LatexCitekeys.rb:157: command not found: kpsewhich -show-path=bib
That's funny since my tex installation is quite complete and standard. Any ideas before I start to look deeper? Piero
On Nov 23, 2006, at 2:05 PM, Piero D'Ancona wrote:
http://article.gmane.org/gmane.editors.textmate.general/15649
Haris
Charilaos Skiadas <skiadas@...> writes:
Thanks Haris. Now everything works perfectly.
Quick summary: I missed the file ~/.MacOSX/environment.plist This file is used by GUI applications (like TextMate) to find the path to command line commands, e.g. TeX commands etc
Haris: you need to log-out log-in before the file is read and TextMate uses it.
On Nov 23, 2006, at 18:56, Charilaos Skiadas wrote:
Actually, I was using the opt-esc one...ah, I see now. The kpsewhich error only shows up after I select an entry from the list an insert it; presumably it populates the list from the \bibliography{} command. I thought the path setting prevented the list from showing up in an earlier test, so that's my mistake.
-- Adam
On Nov 23, 2006, at 10:28 PM, Adam R. Maxwell wrote:
No, the path setting comes up because I use kpsewhich to locate all the places where the included tex/bib files could possibly be. Usually though they are sitting right next to the tex file anyway, and I explicitly add the location of the current file in the path. So the files are typically found, but the message is there because the call to kpsewhich failed.
-- Adam
Haris
On Nov 23, 2006, at 20:39, Charilaos Skiadas wrote:
Out of curiosity, why -show-path=tex? Just to search for \bibliography commands in those .tex files? I never put .tex/.bib files in the kpsewhich search path, so I don't know precisely how to use them.
For my own amusement, I wrote an Obj-C program that reproduces most of the behavior of LatexCitekeys.rb (I think), and tells BibDesk to open the files if necessary before asking it for completion terms.
It uses a login shell to optionally run kpsewhich and get paths from it, so it works correctly for me even if I run the program from a shell with $PATH="" (and no $PATH in environment.plist). I was surprised at the number of .bib files it found, actually.
-- Adam
On Nov 25, 2006, at 7:18 PM, Adam R. Maxwell wrote:
My script travels into all \include'd files, looking for \bibliography entries there as well. That's where the -show-path=tex is being used, to locate the file based on its name in \include{...}.
Cool! Perhaps we can use it to replace the "current" Bibdesk completion command in the bundle, so that users have two options when it comes to completion?
Haris
On Nov 25, 2006, at 20:43, Charilaos Skiadas wrote:
Hmm. The -show-path-tex returns a bunch of system paths on my machine that don't seem terribly relevant. I'm not a TeX-pert, though.
I'm currently passing $TM_LATEX_MASTER and $TM_FILEPATH as .tex files, and finding \include and \input arguments from those (and any files they include). This is of course more painful with potentially relative filenames and lack of path extension, as you know.
That would be fine with me, if there's interest; your default completion works great, but I'm admittedly biased towards BibDesk :). The code needs some refactoring before I post it for public humiliation, but there's a binary and modified .tmCommand at <http://homepage.mac.com/amaxwell/.Public/Completion.zip
. Run the command with -h for a usage summary (requires a recent
nightly build of BibDesk with the Distributed Objects interface).
And to keep this thread on-topic, I modifed Alan's excellent reftex- ish command to work with BibDesk, and am really happy with it; that is the coolest cite interface I've used!
-- Adam
On Nov 23, 2006, at 12:05 PM, Piero D'Ancona wrote:
Simply outstanding! This is the best citation chooser ever (better than RefTeX, don't be modest).
It's really just an add-on to the already-good citekey completion -- shoulders of giants and all. And I'm pretty sure RefTeX is still a whole lot smarter than I am, but I'm glad you like it.
-Alan