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:
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
http://article.gmane.org/gmane.editors.textmate.general/15649
That's funny since my tex installation is quite complete and standard. Any ideas before I start to look deeper? Piero
Haris
Charilaos Skiadas <skiadas@...> writes:
http://article.gmane.org/gmane.editors.textmate.general/15649
That's funny since my tex installation is quite complete and standard. Any ideas before I start to look deeper?
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 11:50, Piero D'Ancona wrote:
Charilaos Skiadas <skiadas@...> writes:
http://article.gmane.org/gmane.editors.textmate.general/15649
That's funny since my tex installation is quite complete and standard. Any ideas before I start to look deeper?
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
Can't this also be fixed by uncommenting . "$TM_SUPPORT_PATH/lib/ bash_init.sh" in LatexCiteCompletions.sh? It seemed to work on my system (I prefer not to edit environment.plist).
Adam
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
Can't this also be fixed by uncommenting . "$TM_SUPPORT_PATH/lib/ bash_init.sh" in LatexCiteCompletions.sh? It seemed to work on my system (I prefer not to edit environment.plist).
Does not work here. I moved the environment.plist file and uncommented $TM_SUPPORT_PATH/lib/bash_init.sh in LatexCiteCompletions.sh, and I get the same error as before. Adam: maybe you have an environment.plist file after all?
On Nov 23, 2006, at 3:06 PM, Adam R. Maxwell wrote:
Can't this also be fixed by uncommenting . "$TM_SUPPORT_PATH/lib/ bash_init.sh" in LatexCiteCompletions.sh? It seemed to work on my system (I prefer not to edit environment.plist).
No the problem is not with LatexCiteCompletions.sh. That's the one used when pressing esc. The problem here is with pressing opt-esc, which doesn't use that file. Otherwise that would indeed do it.
Adam
Haris
On Nov 23, 2006, at 18:56, Charilaos Skiadas wrote:
On Nov 23, 2006, at 3:06 PM, Adam R. Maxwell wrote:
Can't this also be fixed by uncommenting . "$TM_SUPPORT_PATH/lib/ bash_init.sh" in LatexCiteCompletions.sh? It seemed to work on my system (I prefer not to edit environment.plist).
No the problem is not with LatexCiteCompletions.sh. That's the one used when pressing esc. The problem here is with pressing opt-esc, which doesn't use that file. Otherwise that would indeed do it.
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:
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.
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 19:56, Charilaos Skiadas wrote:
On Nov 23, 2006, at 10:28 PM, Adam R. Maxwell 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.
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.
Yeah, I see. I'd like to figure out how to get the list of bib file paths you're using and pass them to my BibDesk completion program :).
Adam
On Nov 23, 2006, at 11:13 PM, Adam R. Maxwell wrote:
Yeah, I see. I'd like to figure out how to get the list of bib file paths you're using and pass them to my BibDesk completion program :).
All the hard work is in LatexCitekeys.rb. Basically, I ask TeX to tell me:
kpsewhich -show-path=bib kpsewhich -show-path=tex
Adam
Haris
On Nov 23, 2006, at 20:39, Charilaos Skiadas wrote:
On Nov 23, 2006, at 11:13 PM, Adam R. Maxwell wrote:
Yeah, I see. I'd like to figure out how to get the list of bib file paths you're using and pass them to my BibDesk completion program :).
All the hard work is in LatexCitekeys.rb. Basically, I ask TeX to tell me:
kpsewhich -show-path=bib kpsewhich -show-path=tex
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:
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.
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{...}.
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.
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?
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
Haris
On Nov 25, 2006, at 20:43, Charilaos Skiadas wrote:
On Nov 25, 2006, at 7:18 PM, Adam R. Maxwell 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.
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{...}.
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.
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.
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?
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
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.
P.S. That's right. Allan: wouldn't it be convenient if in the case of multiple choices the topmost item of the list would be automatically selected? so that hitting enter selects the first item (and one can always scroll down for other choices)