Hello,
I'm using TextMate a lot for Latex - it a great editor and bundle for that. I have one question:
How can I open a terminal, or go to a pre-existing terminal window, from TextMate, and then run a given shell script in the terminal, in particular a shell script that would typeset the master document?
One reason I want to do this is that the latex bundle seems to typeset in nonstop mode. If there is an error, it highlights it but keeps on running if possible. This is not always optimal, as one would sometimes like to be able to press the 'h' key and see what help TeX can offer in finding the error. One could do this easily from a terminal, and it would be nice to call this with a keystroke from TextMate. It is presumably possible to modify the LaTeX bundle to do this from the console - and perhaps this is already doable but I don't know? But in any case, I'd still like to be able to open a terminal window as above.
Thanks Geoff Vallis
On Fri, Aug 1, 2008 at 10:49 AM, gkv1@mac.com wrote:
Hello,
I'm using TextMate a lot for Latex - it a great editor and bundle for that. I have one question:
How can I open a terminal, or go to a pre-existing terminal window, from TextMate, and then run a given shell script in the terminal, in particular a shell script that would typeset the master document?
The shell script bundle has an 'Open Terminal' command, bound to ⌃⇧O, by default. That will open up a terminal and cd to the correct directory. It looks like it would be fairly easy to modify it to run another command too.
I hope this helps,
Matt
Thanks. Yes - that looks like a way to go. Unfortunately my scripting skills are insufficient to add the commands equivalent to 'pdflatex Masterfile'. Perhaps someone can help?
Geoff
On Aug 1, 2008, at 11:30 AM, Matt Foster wrote:
On Fri, Aug 1, 2008 at 10:49 AM, gkv1@mac.com wrote:
Hello,
I'm using TextMate a lot for Latex - it a great editor and bundle for that. I have one question:
How can I open a terminal, or go to a pre-existing terminal window, from TextMate, and then run a given shell script in the terminal, in particular a shell script that would typeset the master document?
The shell script bundle has an 'Open Terminal' command, bound to ⌃⇧O, by default. That will open up a terminal and cd to the correct directory. It looks like it would be fairly easy to modify it to run another command too.
I hope this helps,
Matt
-- Matt Foster | http://my-mili.eu/matt
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
I haven't tested it, but I think what you would want is to find the line:
write text "cd #{e_as(e_sh(dir))}; clear; pwd"
and change it to something along the lines of
write text "cd #{e_as(e_sh(dir))}; clear; pwd; pdflatex "# {e_as(e_sh(ENV['TM_FILENAME']))}""
(Untested, might blow your computer up and insult your mother etc)
This would still only work at best if you don't use a master document/ included files setup. That would require a bit more work.
But does it happen often that you find the typing of "h" to be helpful at all? I've never found TeX's helpful suggestions all that helpful personally. Either the error is obvious enough from the message, or it is too complex for the message to be helpful. But I guess your mileage may vary.
Haris Skiadas Department of Mathematics and Computer Science Hanover College
On Aug 1, 2008, at 9:42 AM, gkv1@mac.com wrote:
Thanks. Yes - that looks like a way to go. Unfortunately my scripting skills are insufficient to add the commands equivalent to 'pdflatex Masterfile'. Perhaps someone can help?
Geoff
On Aug 1, 2008, at 11:30 AM, Matt Foster wrote:
On Fri, Aug 1, 2008 at 10:49 AM, gkv1@mac.com wrote:
Hello,
I'm using TextMate a lot for Latex - it a great editor and bundle for that. I have one question:
How can I open a terminal, or go to a pre-existing terminal window, from TextMate, and then run a given shell script in the terminal, in particular a shell script that would typeset the master document?
The shell script bundle has an 'Open Terminal' command, bound to ⌃⇧O, by default. That will open up a terminal and cd to the correct directory. It looks like it would be fairly easy to modify it to run another command too.
I hope this helps,
Matt
-- Matt Foster | http://my-mili.eu/matt
On 02/08/2008, at 2:07 AM, Charilaos Skiadas wrote:
But does it happen often that you find the typing of "h" to be helpful at all? I've never found TeX's helpful suggestions all that helpful personally. Either the error is obvious enough from the message, or it is too complex for the message to be helpful. But I guess your mileage may vary.
No, you're right that 'h' often does supply very much useful information :) When writing macros and packages, however, I'd prefer it to stop at the first instance of the error for three reasons: 1. Easier to see where it was! And no time waste with TeX trying to recover from the error and continue typesetting. 2. Sometimes writing diagnostic information with the 'i' function is really useful. 3. In looping-like behaviour, I like to put in commands like \show \somemacro to see what the value of something is. It's generally easier to interpret this information in "real time" rather than have TeX run through the whole document before working out what's going on.
Ideally, there'd be an option to have TextMate compile documents in a similar way to TeXShop, stopping at errors and allowing input, but I can understand that's either non-trivial or even impossible with the current interface :)
Cheers, Will
On Fri, Aug 1, 2008 at 12:13 PM, Will Robertson wspr81@gmail.com wrote:
On 02/08/2008, at 2:07 AM, Charilaos Skiadas wrote:
But does it happen often that you find the typing of "h" to be
helpful at all? I've never found TeX's helpful suggestions all that helpful personally. Either the error is obvious enough from the message, or it is too complex for the message to be helpful. But I guess your mileage may vary.
No, you're right that 'h' often does supply very much useful information :) When writing macros and packages, however, I'd prefer it to stop at the first instance of the error for three reasons:
- Easier to see where it was! And no time waste with TeX trying to
recover from the error and continue typesetting. 2. Sometimes writing diagnostic information with the 'i' function is really useful. 3. In looping-like behaviour, I like to put in commands like \show\somemacro to see what the value of something is. It's generally easier to interpret this information in "real time" rather than have TeX run through the whole document before working out what's going on.
Ideally, there'd be an option to have TextMate compile documents in a similar way to TeXShop, stopping at errors and allowing input, but I can understand that's either non-trivial or even impossible with the current interface :)
Well, now that you have thrown down the 'TeXShop does it' gauntlet I am going to have to do some experimenting. :-) I think I might be able to get what you want to work by detecting the error and the prompt and then using dialog to get a response. I know I can create two way communication with another process....
I didn't ever think to do it before because I never run in interactive mode.
I'll let you know what I figure out.
Cheers, Will
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 02/08/2008, at 4:18 AM, Brad Miller wrote:
I think I might be able to get what you want to work by detecting the error and the prompt and then using dialog to get a response. I know I can create two way communication with another process....
I didn't ever think to do it before because I never run in interactive mode.
It's funny when people do things in completely the opposite way than you :) Here's the full list of actions that can be taken:
'h' - try to supply further error information
<return> - ignore this error and continue
'i'<arbitrary text> - ignore this error and insert <arbitrary text> at this point in the processing (e.g., if you misspell a macro name you can correct it here)
's' - as with <return> but ignoring all subsequent errors, showing error messages but stopping for user interaction ("enter file name" for example) 'r' - as with 's' ignore all errors and continue, showing errors without stopping for user interaction 'q' - as with 'r' but without printing console output
'x' - abort immediately 'e' - abort immediately and open the editor (you can ignore this one)
****
'x' of course produces no output (i.e., no PDF). The 'r' and 'q' options will generally produce a PDF but if they run into an "Emergency Stop" (like if a file that doesn't exist is tried to be \input) then the PDF will be truncated to the last page that completed typesetting.
(I've always thought a "clever" wrapper to 'i' could allow you to do things like "insert <arbitrary text> for this error and all identical subsequent errors" and even "use <arbitrary text> in a replacement rule to modify the input file to correspond to the correction".)
Cheers, Will
On 1 Aug 2008, at 20:48, Brad Miller wrote:
[...] I think I might be able to get what you want to work by detecting the error and the prompt and then using dialog to get a response.
Injecting the tm_interactive_read library into the pdflatex process should detect when pdflatex reads from stdin and present the dialog.
Currently the library is only on the repository and you need a bleeding edge build¹ for it to work properly with the HTML output option.
¹ Achieved by holding down ⌥ which clicking “Check Now” in Software Update.
[Sorry - last message was accidentally sent incomplete]
Hi
I can see how your modification might be along the right lines, but the script did absolutely nothing (and so my computer and my mother remain fine :). I also modified a previous line with 'do script' instead of 'write text', which would seem to be the one to use for terminal and not iterm, and again the script didn't work. At the risk of blowing up my computer, might I encourage you to look at it again?
I do find 'h' to be sometime useful: it will tell me, for example, if a command is not defined, whereas simply going to the offending line is not always useful, especially as 'lines' are sometimes very long if the text is soft-wrapped. So sometimes I am reduced to going to a terminal and typing 'pdflatex file' by hand, so much displeasing the TextMate gods...
Geoff
On Aug 1, 2008, at 5:37 PM, Charilaos Skiadas wrote:
I haven't tested it, but I think what you would want is to find the line:
write text "cd #{e_as(e_sh(dir))}; clear; pwd"
and change it to something along the lines of
write text "cd #{e_as(e_sh(dir))}; clear; pwd; pdflatex \"#
{e_as(e_sh(ENV['TM_FILENAME']))}""
(Untested, might blow your computer up and insult your mother etc)
This would still only work at best if you don't use a master document/ included files setup. That would require a bit more work.
But does it happen often that you find the typing of "h" to be helpful at all? I've never found TeX's helpful suggestions all that helpful personally. Either the error is obvious enough from the message, or it is too complex for the message to be helpful. But I guess your mileage may vary.
Haris Skiadas Department of Mathematics and Computer Science Hanover College
On Aug 1, 2008, at 9:42 AM, gkv1@mac.com wrote:
Thanks. Yes - that looks like a way to go. Unfortunately my scripting skills are insufficient to add the commands equivalent to 'pdflatex Masterfile'. Perhaps someone can help?
Geoff
On Aug 1, 2008, at 11:30 AM, Matt Foster wrote:
On Fri, Aug 1, 2008 at 10:49 AM, gkv1@mac.com wrote:
Hello,
I'm using TextMate a lot for Latex - it a great editor and bundle for that. I have one question:
How can I open a terminal, or go to a pre-existing terminal window, from TextMate, and then run a given shell script in the terminal, in particular a shell script that would typeset the master document?
The shell script bundle has an 'Open Terminal' command, bound to ⌃⇧O, by default. That will open up a terminal and cd to the correct directory. It looks like it would be fairly easy to modify it to run another command too.
I hope this helps,
Matt
-- Matt Foster | http://my-mili.eu/matt
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate