Hello everybody,
I use TextMate mainly for LaTex editing.
In LaTex, I often use a package "jurarsp". This package works by way of running BibTex on a file with the extension *.rsp.aux (okay, admittedly the," rsp"-part is not the file extension, but you get the gist, I hope). In TextMate, I set all my LaTex projects to run the latex, bibtex, etc. commands on a master file. Now I want to create a custom command that would run bibtex on the master_file.rsp.aux file, where the "master_file"-part would automatically be the name of the master file of the current project. The bibtex command already achieves this by using this simple syntax:
texMate.py bibtex 1
However, simply adding .rsp.aux after the 1 does not work. So I guess what I am looking for is a command or regular expression that would do the following: get the name of the current master file without extension, and add the extension .rsp.aux to this name. Maybe that is very simpe question I am asking but I promise you that I duly researched the mailing list and could not find an answer.
Thank you for any suggestions,
JJ
On 8 May 2009, at 00:50, Jan Jakob Bornheim wrote:
I use TextMate mainly for LaTex editing.
[...] by using this simple syntax:
texMate.py bibtex 1
However, simply adding .rsp.aux after the 1 does not work. So I guess what I am looking for is a command or regular expression that would do the following: get the name of the current master file without extension, and add the extension .rsp.aux to this name. Maybe that is very simpe question I am asking but I promise you that I duly researched the mailing list and could not find an answer.
The real question is probably how to get the master file for a project. If you have set the TM_LATEX_MASTER variable that is easy, as you can just use "$TM_LATEX_MASTER" in your command, and "$ {TM_LATEX_MASTER%.*}.rsp.aux" to cut the current extension and add your custom extension.
On Wed, May 20, 2009 at 11:40 AM, Allan Odgaard mailinglist@textmate.org wrote:
On 8 May 2009, at 00:50, Jan Jakob Bornheim wrote:
I use TextMate mainly for LaTex editing.
[...] by using this simple syntax:
texMate.py bibtex 1
However, simply adding .rsp.aux after the 1 does not work. So I guess what I am looking for is a command or regular expression that would do the following: get the name of the current master file without extension, and add the extension .rsp.aux to this name. Maybe that is very simpe question I am asking but I promise you that I duly researched the mailing list and could not find an answer.
The real question is probably how to get the master file for a project. If you have set the TM_LATEX_MASTER variable that is easy, as you can just use "$TM_LATEX_MASTER" in your command, and "$ {TM_LATEX_MASTER%.*}.rsp.aux" to cut the current extension and add your custom extension.
Thank you. That solves one big problem.
However, it still does not work.
If I define the command to be "texmate.py bibtex ${TM_LATEX_MASTER%.*}.rsp.aux", texmate.py pretty much seems to ignore everything that comes after bibtex (i.e. I could write whatever I want after bibdesk, the command will run on the result of "${TM_LATEX_MASTER%.*}.aux" (without rsp).
If I simply define the command to be "bibtex ${TM_LATEX_MASTER%.*}.rsp.aux", bibtex itself gives the error "Need exactly one file argument".If I instead define the command to run on the actual file name (i.e. bibtex master.rsp.aux), it works.
So I assume the problem is that by using the second alternative, it is bibtex that tries to guess the meaning of the expression "${TM_LATEX_MASTER%.*}.rsp.aux", which it can't, while in the first alternative, it is texmate.py that should interpret "${TM_LATEX_MASTER%.*}.rsp.aux" but does not because texmate.py really does not expect to have the file specified on which it runs bibtex.
Assuming my layman's guess is correct, I conclude that the expression "${TM_LATEX_MASTER%.*}.rsp.aux" needs to be interpreted before being handed over to the bibtex command. Is there a way to do that?
On Wed, May 20, 2009 at 11:40 AM, Allan Odgaard mailinglist@textmate.org wrote:
On 8 May 2009, at 00:50, Jan Jakob Bornheim wrote:
I use TextMate mainly for LaTex editing.
[...] by using this simple syntax:
texMate.py bibtex 1
However, simply adding .rsp.aux after the 1 does not work. So I guess what I am looking for is a command or regular expression that would do the following: get the name of the current master file without extension, and add the extension .rsp.aux to this name. Maybe that is very simpe question I am asking but I promise you that I duly researched the mailing list and could not find an answer.
The real question is probably how to get the master file for a project. If you have set the TM_LATEX_MASTER variable that is easy, as you can just use "$TM_LATEX_MASTER" in your command, and "$ {TM_LATEX_MASTER%.*}.rsp.aux" to cut the current extension and add your custom extension.
Thank you. That solves one big problem.
However, it still does not work.
If I define the command to be "texmate.py bibtex ${TM_LATEX_MASTER%.*}.rsp.aux", texmate.py pretty much seems to ignore everything that comes after bibtex (i.e. I could write whatever I want after bibdesk, the command will run on the result of "${TM_LATEX_MASTER%.*}.aux" (without rsp).
If I simply define the command to be "bibtex ${TM_LATEX_MASTER%.*}.rsp.aux", bibtex itself gives the error "Need exactly one file argument".If I instead define the command to run on the actual file name (i.e. bibtex master.rsp.aux), it works.
So I assume the problem is that by using the second alternative, it is bibtex that tries to guess the meaning of the expression "${TM_LATEX_MASTER%.*}.rsp.aux", which it can't, while in the first alternative, it is texmate.py that should interpret "${TM_LATEX_MASTER%.*}.rsp.aux" but does not because texmate.py really does not expect to have the file specified on which it runs bibtex.
Assuming my layman's guess is correct, I conclude that the expression "${TM_LATEX_MASTER%.*}.rsp.aux" needs to be interpreted before being handed over to the bibtex command. Is there a way to do that?
Jan Jakob Bornheim wrote:
If I simply define the command to be "bibtex ${TM_LATEX_MASTER%.*}.rsp.aux", bibtex itself gives the error "Need exactly one file argument".If I instead define the command to run on the actual file name (i.e. bibtex master.rsp.aux), it works.
That looks to me as if your TM_LATEX_MASTER contained whitespace.
Could you add, in front of that,
echo $TM_LATEX_MASTER >&2
and see what that returns?
So I assume the problem is that by using the second alternative, it is bibtex that tries to guess the meaning of the expression "${TM_LATEX_MASTER%.*}.rsp.aux", which it can't, while in the first
No, that's the shell's task. (This ain't CP/M.)
Christopher
On 25-May-09, at 6:54 PM, Christopher Creutzig wrote:
That looks to me as if your TM_LATEX_MASTER contained whitespace.
Could you add, in front of that,
echo $TM_LATEX_MASTER >&2
and see what that returns?
Well, the filename did not contain any whitespace, but the parent folder did. Ex:
/Users/janjakobbornheim/Documents/univ/essay HCA/master_essay_hca.tex
So just using quotation marks around "${TM_LATEX_MASTER%.*}.rsp.aux" worked (i.e. using 'bibtex "${TM_LATEX_MASTER%.*}.rsp.aux"' without the single quotes). I am sorry. That was pretty obvious, I just didn't think of the possibility that TM_LATEX_MASTER could as well return the absolute path instead of the file name only. Thank you very much for your help.
Jan Jakob