Sublime Forum

Unofficial LaTeXTools port to ST3

#7

Hey all, sorry for the delay in getting back to you, but thanks for the feedback, testing, and fixes! I’ve adjusted things so that the temporary directory trick is no longer enabled by default, and added a setting to enable it along with a note explaining that paths will have to be specified absolutely, I’ve incorporated RazerM’s fix for Windows, and I think I’ve rooted out the last couple of places where “LaTeXTools” wasn’t changed to “LaTeXTools3”. (As far as naming goes, I wanted it to be easily distinguishable from the ST2 version without diverting credit and kudos from the original authors, so I just jammed a “3” on there. Sort of a lazy solution, but.)

The Github repository has been updated; let me know if it breaks anything new!

0 Likes

#8

I noticed another error, which isn’t preventing compilation or launching Sumatra, but it is appearing in the console.

Appears to be a bug from the switch to Python 3, but I don’t know enough about Python yet to fix it.

Got request for DDE! Traceback (most recent call last): File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 412, in run_ return self.run(edit, **args) File "C:\Users\frazer\AppData\Roaming\Sublime Text 3\Packages\LaTeXTools3\DDEExecute.py", line 37, in run pData = c_char_p(command) TypeError: bytes or integer address expected instead of str instance

0 Likes

#9

[quote=“RazerM”]I noticed another error, which isn’t preventing compilation or launching Sumatra, but it is appearing in the console.

Appears to be a bug from the switch to Python 3, but I don’t know enough about Python yet to fix it.[/quote]

I’m not terrific with ctypes either, but try the commit from just now and see if that helps. You should just need to replace DDEExecute.py. Sorry I can’t test it myself, but I don’t have access to a Windows machine right now.

0 Likes

#10

[quote=“phyllisstein”]

[quote=“RazerM”]I noticed another error, which isn’t preventing compilation or launching Sumatra, but it is appearing in the console.

Appears to be a bug from the switch to Python 3, but I don’t know enough about Python yet to fix it.[/quote]

I’m not terrific with ctypes either, but try the commit from just now and see if that helps. You should just need to replace DDEExecute.py. Sorry I can’t test it myself, but I don’t have access to a Windows machine right now.[/quote]

Yeah the error is gone now.

0 Likes

#11

Thank you for this port!

Are the “crtl+l,x” or the “crtl+l,crtl+space” keybindings working for anyone?

0 Likes

#12

The citation autocomplete won’t work. I fixed that and PDF jump:

Citations
Pdf jump

Might get merged into the main repo.

0 Likes

#13

[quote=“zmk”]The citation autocomplete won’t work. I fixed that and PDF jump:

Citations
Pdf jump

Might get merged into the main repo.[/quote]

I just merged your changes; thanks for helping out!

0 Likes

#14

zmk,

This is great. Thank you.

0 Likes

#15

[quote=“gregor.hoch”]This is great! I have been waiting for this one! Are you going to sent to pull request to the main repro?

EDIT: Any chance to get the changes from this pull request in ST3?
github.com/SublimeText/LaTeXTools/pull/120[/quote]

I agree that incorporating some elements of that pull request, in particular the support for multiple references, would be tremendous. In fact, support for multiple references (the “,” trigger developed by Westacular) is really the only thing I’m missing right now in this ST3 LaTeXTools port.

0 Likes

#16

Hi!

Thanks for the plugin update, all I missed to go to ST3 :wink:

I have some issues though, main one being that DdeConnect (for Windows/Sumatra) generates like 10s of lags on forward searches. Any idea?

I’ll try the 32 bits version rather than 64.

0 Likes

#17

Hey There!

I’m trying to get Latextools to work with ST3 but i’m currently stuck.

I checked out the st3 branch from github, I installed latexmk and evince but when I try building a .tex file it just shows [Compiling …tex] and does nothing. On the console I get the following error:

‘latexmk’, ‘-cd’, ‘-e’, “$pdflatex = ‘pdflatex %O -interaction=nonstopmode -synctex=1 %S’”, ‘-f’, ‘-pdf’, ‘/home/…/Documents/BA/thesis.tex’]
2
Welcome to thread Thread-1
Exception in thread Thread-1:
Traceback (most recent call last):
File “X/threading.py”, line 639, in _bootstrap_inner
File “/home/…/.config/sublime-text-3/Packages/LaTeXTools/makePDF.py”, line 53, in run
env = self.caller.envi.copy()
AttributeError: ‘MakePdfCommand’ object has no attribute ‘envi’

Working on Archlinux 64bit.

cheers

0 Likes

#18

Try this pull request… github.com/phyllisstein/LaTeXTools/pull/6

Looks like the self.envi isn’t defined in all cases in the MakePDFCommand class…

0 Likes

#19

Thanks for the quick response! I got rid of the error above, but got a new one.

After the build command it said on the console, that a .log file could not be found so I just created the file it was looking for. After that I see no errors, evince starts but is unable to open the document (Error opening file: No such file or directory).

What the hell am I doing wrong? :smiley:

0 Likes

#20

[quote=“Talaf”]Hi!

Thanks for the plugin update, all I missed to go to ST3 :wink:

I have some issues though, main one being that DdeConnect (for Windows/Sumatra) generates like 10s of lags on forward searches. Any idea?

I’ll try the 32 bits version rather than 64.[/quote]

I confirmed it too.
Does 32 bit version work?

0 Likes

#21

Hi,

No it didn’t. I actually debugged it a bit, and the problem seems to be on the DDE connection to Sumatra’s service… I “fixed” it by simply using the command line rather than DDE to forward search. I changed the code in jumptoPDF.py as follow, from line 84 :

		elif plat == 'win32':
			# determine if Sumatra is running, launch it if not
			print("Windows, Calling Sumatra")
			# hide console
			startupinfo = subprocess.STARTUPINFO()
			startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
			tasks = subprocess.Popen("tasklist"], stdout=subprocess.PIPE,
					startupinfo=startupinfo).communicate()[0]
			# Popen returns a byte stream, i.e. a single line. So test simply:
			if "SumatraPDF.exe" not in str(tasks):
				print("Sumatra not running, launch it")
				self.view.window().run_command("view_pdf")
				time.sleep(0.5) # wait 1/2 seconds so Sumatra comes up
			setfocus = 0 if keep_focus else 1
			if forward_sync:
                                # Use the command line facility rather than DDE to forward search
				subprocess.Popen("SumatraPDF.exe -reuse-instance -forward-search %s %d %s" % (srcfile,line,pdffile))

This is probably not ideal, that being said DDE is an old facility. It is also probably related to Python 3 rather than Sublime… I’ll use this method for now and I’ll go back to more tests later if I have more time :wink:

0 Likes

#22

[quote=“Talaf”]Hi,

No it didn’t. I actually debugged it a bit, and the problem seems to be on the DDE connection to Sumatra’s service… I “fixed” it by simply using the command line rather than DDE to forward search. I changed the code in jumptoPDF.py as follow, from line 84 :

		elif plat == 'win32':
			# determine if Sumatra is running, launch it if not
			print("Windows, Calling Sumatra")
			# hide console
			startupinfo = subprocess.STARTUPINFO()
			startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
			tasks = subprocess.Popen("tasklist"], stdout=subprocess.PIPE,
					startupinfo=startupinfo).communicate()[0]
			# Popen returns a byte stream, i.e. a single line. So test simply:
			if "SumatraPDF.exe" not in str(tasks):
				print("Sumatra not running, launch it")
				self.view.window().run_command("view_pdf")
				time.sleep(0.5) # wait 1/2 seconds so Sumatra comes up
			setfocus = 0 if keep_focus else 1
			if forward_sync:
                                # Use the command line facility rather than DDE to forward search
				subprocess.Popen("SumatraPDF.exe -reuse-instance -forward-search %s %d %s" % (srcfile,line,pdffile))

This is probably not ideal, that being said DDE is an old facility. It is also probably related to Python 3 rather than Sublime… I’ll use this method for now and I’ll go back to more tests later if I have more time :wink:[/quote]

Nice solution.
By the way, your solution doesn’t work for filenames with spaces.
It may be better.

subprocess.Popen("SumatraPDF.exe","-reuse-instance","-forward-search", srcfile, str(line), pdffile])
0 Likes

#23

[quote=“Desilusionado”]Thanks for the quick response! I got rid of the error above, but got a new one.

After the build command it said on the console, that a .log file could not be found so I just created the file it was looking for. After that I see no errors, evince starts but is unable to open the document (Error opening file: No such file or directory).

What the hell am I doing wrong? :smiley:[/quote]

Don’t have a linux box… so not sure…

0 Likes

#24

Hi all,
Apologies for missing some of the activity on this forum. I get so used to attending mostly to the Github “Issues” interface that I sometimes forget it’s here! But my grateful thanks to @bianjiang for pointing out the self.envi issue. @Desilusionado, could you confirm that you’re still experiencing your problem with the latest Github commits? I found that some code I pulled in to help the plugin work with the temporary directory was causing silent, low-level issues with LaTeX, and though I think I have it fixed under OS X/Linux I’m still not sure about Windows. If you’d like to help debug it, please get in touch via e-mail; my address is d-at-daniel-dot-sh.

And finally, thanks for the new jumpToPDF code, @randy3k. I’m always hesitant to make sweeping changes to the original author’s work, but I’ll definitely consider pulling that or something similar in if DDE is causing serious problems.

0 Likes

#25

Hi all,

I’m the original LaTeXTools author. Good news: I’m in the process of producing an “official” port of LaTeXTools to ST3, which no includes westacular’s super-good ref/cite completion code. Bad news: I’ve only just started :smile: Of course, I’m drawing freely from phyllisstein’s EXCELLENT work, so things will move on quickly, I hope.

I didn’t pull in phyllisstein’s code directly because (1) he added a few things (e.g. different directory for aux files, other previewers) that I’d like to do differently and in any case later, and (2) some of the recent fixes/additions would have required further work merging. In any case, I’m consulting (make that cut-and-pasting) phyllisstein’s code extensively!

You can follow what I"m doing in the ‘st3’ branch. WARNING: right now things are basically still broken, so keep using phyllisstein’s port for now. I’ll let you know when you can start pulling my branch.

phyllisstein, I’ve already thanked you in private, but I’ll do so publicly now: THANKS!!! I’ll have several questions and requests for you soon :smile:

Thanks for your patience! M

0 Likes

#26

Ends up I was too pessimistic. Official announcement:

viewtopic.php?f=5&t=12940&start=0

Cheers,
Marciano.

0 Likes