Hello everybody,
I have a number of relatively basic questions concerning the LaTeX bundle, the "bundle mechanism" in general, as well as Textmate's interaction with PDFView. I am a newbie to Textmate in the sense that I bought a license about 8 months ago but I have not regularly/ seriously used it until now, and I am sure that I have not fully understood some of the basics yet. So, please, excuse me if some of the questions are "stupid" or have been answered on this list or in Textmate's documentation. It would be helpful to just point me to the relevant parts of the documentation in this case.
I should say, though, that I followed the discussions on this list in the last 8 months, and I have also used Textmate on and off, I tinkered around in order to fit it to my needs, tried (and partially succeeded) to wrap my mind around the scope selector mechanism etc.
I must say that I am really excited about Textmate's potential, in particular, its flexibility in regard of syntax coloring. If I interpret the recent emails to the TeX on MacOS X mailing list correctly, there is quite a need and a desire for a TeX frontend that has some decent capabilities as a text editor but keeps TeXShop's simplicity. This is why I hope that I am not alone with the following questions (because I feel that this email will be relatively long)! There seems to be a place for Textmate among the folks who use TeX on MacOS X. The point is, I *want* to love Textmate, but some of the following issues/questions keep me from using it on a regular basis.
So, here we go.
1. What is (strategically) the best way to include my own additions, e.g., to the syntax coloring? The first thing I tried was to change the original LaTeX language file itself, but I soon understood that was not a good idea. The second thing I tried was create my own LaTeX addition file (which would claimall .tex files and at the end include the original LaTeX language file) but that also seemed to break certain things. In relation to this first question, I think I need to understand the following related questions: 2. Do I understand correctly that the "LaTeX bundle" is somehow officially maintained in the sense that certain improvements and additions are included in the official release from time to time? 3. Is there a "version system" for the bundles? I mean, is there a way to tell that I have the latest version of the bundle (or which one I have installed)? 4. Is a new version of a bundle automatically installed with the Textmate updates? 5. What happens to my own additions when a bundle is upgraded? As far as I understand, my additions are stored as "differences" to the original file. But what exactly happens, for example, when I added/ changed a behavior that is later added/modified/deleted in an updated bundle?
Furthermore, I have some questions concerning the typesetting process. Let me start with two observations. The first time I installed Textmate, the TeX console window would pop up when I hit "Typeset", and the results would appear in relatively large chunks as HTML output which seemed rather "slow" compared to TeXShop. The window stayed on the screen when the typesetting was finished. The second time I installed Textmate a couple of months later, (on my MacBook Pro, only in case this matters), the large console window would pop up in the middle of the screen briefly during typesetting, and immediately disappear again when typesetting was finished (which is relatively fast on a Macbook Pro!), not leaving me any chance to at least adjust its size and position.
6. Can anybody give me a clue why there is this difference in behaviors? Has the bundle changed in this respect? Does it matter which type of processor it is run on? 7. Can one bring up the TeX console window without typesetting (e.g. in order to change its size/position)? 8. Is there a way to switch its behavior between one of the following options: Appear upon typesetting (i) always; (ii) upon error; (iii) never; (iv) and close when typesetting is finished? 9. In case there is no way to switch the behavior, would it not be a desirable feature? Would it be possible to include in the LaTeX bundle by default? 10. Are there any advantages to display the results formatted as HTML? Would it not be more appropriate (faster) to make it plain text?
And, finally, I have a few questions concerning the interaction with PDFView. Let me start with a few comments again. First of all, I find PDFView a really nice tool! Thanks to the developers! It just feels right. Simple, with a clean interface. The only "complaint" that I have (which is not really one) is that having two applications interact still feels more clunky than TeXShop's integrated solution ... I wonder whether there is any chance to see a PDF Previewer with some basic LaTeX specific functionality (pdfsync, click-to-magnify etc.) included in Textmate? In any case ...
11. How am I supposed to view the current selection/cursor position in Textmate in PDFView? Sometimes (and really not always), selecting a word and hitting Ctrl-Opt-Cmd-O seems to work. Is there a better way? For example, one without previously selecting something, or a simple Cmd-click? 12. Why does it sometimes fail to take me to the correct paragraph (showing the page PDFView had previously shown)? Is this a shortcoming of pdfsync?
Again, excuse me for this laundry list of questions.
Thank you in advance for your answers, a big Thank You to the Textmate/Bundle/PDFView developers for providing such great tools, and I wish you all a Happy New Year.
Holger
__ ETH Zürich Department of Materials Wolfgang-Pauli-Str. 10, HCI H515 8093 Zürich, Switzerland
Phone: (+41) 1 633 6474 Fax: (+41) 1 633 1390 Email: frauenrath@mat.ethz.ch Web: http://www.polychem.mat.ethz.ch/frauenrath/
On Dec 20, 2006, at 6:47 PM, Holger Frauenrath wrote:
Hello everybody,
So, here we go.
First of all, general references: TextMate manual: http://macromates.com/textmate/manual/ Lots of TM and LaTeX in TM goodies on my page: http:// skiadas.dcostanet.net/afterthought/list-of-my-textmate-pages/ LaTeX bundle help file in TextMate: Bundles -> LaTeX -> Help
- What is (strategically) the best way to include my own
additions, e.g., to the syntax coloring? The first thing I tried was to change the original LaTeX language file itself, but I soon understood that was not a good idea. The second thing I tried was create my own LaTeX addition file (which would claimall .tex files and at the end include the original LaTeX language file) but that also seemed to break certain things.
Your second solution is as far as I can tell the best way to do it. However, the LaTeX bundle mechanism is pretty complex, with 3 different syntax files including each other, to keep separate the parts of the syntax that are latex only, tex in general, or math. There are also separate grammars for the beamer and now memoir classes, both including the latex grammar.
So depending on what changes exactly you wanted to make, it might be more complicated than simply including the grammar. I can answer more specific questions if I know exactly what you want to do. (And if it is for the greater good, I can just add them to the regular LaTeX syntax).
In relation to this first question, I think I need to understand the following related questions: 2. Do I understand correctly that the "LaTeX bundle" is somehow officially maintained in the sense that certain improvements and additions are included in the official release from time to time?
Yes. To be more specific, there is a subversion repository containing all the 100 something bundles and all other supporting material. It can be found at: http://macromates.com/svn/Bundles/trunk. Whenever a new version of TextMate is about to come out, Allan takes a snapshot of a number of bundles from there, and 'bundles" them with the executable. This does include the LaTeX bundle. The bundle itself admits updates a lot more often (in fact I'm about to make some changes to its completion mechanism in the next day or two ;) ).
- Is there a "version system" for the bundles? I mean, is there a
way to tell that I have the latest version of the bundle (or which one I have installed)?
Look at: http://macromates.com/textmate/manual/ bundles#getting_more_bundles
Either you have the one that came with TM, which is as new as TM is, or you have the one through svn, in which case you want to svn up to get the newest version.
- Is a new version of a bundle automatically installed with the
Textmate updates?
I think this is answered above.
- What happens to my own additions when a bundle is upgraded? As
far as I understand, my additions are stored as "differences" to the original file. But what exactly happens, for example, when I added/changed a behavior that is later added/modified/deleted in an updated bundle?
Your changes take precedence. Now, we need to be careful when we say "differences". For instance if you change the key equivalent for a command, then TM keeps this information later on. If you change the text of a command, it keeps the ENTIRE NEW TEXT, as the command text, and not the fact that you, say, added a line after line 4. So any changes to the original command text in the repository will be hidden from you from now on. But changes to scope selector, command text, key equivalent, input, output, are kept separate from each other: You can change one of them and still get updates on the others.
All these are kept in .tmDelta files, stored in ~/Library/Application Support/TextMate/Bundles. You can remove such a file to restore the command to its default status.
Furthermore, I have some questions concerning the typesetting process. Let me start with two observations. The first time I installed Textmate, the TeX console window would pop up when I hit "Typeset", and the results would appear in relatively large chunks as HTML output which seemed rather "slow" compared to TeXShop. The window stayed on the screen when the typesetting was finished. The second time I installed Textmate a couple of months later, (on my MacBook Pro, only in case this matters), the large console window would pop up in the middle of the screen briefly during typesetting, and immediately disappear again when typesetting was finished (which is relatively fast on a Macbook Pro!), not leaving me any chance to at least adjust its size and position.
- Can anybody give me a clue why there is this difference in
behaviors? Has the bundle changed in this respect? Does it matter which type of processor it is run on?
The type of processor should not matter at all. The bundle however changes very often. What the window does has to do with the value of the TM_LATEX_ERRLVL variable. Look at the LaTeX bundle help for details.
- Can one bring up the TeX console window without typesetting
(e.g. in order to change its size/position)?
No, but you can make it stay open.
- Is there a way to switch its behavior between one of the
following options: Appear upon typesetting (i) always; (ii) upon error; (iii) never; (iv) and close when typesetting is finished? 9. In case there is no way to switch the behavior, would it not be a desirable feature? Would it be possible to include in the LaTeX bundle by default?
If the current TM_LATEX_ERRLVL settings are not sufficient, let us know.
- Are there any advantages to display the results formatted as
HTML? Would it not be more appropriate (faster) to make it plain text?
Yes, errors become links that you can click to take you to the corresponding spot. You can also format how things look a bit more.
And, finally, I have a few questions concerning the interaction with PDFView. Let me start with a few comments again. First of all, I find PDFView a really nice tool! Thanks to the developers! It just feels right. Simple, with a clean interface. The only "complaint" that I have (which is not really one) is that having two applications interact still feels more clunky than TeXShop's integrated solution ... I wonder whether there is any chance to see a PDF Previewer with some basic LaTeX specific functionality (pdfsync, click-to-magnify etc.) included in Textmate? In any case ...
- How am I supposed to view the current selection/cursor position
in Textmate in PDFView? Sometimes (and really not always), selecting a word and hitting Ctrl-Opt-Cmd-O seems to work. Is there a better way? For example, one without previously selecting something, or a simple Cmd-click?
It should work. you actually shouldn't have to select anything, just press ctrl-opt-cmd-o (Of course this assumes you are using the PDFView variant of that command. Soon we'll modify the command so that it uses TM_LATEX_VIEWER to use the appropriate application instead of using TeXniscope by default.
- Why does it sometimes fail to take me to the correct paragraph
(showing the page PDFView had previously shown)? Is this a shortcoming of pdfsync?
Yes, pdfsync only marks certain locations. Equations, sectioning commands etc. Not sure about paragraphs. It definitely is not as exact as TeXShop's, which uses PDFKit to do its magic.
Holger
Haris
Hi Haris and everybody else,
first of all thanks for your great work, and for your long answer. I was able to figure out some things, and I stumbled over new problems (for me). Before I start with some of my issues, let me ask you whether this list is supposed to be the place for such "how-to" questions; whether there is a better place for these questions; or whether they should rather be discussed off-list.
And one more thing: I feel that I have to excuse myself again for some questions that may be found in the documentation (online or in Textmate). I spent most of my day today reading the documentation. The problem (for me) seems to be that it is currently sometimes hard to find the relevant piece of information one needs. So, please, just point me to the documentation if my question is answered there.
- What is (strategically) the best way to include my own
additions, e.g., to the syntax coloring? The first thing I tried was to change the original LaTeX language file itself, but I soon understood that was not a good idea. The second thing I tried was create my own LaTeX addition file (which would claimall .tex files and at the end include the original LaTeX language file) but that also seemed to break certain things.
Your second solution is as far as I can tell the best way to do it. However, the LaTeX bundle mechanism is pretty complex, with 3 different syntax files including each other, to keep separate the parts of the syntax that are latex only, tex in general, or math. There are also separate grammars for the beamer and now memoir classes, both including the latex grammar.
So depending on what changes exactly you wanted to make, it might be more complicated than simply including the grammar. I can answer more specific questions if I know exactly what you want to do. (And if it is for the greater good, I can just add them to the regular LaTeX syntax).
So, for example, let's say I have a custom command for including scheme and figures, and I would like to have that command colored in a specific way; what would be the best and most forward-compatible way of doing it? If I understand things correctly, then, if I change the LaTeX language file directly, future updates to the bundle are going to be ignored (overwritten by my changed file). I guess, it would be better to put those personal additions into an extra file. But what is the correct/optimal way to call/include it in the LaTeX language file?
The type of processor should not matter at all. The bundle however changes very often. What the window does has to do with the value of the TM_LATEX_ERRLVL variable. Look at the LaTeX bundle help for details.
[snip]
If the current TM_LATEX_ERRLVL settings are not sufficient, let us know.
Thanks for the hint. I played around with the values. In my eyes it would be useful to have one additional option where the console window would not open at all *except* for when there is an error, in which case it should open and remain open. The reason is that I would like it to be closed after typesetting and, as a matter of fact, the typesetting of a short file on the MacBook only takes a fraction of a second anyways, so that the brief opening and closing of the console window is not useful (in this particular case).
Yes, pdfsync only marks certain locations. Equations, sectioning commands etc. Not sure about paragraphs. It definitely is not as exact as TeXShop's, which uses PDFKit to do its magic.
Well, this just makes me hope for a nice, PDFKit based PDF viewer which nicely integrates with Textmate (or would be integrated into it) ... Textmates power and TexShop's syncing would be my dream LaTeX app. Oh, well ... back in the real world, I have two questions concerning the PDF Preview:
PDFView seems to crash on me fairly often when it updates an already open PDF file; some PDF files it will not open at all anymore. Is there anything I can do to help improve PDFView? I mean, not programming (I can't, sorry!). But, e.g., send console output or something like that.
Is there a way to make Textmate interact with TeXShop nicely? I have set TeXShop as my previewer, and checked "Configure for external viewer" but I seem to miss some settings to at least make it sync using pdfsync. Sorry if that is off-topic.
Then, I have a question concerning international keyboards. I currently have a Swiss keyboard (which drives me crazy anyways ...) which is I think the reason for many keyboard shortcuts not working. Is there a solution to this?
And, finally, I have a probably stupid question: I would like to change the menu structure (the commands) in the LaTeX bundle menu. How can I do that? To be more specific, I am sure (well ...) that I had done it before, and it used to work by simply dragging commands from the list in the bundle editor into the menu structure window of the LaTeX bundle. But it does not work (anymore). I can shuffle around commands, and I can move them to "excluded items", but I cannot add a new one.
Thanks again Holger
__ Eidgenössische Technische Hochschule Zürich (ETH Zürich) Department of Materials Wolfgang-Pauli-Str. 10, HCI H515 CH-8093 Zürich Switzerland
Phone: (+41) 1 633 6474 Fax: (+41) 1 633 1390 Email: frauenrath@mat.ethz.ch Web: http://www.polychem.mat.ethz.ch/frauenrath/
On Dec 21, 2006, at 7:52 PM, Holger Frauenrath wrote:
Hi Haris and everybody else,
first of all thanks for your great work, and for your long answer. I was able to figure out some things, and I stumbled over new problems (for me). Before I start with some of my issues, let me ask you whether this list is supposed to be the place for such "how- to" questions; whether there is a better place for these questions; or whether they should rather be discussed off-list.
Yes, this is a good place for them. Then they get archived and google can find them.
And one more thing: I feel that I have to excuse myself again for some questions that may be found in the documentation (online or in Textmate). I spent most of my day today reading the documentation. The problem (for me) seems to be that it is currently sometimes hard to find the relevant piece of information one needs. So, please, just point me to the documentation if my question is answered there.
- What is (strategically) the best way to include my own
additions, e.g., to the syntax coloring? The first thing I tried was to change the original LaTeX language file itself, but I soon understood that was not a good idea. The second thing I tried was create my own LaTeX addition file (which would claimall .tex files and at the end include the original LaTeX language file) but that also seemed to break certain things.
Your second solution is as far as I can tell the best way to do it. However, the LaTeX bundle mechanism is pretty complex, with 3 different syntax files including each other, to keep separate the parts of the syntax that are latex only, tex in general, or math. There are also separate grammars for the beamer and now memoir classes, both including the latex grammar.
So depending on what changes exactly you wanted to make, it might be more complicated than simply including the grammar. I can answer more specific questions if I know exactly what you want to do. (And if it is for the greater good, I can just add them to the regular LaTeX syntax).
So, for example, let's say I have a custom command for including scheme and figures, and I would like to have that command colored in a specific way; what would be the best and most forward- compatible way of doing it? If I understand things correctly, then, if I change the LaTeX language file directly, future updates to the bundle are going to be ignored (overwritten by my changed file). I guess, it would be better to put those personal additions into an extra file. But what is the correct/optimal way to call/include it in the LaTeX language file?
I don't know what you mean about including scheme. Do you mean scheme code via the lstlistings environment or something like that? Then we should add those to the official bundle. As for figure environments, they should be already targeted by the scope mechanism, so you should be able to assign them colors as is, I think. Unless I misunderstand what you want to do. Both of these two you should also be able to do by creating your own bundle and including the latex grammar. However there is one tricky bit: The rules that match environments match the spaces before the \begin, so that they match from the beginning of the line (for coloring the background more nicely). So if your rule matches only from the \begin part, it does not matter whether it appears first or not, since the built-in rule matches EARLIER. So you would need to be matching those spaces as well. (I've been bitten by this myself ;) ).
The type of processor should not matter at all. The bundle however changes very often. What the window does has to do with the value of the TM_LATEX_ERRLVL variable. Look at the LaTeX bundle help for details.
[snip]
If the current TM_LATEX_ERRLVL settings are not sufficient, let us know.
Thanks for the hint. I played around with the values. In my eyes it would be useful to have one additional option where the console window would not open at all *except* for when there is an error, in which case it should open and remain open. The reason is that I would like it to be closed after typesetting and, as a matter of fact, the typesetting of a short file on the MacBook only takes a fraction of a second anyways, so that the brief opening and closing of the console window is not useful (in this particular case).
Well it sort of opens because this is the default output of the command, an HTML window. So the window opens before the command even starts running. Theoretically it would be possible to not open it until later, but it would make the code of that command even more complicated. It's already a pretty long shell script, that I try not to mess with lest my inferior shell skills brake it. If someone else wants to take a stab at it, then we can talk about it. But given that it works, and it really a minor nuisance, I'm loath to mess with it.
Yes, pdfsync only marks certain locations. Equations, sectioning commands etc. Not sure about paragraphs. It definitely is not as exact as TeXShop's, which uses PDFKit to do its magic.
Well, this just makes me hope for a nice, PDFKit based PDF viewer which nicely integrates with Textmate (or would be integrated into it) ... Textmates power and TexShop's syncing would be my dream LaTeX app. Oh, well ... back in the real world, I have two questions concerning the PDF Preview:
PDFView seems to crash on me fairly often when it updates an already open PDF file; some PDF files it will not open at all anymore. Is there anything I can do to help improve PDFView? I mean, not programming (I can't, sorry!). But, e.g., send console output or something like that.
PDFView is an application completely independent from TM. It is developed by Andrea Bergia, and its website is here: http:// pdfview.sourceforge.net/ You can find the developer's email over there and contact them about it.
Is there a way to make Textmate interact with TeXShop nicely? I have set TeXShop as my previewer, and checked "Configure for external viewer" but I seem to miss some settings to at least make it sync using pdfsync. Sorry if that is off-topic.
No, TeXShop does not support pdfsyncing when it is the external viewer, as far as I know.
Then, I have a question concerning international keyboards. I currently have a Swiss keyboard (which drives me crazy anyways ...) which is I think the reason for many keyboard shortcuts not working. Is there a solution to this?
Yes, change keyboards ;) Seriously, change any keyboard shortcuts that are not there to whatever you want. And yes, change keyboards. Allan has, and he is a Dane.
And, finally, I have a probably stupid question: I would like to change the menu structure (the commands) in the LaTeX bundle menu. How can I do that? To be more specific, I am sure (well ...) that I had done it before, and it used to work by simply dragging commands from the list in the bundle editor into the menu structure window of the LaTeX bundle. But it does not work (anymore). I can shuffle around commands, and I can move them to "excluded items", but I cannot add a new one.
In the bundle editor, select the LaTeX bundle, and you should see the menu structure on the right. Then you should be able to rearrange those. If you want to add another command, it must first be moved into the LaTeX bundle.
Thanks again Holger
__ Eidgenössische Technische Hochschule Zürich (ETH Zürich) Department of Materials Wolfgang-Pauli-Str. 10, HCI H515 CH-8093 Zürich Switzerland
Phone: (+41) 1 633 6474 Fax: (+41) 1 633 1390 Email: frauenrath@mat.ethz.ch Web: http://www.polychem.mat.ethz.ch/frauenrath/
Haris