Not sure if this has anything to do with the recent update, but the bibliography completion command seems to be broken. Neither the key command nor calling it from the LaTeX bundle menu seems to work. Pretty sure that I haven't done anything to break it since I have been too busy to play with TM lately ;). Best, Mark
On Nov 22, 2006, at 12:19 PM, Mark Eli Kalderon wrote:
Not sure if this has anything to do with the recent update, but the bibliography completion command seems to be broken. Neither the key command nor calling it from the LaTeX bundle menu seems to work. Pretty sure that I haven't done anything to break it since I have been too busy to play with TM lately ;). Best, Mark
I made a change that was essential, because I was using a heuristic that was wrong. The problem is the following:
(This is a bit long an technical. If you get lost, make sure to read toward the end, for what you have to do to fix this).
The LaTeX installer needs to alter the PATH variable, by appending the correct path to the LaTeX executables, like for instance kpsewhich, which is the program used in these completion commands. The main question now is where this change in the PATH will take place. The i-installer changes /etc/profile in order to do that, with something like:
if [ `whoami` != "root" ] then PATH="$PATH:/usr/local/teTeX/bin/powerpc-apple-darwin-current" export PATH fi
Now, the problem is that /etc/profile only gets executed when a shell is loaded, like when you open a Terminal window. Hence, when working from the command line, the value of the PATH variable, which you can see by doing something like "echo $PATH", would be something like:
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/teTeX/bin/powerpc-apple- darwin-current:/usr/local/bin
Or some small variation of it. This way, all LaTeX commands executed from the command line get to use this path.
Now comes the tricky part, in that all GUI applications, TexShop and TextMate included, don't get to use anything set in /etc/profile, so they don't get to use the above path by default, but rather the path that exists at login time, which is just: /bin:/sbin:/usr/bin:/usr/sbin
This is why the executables in TeXShop need to be specified with their full path, instead of just the executable name. In TextMate, you don't see the same problem when executing the LaTeX & View command, because of some TextMate technicalities: That command does not start with a shebang (#!), and so is a plain shell script, but with one important difference: TextMate does a lot of initial work setting things up for this script. Among those things is taking care of using the things defined in /etc/profile. However, for all commands that use a shebang, in particular all Ruby commands that need the shebang to tell TextMate to use the Ruby interpreter (with a line like #!/usr/bin/env ruby), this extra work does not take place. This may change in future version of TextMate, but it is how things are atm.
Which brings us to the two completion commands, bibliography completion, and label completion. They both need to somehow find this path out. It is a bad idea to just execute /etc/profile within the script, because /etc/profile might be doing all sorts of other things as well, that might have unfortunate side-effects. The workaround I had put in place was to use the command line tool "locate" to find the path to kpsewhich. This was a horrible idea in the case of multiple TeX installs, in particular if there are both intel and ppc binaries. So I removed this check, which exposed the previous problem.
(Here is where you should start reading again if you skipped some of the above)
The fix is the following: You need to edit a file called ~/.MacOSX/ environment.plist and to add the full path there. This is a file that is used by all GUI apps, and you can set there values for environment variables that you want all GUI apps to use. In particular we will want to add the current path to this file. Start by going to the terminal and running:
echo $PATH
The result you see printed out is the path we want to use, so select it and copy. Then see if you have a file called ~/.MacOSX/ environment.plist. For that, again in the command line, you would do:
ls ~/.MacOSX/environment.plist
And if you get something back, then you have the file.
In either case, you should open this file for editing in TextMate. If you have already installed the command line tool "mate" (Found in TextMate under Help -> Terminal Usage…, I strongly recommend doing this), then you would at this point do:
mate ~/.MacOSX/environment.plist
This will open this file in TextMate for editing, or create a new file if there isn't such a file. If this is a new file, then make its contents be:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http:// www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>PATH</key> <string>/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/teTeX/bin/powerpc- apple-darwin-current</string> </dict> </plist>
where instead of /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/teTeX/bin/ powerpc-apple-darwin-current you should paste whatever value you copied, that you got from the "echo $PATH"
If you already have such a file, then you need to add the pair:
<key>PATH</key> <string>/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/teTeX/bin/powerpc- apple-darwin-current</string>
So what all this does is it sets the value for the PATH variable in a place that all GUI apps can use. If you later install a different LaTeX version, then you will need to change this file again.
After saving this file and restarting TM, things should start working out. You may need to log out and back in, though I don't think so. Let me know if you still have problems.
Haris
Great! It works (and I did not need to log out and back in as you suspected). Didn't mean for you to write so much but the info is useful and appreciated. Cheers, Mark
On Nov 22, 2006, at 1:48 PM, Mark Eli Kalderon wrote:
Great! It works (and I did not need to log out and back in as you suspected). Didn't mean for you to write so much but the info is useful and appreciated. Cheers, Mark
This will unfortunately be affecting many users, in fact every LaTeX user wanting to use the completion commands, that's why I wanted to write a longer description ;). Glad to hear it's working!
Chances are that now your path in the shell looks a bit longer than it used to ;)
Haris
On Nov 22, 2006, at 1:54 PM, Charilaos Skiadas wrote:
This will unfortunately be affecting many users, in fact every LaTeX user wanting to use the completion commands, that's why I wanted to write a longer description ;). Glad to hear it's working!
Chances are that now your path in the shell looks a bit longer than it used to ;)
As per my suggestion of creating/editing ~/.MacOSX/environment.plist, please do not do so if your path looks significantly different than mine. To minimize the dangers of this change, ideally the path you set in environment.plist should consist of "/bin:/sbin:/usr/bin:/usr/ sbin:" followed by the path to the tex executables. Don't leave any things like /sw/bin or /opt/local/bin in there. Hopefully in the future you would not need to create/edit this file by setting its PATH at all.
The problem is that this file is read by ALL GUI apps, including things like installers, which might not expect that PATH to be set there, and some technical issues might result from that. As long as the path you put there is a typical path, with the four directories described above plus the one for TeX, you should be OK. In any case the other parts of your path will still be there when you run things from the command line.
Also, make sure there are no tabs at the beginning of the path, and no returns at the end. The line should really just have <string> followed immediately by the /bin... stuff, and then that stuff should be followed immediately by </string>.
Haris
Haris
On Nov 22, 2006, at 6:56 PM, Charilaos Skiadas wrote:
On Nov 22, 2006, at 12:19 PM, Mark Eli Kalderon wrote:
Not sure if this has anything to do with the recent update, but the bibliography completion command seems to be broken. Neither the key command nor calling it from the LaTeX bundle menu seems to work. Pretty sure that I haven't done anything to break it since I have been too busy to play with TM lately ;). Best, Mark
I made a change that was essential, because I was using a heuristic that was wrong. The problem is the following:
<snip long explanation>
I try to use auto-completion of bibliographies and do the following: \cite{Sch<caret>} alt+esc
i get the list with the possible bibliographies, i choose the right one and now I get: \cite{/Users/nik/Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:157: command not found: kpsewhich -show-path=tex /Users/nik/Library/Application Support/TextMate/Support/bin/ LatexCitekeys.rb:157: command not found: kpsewhich -show-path=bib Schlesinger:1999}
it put in the right bibliography but the whole stuff before shouldn't be there. I tried the kpsewhich-commands in the terminal and they seem to function. kpsewhich -show-path=tex brings: :/Users/nik/Library/texmf/tex/kpsewhich//:!!/usr/local/teTeX/share/ texmf.local/tex/kpsewhich//:!!/usr/local/teTeX/share/texmf.gwtex/tex/ kpsewhich//:!!/usr/local/teTeX/share/texmf.tetex/tex/kpsewhich//:!!/ usr/local/teTeX/share/texmf/tex/kpsewhich//:/Users/nik/Library/texmf/ tex/generic//:!!/usr/local/teTeX/share/texmf.local/tex/generic//:!!/ usr/local/teTeX/share/texmf.gwtex/tex/generic//:!!/usr/local/teTeX/ share/texmf.tetex/tex/generic//:!!/usr/local/teTeX/share/texmf/tex/ generic//:/Users/nik/Library/texmf/tex///:!!/usr/local/teTeX/share/ texmf.local/tex///:!!/usr/local/teTeX/share/texmf.gwtex/tex///:!!/usr/ local/teTeX/share/texmf.tetex/tex///:!!/usr/local/teTeX/share/texmf/ tex///
kpsewhich -show-path=bib brings: .:/Users/nik/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/nik/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 applied the mentioned fix but it didn't help. I know that it functioned in an earlier version but I'm not sure when it broke.
Niels
P.s.: The template-problem is not forgotten and I will try to track it down on the weekend
On Nov 22, 2006, at 9:05 PM, Charilaos Skiadas wrote:
On Nov 22, 2006, at 2:42 PM, Niels Kobschätzki wrote:
I applied the mentioned fix but it didn't help. I know that it functioned in an earlier version but I'm not sure when it broke.
You need to log out and then back in for the change to show up.
Thx - that helped, I thought that I had just to restart Textmate…
Niels