Skip to content

Commit

Permalink
Include the AutoLaTeX compiler with the builder API of LaTeXTools.
Browse files Browse the repository at this point in the history
This commit is related to the issue #344.
  • Loading branch information
gallandarakhneorg committed May 3, 2014
1 parent 517c5a3 commit b113c0a
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
8 changes: 7 additions & 1 deletion LaTeXTools.default-settings
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
// "traditional" replicates the 'old' system based on
// latexmk (TeXLive) / texify (MiKTeX)
//
// "autolatex" invoke autolatex with the settings
// specified in "builder_settings"
//
// "script" external script: just invokes the script
// specified in "builder_settings"
//
Expand Down Expand Up @@ -122,6 +125,9 @@
// (built-ins): true shows the log of each command in the output panel
"display_log" : false,

// (built-ins): the level of verbosity for the builder (greater or equal to 0)
"verbose_level" : 2,

// Platform-specific settings:
"osx" : {
// See README or third-party documentation
Expand Down Expand Up @@ -174,4 +180,4 @@
// Similarly, the formatting for the autocomplete panel:
"cite_autocomplete_format": "{keyword}: {title}"

}
}
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 @@ -259,7 +259,7 @@ def run(self, cmd="", file_regex="", path=""):

# 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', 'default','']:
if builder_name in ['simple', 'traditional', 'script', 'default','autolatex','']:
builder_path = None

# Now actually get the builder
Expand Down

0 comments on commit b113c0a

Please sign in to comment.