Wiki - README‎ > ‎Programming‎ > ‎

Sublime Text

textpad to sublime text (lots of good configs) [link]

theme editor [link]

textadept (alternative to sublime text?) [link]

package control [link]

themes [link]
afterglow theme [link]
{
"color_scheme": "Packages/Theme - Afterglow/Afterglow.tmTheme",
"tabs_small": true,
"theme": "Afterglow.sublime-theme"
}

flatron color theme [link]

limetext: open-source sublime text [link]

sublime text [link]

sublimegit [link]

latextools [link]
handy plug-ins [link]
projects: ignoring folders or files, custom settings, build commands [link]

custom build for latex [link]
pdflatex [~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/pdflatex.submlime-build]
{
    "cmd": ["/Users/jdenning/scripts/pdfmake.py","$file_name"],
    "selector": "text.tex.latex",
    "path": "$PATH:/usr/texbin:/opt/local/bin"
}
note: the path var is for OSX only.  it tells the ST shell where to find pdflatex, bibtex, and python2.7

pdfmake.py
#!/usr/bin/env python2.7

import sys,os,re,subprocess
import filecmp
import shutil
import platform

systype = platform.system()
if systype == 'Darwin':
    bin_pdflatex = '/usr/texbin/pdflatex'
    bin_bibtex   = '/usr/texbin/bibtex'
elif systype == 'Linux':
    bin_pdflatex = '/usr/bin/pdflatex'
    bin_bibtex   = '/usr/bin/bibtex'


def runandlog(cmd, logfile):
    ret_code = subprocess.call(cmd, stdout=logfile)
    logfile.flush()
    if ret_code:
        print 'ERROR!\nsee logfile'
        sys.exit(-1)
    return ret_code

def pdflatex(texfilename, logfile):
    # CAUTION!! -shell-escape: Enable the \write18{command} construct.
    #                          The command can be any shell command.
    #                          This construct is normally disallowed for security reasons.
    cmd = [bin_pdflatex, "-shell-escape", "-halt-on-error", texfilename]
    print 'pdflatex %s' % texfilename
    runandlog(cmd, logfile)

def bibtex(auxfilename, logfile):
    cmd = [bin_bibtex, auxfilename]
    print 'bibtex %s' % auxfilename
    runandlog(cmd, logfile)



path,filename = os.path.split(sys.argv[1])
if path: os.chdir(path)

# recursively find the root .tex file
# makes assumption that very first line contains the tex root info
#     % !tex root = root_filename.tex
re_texroot = re.compile( r"tex root *= *(.*)", re.IGNORECASE )
while True:
    firstline = open(filename,'rt').readline().strip()
    r = re_texroot.search(firstline)
    if not r: break
    nfilename = r.group(1).strip()
    if nfilename == filename: break
    path,filename = os.path.split(nfilename)
    if path: os.chdir(path)

auxfile    = '%s.aux' % os.path.splitext(filename)[0]
oldauxfile = '%s.old' % auxfile
bibfile    = '%s.bib' % os.path.splitext(filename)[0]
oldbibfile = '%s.old' % bibfile

tmplogfile = open('log.tmp', 'wt')
logfile    = open('log', 'wt')

# pdflatex it!
pdflatex(filename, tmplogfile)

# need to rerun bibtex?
rerun  = not os.path.exists(oldauxfile) or not filecmp.cmp(auxfile,oldauxfile)
rerun |= not os.path.exists(oldbibfile) or not filecmp.cmp(bibfile,oldbibfile)
if rerun:
    shutil.copyfile(auxfile, oldauxfile)
    shutil.copyfile(bibfile, oldbibfile)
    bibtex(auxfile, logfile)
    pdflatex(filename, tmplogfile)

# run once more for references
pdflatex(filename, logfile)

tmplogfile.close()
logfile.close()

print 'done!'

# look for warnings to print
spaced = False
re_citation = re.compile(r"latex warning: citation `([^']+)' on page ([0-9]+) undefined on input line ([0-9]+).", re.IGNORECASE)
for line in open('log','rt').read().split('\n'):
    r = re_citation.search(line)
    if r:
        if not spaced: print '\nWARNINGS:'
        spaced = True
        print '  CITATION MISSING: %s, pg %s, ln %s' % (r.group(1),r.group(2),r.group(3))

if spaced: print '\n'


Comments