Sublime Forum

LaTeX plugin for ST2

#8

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:

So far I have specified the full path in viewPDF.py. It works, but I guess it is not what is meant??
Thanks
Thels

0 Likes

#9

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 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 echo $PATH in the terminal and copy the result.

  4. Next you need to make the plist file. The easiest thing to do is touch environment.plist; open -a "Sublime Text 2" environment.plistwhich should open the file in Sublime Text. Copy the following in:

[code]<?xml version="1.0" encoding="UTF-8"?>

ROOT PATH YOUR_PATH_HERE [/code] replacing YOUR_PATH_HERE with whatever was printed from the echo command at step 3.
  1. 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. :smile:

0 Likes

#10

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.

0 Likes

#11

First of all, thanks for this plugin, it makes my life a lot easier. I just installed it and enjoying it already. I just have one question, when i have SumatraPDF closed and the plugin tries to open it I get the error: “Cannot launch Viewer. Make sure it is on your PATH”. Of course I’m not that much of a moron that I didn’t understand the error, but what I can’t figure out is what the error message means by “PATH”. Where can I change it? (Or where is it set so I can change SumatraPDF’s location?).

Thanks for all the hard work and if anyone could help me i would be grateful!

0 Likes

#12

I do plan to remove this limitation at some point soon, but right now, you need to add the SumatraPDF executable to your “path”. This is the list of directories where Windows looks for programs (EXE files) to run when e.g. you invoke them from the command line. See e.g. here:

geekswithblogs.net/renso/archive … ows-7.aspx

Sumatra should be installed in

C:\Program Files\SumatraPDF\SumatraPDF.exe

unless you have put it somewhere else.

Hope this helps—M

0 Likes

#13

Worked perfectly! Thank you very much.
If you ever need help (testing or something), you just need to ask!

0 Likes

#14

Hey Marciano - should the LaTeXTools plugin be able to find all my *tex executables on a Mac? I still had to mod the environment.plist file when I did a clean install on a new Mac in Lion to get everything to work.

0 Likes

#15

Er… yes, it should. I have no environment.plist file on the machine I’m working on right now, and I am using LaTeXTools with no trouble at all. Are you sure you have a current version of the plugin?

0 Likes

#16

Hmm, maybe I’ll try a clean install with the new plugin and see whether it works. The old one might have come across when I shifted to the new machine. I’ll let you know how I get on.

0 Likes

#17

Ok, that fixed it! Thanks for sorting that our Marciano. :smile:

0 Likes

#18

Hi.

I’ve just buy a license of this text editor and I’ve followed your instructions and it works.

Now, I’d like to know to use my toolchain for compiling tex files. Considering that I use PSTricks and bibtex, che toolchain that I use in texmaker is the following:

latex -interaction=nonstopmode %.tex|bibtex %.aux|latex -interaction=nonstopmode %.tex|latex -interaction=nonstopmode %.tex|dvips -o %.ps %.dvi|ps2pdf %.ps

As you can see, I invoke the latex-bibtex-latex-latex chain for bibtex, giving the .dvi, and then the dvips-ps2pdf chain to create the pdf from the .dvi.
How can I invoke the same toolchain using your plugin?

0 Likes

#19

I don’t have direct experience with that, but LaTeXTools uses the latexmk script to actually drive tex & friends, and you can customize the way latexmk is invoked.

Take a look at the documentation for latexmk:

phys.psu.edu/~collins/softwa … k-427a.txt

There is an option -pdfps that instructs latexmk to generate a pdf file from a ps file, via ps2pdf. Look in the relevant (“osx”, I assume) section of the LaTeX.sublime-build file (it’s best if you first copy to the User directory, so it doesn’t get clobbered by subsequent updates). Check the “cmd” keyword and try modifying the options passed to latexmk.

Please report back your findings. Thanks!

0 Likes

#20

What do I need to change to run this on Linux Ubuntu?

I have pdflatex installed and can compile .tex files with it on the command line. I also installed this plugin, but when I hit Ctrl+B it doesn’t do anything except echoing this at this console like window:

It would be so great if I could run this on Linux. :smile:

0 Likes

#21

sorry for my ignorance and lack of knowledge, but… how can I install this in ST2?

Thanks a lot

0 Likes

#23

My guess would be that the whitespace in “program files” isn’t properly quoted by the plugin.

0 Likes

#24

I had this same issue.

As a work around I went into the viewPDF.py file that resides in the C:\Users\MyName\AppData\Roaming\Sublime Text 2\Packages\LatexTools\ directory and changed the windows viewercmd line to this:

viewercmd = “C:\Program Files (x86)\SumatraPDF\SumatraPDF.exe”, “-reuse-instance”]

It seems to work.

0 Likes

#25

Hi!

I’m trying to use this plugin with Ubuntu 12.04, but so far I have not been able to compile.
I suspect it’s the same problem fjolle mentions in the second post of the thread. I would like to try the same solution, but I don’t know what file to edit and line to comment out.

Could I please ask for assistance on this point?

Second EDIT:
The problem is with the build system. However, here is a solution/workaround that works: http://elleestcrimi.me/2012/04/09/sublime-text-latex-build-system/.
It is to make a new build system: Tools > Build System > New Build System and insert the code below. This compiles using pdflatex and opens the file.
Not as fancy as the regulat LaTeXTools builder, but it compiles from within ST2.

{ "cmd": "pdflatex $file && gnome-open $file_base_name.pdf"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.latex.tex", "shell": true }

0 Likes

#26

[quote=“foxthorn”]I had this same issue.

As a work around I went into the viewPDF.py file that resides in the C:\Users\MyName\AppData\Roaming\Sublime Text 2\Packages\LatexTools\ directory and changed the windows viewercmd line to this:

viewercmd = “C:\Program Files (x86)\SumatraPDF\SumatraPDF.exe”, “-reuse-instance”]

It seems to work.[/quote]

Worked for me as well. :smile:

0 Likes

#27

Please report this issue on github. However, first make sure to download the latest version, ideally straight from github. I have been using the plugin on Windows with no path issues, on a variety of machines.

On Linux, again make sure you have the latest version. Compilation DOES work (am running it on Linux right now—Ubuntu 12.04 to be precise. Make sure you have isntalled the latexmk package, which Ubuntu does not do by default when you install texlive). However the previewer (Evince) doesn’t get launched because there’s no specific code for that yet. This has already been reported on github BTW, and it’s high on my list as I’m now running Ubuntu myself.

Marciano (developer of the LaTeXTools plugin)

0 Likes

#28

Folks, just a heads-up: a major update to the plugin has just landed (well technically there have been a few commits over the past few days, but they’re all in now). You get:

  • smarter ref and cite compretion
  • full multi-file document support for ref and cite completion (thanks to Wallace Wu and Juerg Rast)
  • project support for building and ref / cite completion, too (not yet documented, but the code is in)
  • preliminary Linux support
  • various fixes.

See the README for details (again, the project docs are still missing).

Also, another big change is landing soon: new keybindings. Just so you are prepared. As usual, check out github and/or tekonomist.wordpress.com for details.

0 Likes