Hey all, sorry for the mass email. If you are not using the LaTeX bundle, you can safely ignore the rest.
I am currently working on the various completion commands in the latex bundle, and I am considering dropping bibdesk support in the completion commands in the following way: Instead of asking bibdesk for the completion list, I have a command read that does the following: It collects a list of bib files from the following locations: 1. the files pointed to by the environment (or project specific) variable TM_LATEX_BIB, space separated (use quotes if the filename contains spaces). 2. If either the file pointed to by the variable TM_LATEX_MASTER, or the current document (if saved), or both, contain any text of the form \bibliography{bibfile}, it adds this bibfile to the list of bib files to examine.
It scans all these bib files for the cite keys, and uses those for completion. It will look for titles for the pop-up menu. So there will be (actually there already are) two commands, one that works with Esc (normal completion) and one that brings up a pop-up of possible completions.
The above will be faster than calling Bibdesk through applescript. And you can of course still create citations by dragging them items from Bibdesk and dropping them in textmate. The main question is whether calling Bibdesk has any advantages compared to the approach I outlined above, and whether the approach above misses something. Your feedback would be much appreciated.
Haris
Haris-
The new method for completing BibTeX keys sounds reasonable to me. I don't think has disadvantages, unless BibDesk is able to return a search on more fields (sometimes I forget an author and have to search by keyword -- though I don't think either completion method offers this now, so I have to switch over to BibDesk anyway). And this change won't affect the ability to use BibDesk's own completion service. Seems like a good idea, off the top of my head.
One question: if multiple bib files are specified, ie via \bibliography{bib1,bib2,bib3}, I assume your script will get and search all of them?
-Alan
Hi,
I can't see any disadvantage to your new approach - but why not keeping the old and the new completion commands for some time (just to be able to see whether there are hidden advantages to the Bibdesk approach)
Christof
Am 26. Jan 2006 um 01:42 schrieb Charilaos Skiadas:
Hey all, sorry for the mass email. If you are not using the LaTeX bundle, you can safely ignore the rest.
I am currently working on the various completion commands in the latex bundle, and I am considering dropping bibdesk support in the completion commands in the following way: Instead of asking bibdesk for the completion list, I have a command read that does the following: It collects a list of bib files from the following locations:
- the files pointed to by the environment (or project specific)
variable TM_LATEX_BIB, space separated (use quotes if the filename contains spaces). 2. If either the file pointed to by the variable TM_LATEX_MASTER, or the current document (if saved), or both, contain any text of the form \bibliography{bibfile}, it adds this bibfile to the list of bib files to examine.
It scans all these bib files for the cite keys, and uses those for completion. It will look for titles for the pop-up menu. So there will be (actually there already are) two commands, one that works with Esc (normal completion) and one that brings up a pop-up of possible completions.
The above will be faster than calling Bibdesk through applescript. And you can of course still create citations by dragging them items from Bibdesk and dropping them in textmate. The main question is whether calling Bibdesk has any advantages compared to the approach I outlined above, and whether the approach above misses something. Your feedback would be much appreciated.
Haris
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
I am currently working on the various completion commands in the latex bundle, and I am considering dropping bibdesk support in the completion commands in the following way: Instead of asking bibdesk for the completion list, I have a command read that does the following: It collects a list of bib files from the following locations:
- the files pointed to by the environment (or project specific)
variable TM_LATEX_BIB, space separated (use quotes if the filename contains spaces).
So what do I write into the value field of the TM_LATEX_BIB variable? Do I need to write in the path or only the file name?
- If either the file pointed to by the variable TM_LATEX_MASTER,
or the current document (if saved), or both, contain any text of the form \bibliography{bibfile}, it adds this bibfile to the list of bib files to examine.
It scans all these bib files for the cite keys, and uses those for completion. It will look for titles for the pop-up menu. So there will be (actually there already are) two commands, one that works with Esc (normal completion) and one that brings up a pop-up of possible completions.
Will this also work, if I use "footcite" for citing? And what would the shortcut be for this way of completion? The same as before (Cmd- Esc)?
The main question is whether calling Bibdesk has any advantages compared to the approach I outlined above, and whether the approach above misses something. Your feedback would be much appreciated.
I'm no expert for Bibdesk at all, so I can't give any valuable opinion. All in all, this sounds very promising to me (no need for Bibdesk to be opened, faster, etc.).
Thanks for your work on the LaTeX bundle!! Oliver
On Jan 26, 2006, at 2:15 AM, Oliver Hagmann wrote:
So what do I write into the value field of the TM_LATEX_BIB variable? Do I need to write in the path or only the file name?
At this point, it needs the full path to the bib file. I wonder if the script could use the same method that bibtex uses (kpsewhich?) to find the file. That doesn't seem necessary when using TM_LATEX_BIB, because that's a variable specific to OSX/TextMate -- so no cross- platform worries there. But, needing to specify the full path when using a \bibliography{} command is potentially something that could break cross-platform compatibility of the .tex file itself, or would pose problems if one were to move the local texmf tree for some reason. I'm not entirely familiar with how the innards of that file- finding actually work, but eventually being able to search the texmf tree would probably be a good way to go about it.
Will this also work, if I use "footcite" for citing? And what would the shortcut be for this way of completion? The same as before (Cmd- Esc)?
I think only \cite works right now, but it would be ideal if we could complete footcite as well as the cite commands from natbib (citet, citep, citeyear, etc).
-Alan
On Jan 26, 2006, at 10:25 AM, Alan Schussman wrote:
So what do I write into the value field of the TM_LATEX_BIB variable? Do I need to write in the path or only the file name?
At this point, it needs the full path to the bib file. I wonder if the script could use the same method that bibtex uses (kpsewhich?) to find the file. That doesn't seem necessary when using TM_LATEX_BIB, because that's a variable specific to OSX/TextMate -- so no cross-platform worries there. But, needing to specify the full path when using a \bibliography{}
in the \bibliography{} thing you should not have to specify the full path, only the relative path, relative to the directory of the current file, and you shouldn't even need to put the .bib at the end. TM_LATEX_BIB needs the full path.
command is potentially something that could break cross-platform compatibility of the .tex file itself, or would pose problems if one were to move the local texmf tree for some reason. I'm not entirely familiar with how the innards of that file-finding actually work, but eventually being able to search the texmf tree would probably be a good way to go about it.
That is true, but it is a bit more elaborate than what I want to go into right now. I guess I keep my bib file near the corresponding tex file. Where do other people keep their bib files? I could try to come up with a better search, but I don't really know where I should be looking.
Will this also work, if I use "footcite" for citing? And what would the shortcut be for this way of completion? The same as before (Cmd-Esc)?
I think only \cite works right now, but it would be ideal if we could complete footcite as well as the cite commands from natbib (citet, citep, citeyear, etc).
This is just a question of adding \footcite to the list of commands that give you the scope meta.cite.latex. I just wasn't aware of it. I'll add it later today when I update things.
This is still a work in progress, so thank you all for your patience and feedback.
Let me mention here as well the extra new completion commands, that work by pressing escape, when the scope is either labels or bibliography respectively. In order to run those, you need to do and svn update on the global Support directory, which should reside under ~/Library/Application Support/TextMate/Support There are three new files in the bin subfolder of that, whose names start with "Latex".
Btw, the BibDesk completion command will not be deleted, just "deprecated" in the sense that a new bibliography completion command will be constructed, and I personally will work mostly on that one, apart from fixing the problems I am currently aware of with the bibDesk one (thanks Attilio). Anyone with shell scripting knowledge is welcome to improve on it.
@Christian: I'd rather not use the .aux file, since it is not always up to date. I might however try to make the script look at all \include{}'s also.
Haris
On Jan 26, 2006, at 11:26 AM, Charilaos Skiadas wrote:
command is potentially something that could break cross-platform compatibility of the .tex file itself, or would pose problems if one were to move the local texmf tree for some reason. I'm not entirely familiar with how the innards of that file-finding actually work, but eventually being able to search the texmf tree would probably be a good way to go about it.
That is true, but it is a bit more elaborate than what I want to go into right now. I guess I keep my bib file near the corresponding tex file. Where do other people keep their bib files? I could try to come up with a better search, but I don't really know where I should be looking.
I agree that it's pretty elaborate and that relative paths ought to do the trick and will work across platforms -- assuming one's directory structure matches on the two platforms. My bib files are all in my local texmf tree: ~/Library/texmf/bibtex/bib/. Latex and bibtex have some behind-the-scenes settings that direct them to find that tree. I think this is where kpsewhich comes into play, as do the optional environment variables of BIBINPUTS and TEXINPUTS.
-Alan
Dear Haris
I am currently working on the various completion commands in the latex bundle, and I am considering dropping bibdesk support in the completion commands in the following way: Instead of asking bibdesk for the completion list, I have a command read that does the following: It collects a list of bib files from the following locations:
- the files pointed to by the environment (or project specific)
variable TM_LATEX_BIB, space separated (use quotes if the filename contains spaces). 2. If either the file pointed to by the variable TM_LATEX_MASTER, or the current document (if saved), or both, contain any text of the form \bibliography{bibfile}, it adds this bibfile to the list of bib files to examine.
It scans all these bib files for the cite keys, and uses those for completion. It will look for titles for the pop-up menu. So there will be (actually there already are) two commands, one that works with Esc (normal completion) and one that brings up a pop-up of possible completions.
Having a brief look at the .aux file generated by the LaTeX compilation it seems that all the aux file contains a list of all bibliography (.bib) files, that have been used (look for \bibdata in the aux file). You may also consider this information, which will presumably also work, if the bibliography was not specified in the main file, but in some included file.
A suggestion: You may also want to have a look at Emacs reftex mode, which provides also a nice lookup in BibTeX files (see attached screenshot). Reftex allows you to search the BibTeX files for a regular expression (for the screenshot I searched for my last name) and then presents a handy list of all publications matching this regular expression.
Best regards, Christian
-- Christian Plessl http://www.tik.ee.ethz.ch/~plessl Computer Engineering and Networks Lab, ETH Zurich, Switzerland
It seems that the mailing list has removed the attached screenshot. So I have uploaded the screenshot to the following URL: http://www.tik.ee.ethz.ch/~plessl/static/reftex.png
Best regards, Christian
On 26.01.2006, at 10:27 Uhr, Plessl Christian wrote:
Dear Haris
I am currently working on the various completion commands in the latex bundle, and I am considering dropping bibdesk support in the completion commands in the following way: Instead of asking bibdesk for the completion list, I have a command read that does the following: [snipp]
A suggestion: You may also want to have a look at Emacs reftex mode, which provides also a nice lookup in BibTeX files (see attached screenshot). Reftex allows you to search the BibTeX files for a regular expression (for the screenshot I searched for my last name) and then presents a handy list of all publications matching this regular expression.
-- Christian Plessl http://www.tik.ee.ethz.ch/~plessl Computer Engineering and Networks Lab, ETH Zurich, Switzerland
There is now a second completion command, called "Bibliography command", which searches for bib files recursively in all files included in the current file and in TM_LATEX_MASTER, searching for the files in the same paths tex and bibtex use to locate those files. It has not had much testing, but I hope you will all give it a try and tell me of any problems you have with it. In order to run it, you will need files located in ~/Library/Application Support/TextMate/ Support/bin, so you will need to svn up that folder also if you want to give it a try.
The "Bibdesk completion" command will remain as is, though a number of bugs with it have now been fixed, notably it now behaves nicely when it runs into errors. Let me know if there are still problems with it.
Also, the syntax has been enhanced a bit with minimal support for koma-script sectioning commands, as well as a couple more \cite variants.
On Jan 26, 2006, at 3:27 AM, Plessl Christian wrote:
A suggestion: You may also want to have a look at Emacs reftex mode, which provides also a nice lookup in BibTeX files (see attached screenshot). Reftex allows you to search the BibTeX files for a regular expression (for the screenshot I searched for my last name) and then presents a handy list of all publications matching this regular expression.
This looks interesting, though I am not sure how the interface would be. We have very limited tools when it comes to interface. Maybe some time in the future.
Best regards, Christian
Haris
On 27.01.2006, at 08:51, Charilaos Skiadas wrote:
There is now a second completion command, called "Bibliography command", which searches for bib files recursively in all files included in the current file and in TM_LATEX_MASTER, searching for the files in the same paths tex and bibtex use to locate those files. It has not had much testing, but I hope you will all give it a try and tell me of any problems you have with it. In order to run it, you will need files located in ~/Library/Application Support/TextMate/Support/bin, so you will need to svn up that folder also if you want to give it a try.
Since one of the latest revisions (I'm currently on rev2629), the Bibliography command stopped working for me. When I type option-esc the current word gets highlighted but nothing else happens. no popup appearing.
Also, the syntax has been enhanced a bit with minimal support for koma-script sectioning commands, as well as a couple more \cite variants.
Thanks for adding those!
Is it possible to set the shortcut for "Insert Command Based on Current Word" and "Insert Environment Based on Current Word" to another shortcut than cmd-{ ? I couldn't find out how to type it on my swiss keyboard, which is basically a slightly modified german layout. I can type { with option-8, but as soon as I combine it with cmd, nothing happens. I know I could just assign another shortcut for myself but since I assume that I'm not the only TM user with a german keyboard, it would be nice if this worked out of the box.
Cheers. Oliver
On Jan 30, 2006, at 8:23 AM, Oliver Hagmann wrote:
On 27.01.2006, at 08:51, Charilaos Skiadas wrote:
Since one of the latest revisions (I'm currently on rev2629), the Bibliography command stopped working for me. When I type option-esc the current word gets highlighted but nothing else happens. no popup appearing.
Hm, it should work at this point. Ok, do the following please: First, make sure you have updated both the Latex bundle and the global support directory in Application Support/TextMate/Support. Then open the bundle editor and change the text of the bibliography completion command to say "exit" wherever it currently says "exit_discard". This will print for us some errors we could do something with. Run the command again and let me know what those errors are. Also, tell me the structure of your file directory, and where the bibliography file you are trying to access is on your computer, and why do you expect the program to find it (is it a \bibliography entry in the current file, or in TM_LATEX_MASTER, is it pointed to by TM_LATEX_BIB?)
Also please send the output produced if from the command line you run: kpsewhich -show-path=bib
Then we'll take it from there.
Is it possible to set the shortcut for "Insert Command Based on Current Word" and "Insert Environment Based on Current Word" to another shortcut than cmd-{ ? I couldn't find out how to type it on my swiss keyboard, which is basically a slightly modified german layout. I can type { with option-8, but as soon as I combine it with cmd, nothing happens. I know I could just assign another shortcut for myself but since I assume that I'm not the only TM user with a german keyboard, it would be nice if this worked out of the box.
This was chosen after some discussion, and it is supposed to be indicative of what the command does, same as the shift-ctrl-< shortcut for tags in HTML. I am not entirely happy with it either, but we couldn't think of a good global alternative that would work well for people. Suggestions are welcome of course.
Cheers. Oliver
Haris
On 30.01.2006, at 15:46, Charilaos Skiadas wrote:
On Jan 30, 2006, at 8:23 AM, Oliver Hagmann wrote:
On 27.01.2006, at 08:51, Charilaos Skiadas wrote:
Since one of the latest revisions (I'm currently on rev2629), the Bibliography command stopped working for me. When I type option- esc the current word gets highlighted but nothing else happens. no popup appearing.
Hm, it should work at this point. Ok, do the following please: First, make sure you have updated both the Latex bundle and the global support directory in Application Support/TextMate/Support.
done. i'm on rev2630 now.
Then open the bundle editor and change the text of the bibliography completion command to say "exit" wherever it currently says "exit_discard". This will print for us some errors we could do something with. Run the command again and let me know what those errors are.
here's what I get:
\footcite[]{/Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:125:in `+': cannot convert nil into String (TypeError) from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:125 from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:117:in `parsefile' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:117 from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:116:in `recursiveFileSearch' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:76:in `open' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:76:in `recursiveFileSearch' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:70:in `each' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:70:in `recursiveFileSearch' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:68:in `each' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:68:in `recursiveFileSearch' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:62:in `each' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:62:in `recursiveFileSearch' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:61:in `open' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:61:in `recursiveFileSearch' from /Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:116 }
Also, tell me the structure of your file directory, and where the bibliography file you are trying to access is on your computer, and why do you expect the program to find it (is it a \bibliography entry in the current file, or in TM_LATEX_MASTER, is it pointed to by TM_LATEX_BIB?)
The .tex file is in ~/Documents/SomeDirectories/.../file.tex
My bibliography file is in /Users/oliver/Documents/ bibliographie.bib . I have TM_LATEX_BIB to this path as a shell variable under my preferences since I use the same .bib file for all my LaTeX documents. Additionally, in the tex file, I have:
\bibliography{/Users/oliver/Documents/bibliographie}
I haven't set any TM_LATEX_MASTER.
Also please send the output produced if from the command line you run: kpsewhich -show-path=bib
.:/Users/oliver/Library/texmf/bibtex/bib//:!!/usr/local/teTeX/share/ texmf.local/bibtex/bib//:!!/usr/local/teTeX/share/texmf.gwtex/bibtex/ bib//:!!/usr/local/teTeX/share/texmf.tetex/bibtex/bib//:!!/usr/local/ teTeX/share/texmf/bibtex/bib//:/Users/oliver/Library/texmf/ bibtex///:!!/usr/local/teTeX/share/texmf.local/bibtex///:!!/usr/local/ teTeX/share/texmf.gwtex/bibtex///:!!/usr/local/teTeX/share/ texmf.tetex/bibtex///:!!/usr/local/teTeX/share/texmf/bibtex///
I hope it helps. Thanks. Oliver
On Wed, 25 Jan 2006, Charilaos Skiadas wrote:
The main question is whether calling Bibdesk has any advantages compared to the approach I outlined above, and whether the approach above misses something. Your feedback would be much appreciated.
Well, the one advantage it does have is that you don't have to create the bib file to get a reference from bibdesk. It's a minor thing, but often when I'm writing I end up adding a number of new references to my database, and generally doing so on the fly as I write. By calling bibdesk, I can get those new references without having to generate the bib file until I'm ready to compile the paper with the references in place.
It's not big, but it's something.
William D. Neumann
---
"There's just so many extra children, we could just feed the children to these tigers. We don't need them, we're not doing anything with them.
Tigers are noble and sleek; children are loud and messy."
-- Neko Case
Life is unfair. Kill yourself or get over it. -- Black Box Recorder
Am 26.01.2006 um 01:42 schrieb Charilaos Skiadas:
Hey all, sorry for the mass email. If you are not using the LaTeX bundle, you can safely ignore the rest.
I am currently working on the various completion commands in the latex bundle, and I am considering dropping bibdesk support in the completion commands in the following way: Instead of asking bibdesk for the completion list, I have a command read that does the following:
[...]
First let me tell me how much I appreciate your work on the LaTeX bundle! I also tremendously enjoyed your tutorial movies even though I've been using LaTeX for a few years now :-)
My bib files that were derived from EndNote seem to be slightly garbled in that they look like this
----------- @book{ Weiss, ... -----------
instead of this
----------- @book{Weiss, .... -----------
Unfortunately, only the latter form works with your new completion commands which took me a while to figure out. It might become a small PITA to have to fix all entries in my bib files by hand every time I'm going to change something in my references database. I might write myself a small macro in TextMate to do this automagically, but maybe you could adapt your commands to take those EndNote-garbled files into account?
Anyhow, thanks for the great work and keep it up!
Ciao, Thomas
Hi Thomas, On Feb 2, 2006, at 2:37 AM, Thomas Schröder wrote:
Am 26.01.2006 um 01:42 schrieb Charilaos Skiadas:
First let me tell me how much I appreciate your work on the LaTeX bundle! I also tremendously enjoyed your tutorial movies even though I've been using LaTeX for a few years now :-)
Thanks! They were a lot of fun to make.
My bib files that were derived from EndNote seem to be slightly garbled in that they look like this
Unfortunately, only the latter form works with your new completion commands which took me a while to figure out. It might become a small PITA to have to fix all entries in my bib files by hand every time I'm going to change something in my references database. I might write myself a small macro in TextMate to do this automagically, but maybe you could adapt your commands to take those EndNote-garbled files into account?
I just committed a fix for LatexCitekeys.rb in the Global Support folder, that is relatively liberal about where you put the citekey, and will understand the above format you've described, so if you svn up that folder, it should work just fine. Let me know if you still have problems with it. If you do want to bring your files to the `standard' format (nothing standard about it really, just more familiar to me), then I think just opening the file from BibDesk and the saving it would do it. At least it does so in my case.
Anyhow, thanks for the great work and keep it up!
Ciao, Thomas
Haris
Am 02.02.2006 um 15:45 schrieb Charilaos Skiadas:
I just committed a fix for LatexCitekeys.rb in the Global Support folder, that is relatively liberal about where you put the citekey, and will understand the above format you've described, so if you svn up that folder, it should work just fine.
And it does!
Let me know if you still have problems with it.
Nope, everything's fine now! Thanks a ton!
If you do want to bring your files to the `standard' format (nothing standard about it really, just more familiar to me), then I think just opening the file from BibDesk and the saving it would do it. At least it does so in my case.
It once buggered up my .bib file so that's why I'm a little conservative when it comes to saving from within BibDesk. It's probably a bug that's been fixed for ages now, but still ;-)
So, thanks again and take care!
Thomas