Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include the AutoLaTeX compiler with the builder API of LaTeXTools. #387

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions builders/autolatexBuilder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# ST2/ST3 compat
from __future__ import print_function
import sublime
if sublime.version() < '3000':
# we are on ST2 and Python 2.X
_ST3 = False
else:
_ST3 = True

import os.path
import re
# This will work because makePDF.py puts the appropriate
# builders directory in sys.path
from pdfBuilder import PdfBuilder

DEBUG = False




#----------------------------------------------------------------
# AutoLaTeXBuilder class
#
# Call the autolatex building tool.
#

class AutolatexBuilder(PdfBuilder):

def __init__(self, tex_root, output, builder_settings, platform_settings):
# Sets the file name parts, plus internal stuff
super(AutolatexBuilder, self).__init__(tex_root, output, builder_settings, platform_settings)
# Now do our own initialization: set our name, see if we want to display output
self.name = "AutoLaTeX Builder"
self.display_log = builder_settings.get("display_log", False)
self.verbose_level = builder_settings.get("verbose_level", 2)

def commands(self):
# Print greeting
self.display("\n\nAutolatexBuilder: ")

autolatex = ["autolatex", "--stdout", "--noview", "--pdf", "--pdflatex", "--file="+self.tex_name, "--synctex"]
for lvl in range(1, self.verbose_level):
autolatex = autolatex + ["-v"]
autolatex = autolatex + ["all"]

# We have commands in our PATH, and are in the same dir as the master file

# This is for debugging purposes
def display_results():
if self.display_log:
self.display("Command results:\n" )
self.display(self.out)
self.display("\n")

yield (autolatex, "autolatex run; ")
display_results()

self.display("done.\n")








2 changes: 1 addition & 1 deletion makePDF.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ def run(

# Safety check: if we are using a built-in builder, disregard
# builder_path, even if it was specified in the pref file
if builder_name in ['simple', 'traditional', 'script', 'basic']:
if builder_name in ['simple', 'traditional', 'script', 'basic','autolatex']:
builder_path = None
else:
# relative to ST packages dir!
Expand Down