Home Download Buy Blog Forum Support

LaTeX plugin for ST2

LaTeX plugin for ST2

Postby Marciano on Fri Mar 25, 2011 11:35 pm

I am porting my LaTeX plugin to ST2. Here's how to get it: go to

https://github.com/SublimeText/LaTeXTools

and hit Download. For installation and setup instructions, and very preliminary documentation, see my blog:

http://tekonomist.wordpress.com/2011/03 ... -text-2-4/

WARNING: it's alpha quality, but I've been using it as my sole LaTeX editor for the past two weeks, on both Mac and Windows. Lots of work left to do, but it's a start.

Comments welcome!

[EDITED 3/26 with new GitHub URL]
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am

Re: LaTeX plugin for ST2

Postby fjolle on Fri Apr 29, 2011 5:20 pm

Hi,

First of all, thanks a lot for taking your time for developing this plugin. I've been using it a lot (As well has a friend from the university also using Sublime Text) :)

I'm using it with linux (Ubuntu 11.04) and a build produces an error after running pdflatex. I've solved this by commenting the default pdf_previewer line and adding:
Code: Select all
"-e", "\\$pdf_previewer = qq{evince %S}",

Evince (default pdf viewer) stays on the correct page, and it also allows pdflatex to update the pdf without having to close it, so the most basic functionality is there. No reverse lookup etc though but i can survive without that.

Thanks again :)
fjolle
 
Posts: 5
Joined: Sun Apr 10, 2011 10:21 am

Re: LaTeX plugin for ST2

Postby jesse.robertson on Sat Apr 30, 2011 7:04 am

Seconded (about this being a great plugin).

After some problems finding latexmk on my Mac (in case anyone else has this problem you have to put your PATH variable in a plist file called ~/.MacOSX/environment.plist which is read on login: see here), this works wonderfully. I'm using Preview.app as my previewer and did the same sort of thing as fjolle by appending:

Code: Select all
"\\$pdf_previewer = qq{open -a Preview %O %S}"


rather than the default preview code. Preview updates the document preview when you refocus the window. Again no reverse lookup but I'm not a huge fan of Skim, so I decided I could do without this.
jesse.robertson
 
Posts: 11
Joined: Fri Apr 29, 2011 2:56 am

Re: LaTeX plugin for ST2

Postby Marciano on Sun May 01, 2011 4:03 pm

Thanks guys!

Just a couple of comments. First, unfortunately there is no Linux-specific customization yet, the reason being that I don't have enough room to install an Ubuntu VM on my laptop. I don't like this state of affairs, and would be delighted if someone would contribute proper Linux support. I am not sure Evince has support for inverse search, but I think Okular does (or used to). It's been a while...

Second, regarding the previewer in OSX (and other platforms, too, for that matter): my medium-term goal is to make such things user-configurable. Preview does not support forward/inverse search, and for me this is a non-starter; however, that's a matter of taste.

However, I am about to merge patches that implement better interaction with the PDF viewer *and*, more importantly, proper error handling. This redefines the build command entirely, but in light of your comments, I'll leave the current build system unmodified (or provide an easy way to switch back to it).

Keep the comments coming!
M
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am

Re: LaTeX plugin for ST2

Postby jesse.robertson on Mon May 02, 2011 2:07 am

Hi Marciano

I think the most useful bit of customisation at the moment would to be able to select the tex engine used to compile documents. I'm using xelatex a lot (because I hate the default LaTeX fonts and want to use Gentium for a lot of my documents), and although you can just change the build file, it would be nice to have a way of setting this on a per-document basis (like TeXShop's %!TEX commands). I'm not sure how easy this would be to do though...

BTW, if anyone else wants to use xelatex rather than pdflatex, just stick the following in the build command in the LaTeX.sublime-build file:
Code: Select all
"-e", "\\$pdflatex = 'xelatex %O %S'"
jesse.robertson
 
Posts: 11
Joined: Fri Apr 29, 2011 2:56 am

Re: LaTeX plugin for ST2

Postby driple on Thu May 12, 2011 11:17 am

jesse.robertson wrote:Seconded (about this being a great plugin).

After some problems finding latexmk on my Mac (in case anyone else has this problem you have to put your PATH variable in a plist file called ~/.MacOSX/environment.plist which is read on login: see here), this works wonderfully.


Hi,

thanks Marciano for the plugin, and thank you Jon for bringing us ST2. Coming here from the TextMate mailing list (where, btw, while TM2 is still sorely missed, ST2 indeed makes some waves) I am eager to try out ST2 in a LaTeX workflow. (I'm using TM and Skim for my LaTeX needs right now.)

However, to be honest, I'm not that proficient with regards to .plists, hidden path variables, and the like. So I would kindly ask Jesse to be a bit more specific about how to tell ST2 where latexmk lives.
For now, whenever I try to build some LaTeX, I get:

"[Errno 2] No such file or directory
[Finished]"

I managed to create the file ~/.MacOSX/environment.plist, but how to put the information about latexmk’s path into it? Excuse my illiteracy.

Thanks for your help, and great work.

--Georg


Update: I think I found crucial help (haven’t checked it out yet because I cannot log out/re-log in right now):

[url]http://tekonomist.wordpress.com/2011/04/22/google-chrome-favicons-are-back-on-my-mac/#comment-189
[/url]

Thx again, Marciano!
driple
 
Posts: 3
Joined: Thu May 12, 2011 9:48 am

Re: LaTeX plugin for ST2

Postby Marciano on Tue May 17, 2011 3:09 am

You're welcome :-)

BTW, a way to specify paths within ST2, and possibly auto-discover them, is high on my list. I've been super-busy lately, but do plan to get back to coding ASAP.
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am

Re: LaTeX plugin for ST2

Postby thels on Mon Jul 18, 2011 7:57 am

Hi
Many thanks for your work, it works great.
I do however have a simple question (probably the most stupid question I could ask)... but what is meant by:
"Sumatra must be on the PATH"


So far I have specified the full path in viewPDF.py. It works, but I guess it is not what is meant??
Thanks
Thels
thels
 
Posts: 1
Joined: Mon Jul 18, 2011 7:53 am

Re: LaTeX plugin for ST2

Postby jesse.robertson on Sat Oct 01, 2011 8:13 am

Hi driple

Apologies for how long it has taken me to reply to your post!

The issue is that Macs don't make environment variables (for example your PATH variable, which tells the operating system where to find some important UNIX programs on your computer, including LaTeX or other Python installs) available to every application by default. The way around this is to write a property list file (plist) called "environment.plist" and put it in the "~/.MaxOSX folder" - the system will look for this file on login and make the variables defined in it available to your applications.

The way to do this is as follows:
    1. Open a terminal window

    2. Run the following
    Code: Select all
    mkdir ~/.MacOSX; cd ~/.MaxOSX
    (If you already have this folder the OS will complain but won't overwrite it). You should now be in the ~/.MacOSX folder, although it won't appear in the Finder (since folders or files beginning with a period are hidden).

    3. Now you need a copy of your path. The easiest thing to do is run
    Code: Select all
    echo $PATH
    in the terminal and copy the result.

    4. Next you need to make the plist file. The easiest thing to do is
    Code: Select all
    touch environment.plist; open -a "Sublime Text 2" environment.plist
    which should open the file in Sublime Text. Copy the following in:
    Code: Select all
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
            <key>ROOT</key>
            <dict>
                    <key>PATH</key>
                    <string>YOUR_PATH_HERE</string>
            </dict>
    </dict>
    </plist>

    replacing YOUR_PATH_HERE with whatever was printed from the echo command at step 3.

    5. Save the file, log out and log back in and everything should work.

You can generate plist files using the developer tools which come with Xcode but they've changed everything in Lion so it's just easier to modify the files in Sublime Text. It'd probably be pretty easy to stick this all in a shell script but I'm too lazy to sort this out at the moment.

Hope this helps! I'll keep an eye on this thread if you have any problems. :)
jesse.robertson
 
Posts: 11
Joined: Fri Apr 29, 2011 2:56 am

Re: LaTeX plugin for ST2

Postby Marciano on Sat Oct 01, 2011 11:01 pm

Driple and jesse.robertson --- since sometime in late July (can't remember when exactly) it is no longer necessary to configure paths on Mac OS X. If you pull the current version from GitHub, you will be good to go without creating the .MacOS/environment.plist file.

Also, there is now a semi-legible README file with an explanation of the installation procedure (not much to do on the Mac) and features.
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am

Next

Return to Plugin Announcements

Who is online

Users browsing this forum: Exabot [Bot] and 8 guests