Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjo committed Mar 6, 2014
0 parents commit 5272032
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
npm-debug.log
node_modules
20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2014 Thomas Johansen.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# LaTeX package

A simple utility package for Atom that invokes `latexmk`.

## Installing
Use the Atom package manager and search for "latex", or run `apm install latex`
from the command line.

## Status
This package is in an extreme alpha state. Right now everything is very naïve,
there's no error handling, progress indicator, etc. The path to `latexmk` is
hardcoded to `/usr/texbin/latexmk`, and forces usage of `pdflatex`.

## Usage
Invoke the build command by pressing the default keybind `ctrl-alt-b` while in
a .tex file.

All output is directed to a directory called `output` within the directory
containing the target file.
11 changes: 11 additions & 0 deletions keymaps/latex.cson
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.

# For more detailed documentation see
# https://atom.io/docs/latest/advanced/keymaps
'.workspace':
'ctrl-alt-b': 'latex:build'
22 changes: 22 additions & 0 deletions lib/latex.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
path = require "path"
runas = require "runas"

module.exports =
activate: ->
atom.workspaceView.command "latex:build", => @build()

build: ->
editor = atom.workspace.activePaneItem
# console.debug editor

file = editor.buffer.file
# console.debug file

if file?
# file = editor.getUri()
dir = path.dirname(file.path)
outdir = path.join(dir, "output")
# console.debug outdir

code = runas("/usr/texbin/latexmk", ["--pdf", "--f", "--interaction=nonstopmode", "--outdir=#{outdir}", file.path])
# console.debug code
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "latex",
"main": "./lib/latex",
"version": "0.1.0",
"private": true,
"description": "A simple utility package that invokes latexmk.",
"repository": "https://github.com/thomasjo/atom-latex",
"license": "MIT",
"engines": {
"atom": ">0.65.0"
},
"dependencies": {
"runas": "~0.5.4"
}
}

0 comments on commit 5272032

Please sign in to comment.