This service is developed to compile latex documents online. It can build PDF directly from GIT repository with TeX sources or from any link to TeX file.
In addition, the service provides command-line utility (for compiling local documents), API and Stand-Alone version. See more below.
Compile .TEX file via link. (Limitation: includes will be ignored)
Compile GIT repo via link.
Compile local files or git repo via command-line interface.
REST API for compiling.
API
HTTP Response Codes
The service will return HTTP.2xx on success and compiled PDF file. Otherwise
a HTTP.4xx code will be returned with a compilation error log in response body.
For every compilation request you can pass the following additional arguments:
force=true This will force cache skipping and document recompilation
command=xelatex This will compile document with xelatex compiler. Other available options are:
pdflatex
xelatex
lualatex
download=sample.pdf This will initiate downloading of the resulting PDF
into the file with the name "sample.pdf"
Command-line interface
The command-line interface makes it possible to edit TeX documents in
vim/emacs and compile them whenever you want from the command-line. To do so, you will
need a tool called laton.
This command will result in a laton script created in a current directory. Put it somewhere
your $PATH references to make it available around the system.
Example 1: compile single file
If you've got a single file (say main.tex) that doesn't have any includes,
then you can compile it like this:
laton main.tex
After compiling file main.pdf will be created in the current dir
Example 2: compile files with dependencies
If your paper includes some files, you have to declare them to the
laton.
laton main.tex some-image.jpg some-cool-file.tex
NB The first file should be the file you want to compile, all others are
supporting files.
Example 3: compile local git repo
In case you store all your .tex and supporting files in a git repo, you
can compile the project with the command
laton -g main.tex
The script will behave as if main.tex includes each file stored in your git repo.
How it works?
In this section a brief description of the service from the inside is given.
Generally speaking the service is made out of two parts
Node.js part which with the help of express.js provides the REST API, and
with the help of mc bridges the gap with memcached instance
Bash scripts which handle all the jobs related to the service (fetching
files, hashSumming them, compiling e.t.c)
There are three types of requests:
Given a link to a .TEX file, compile it
Given a tarball with files structure, compile it
Given a git repo, compile it
Every request is handled in a bit special way
1. Given a link to a .TEX file, compile it
The URL of the given file is fetched and saved locally
The hash sum of the file is counted in some way
Check in cache if we've got a PDF for the hashsum
If yes, then just return the precompiled PDF from cache
If no, then compile the file, cache the result and return it to user
2. Given a .TEX file content, compile it
Given content is saved locally
The hash sum of the file in counted in some way
Check in cache if we've got a PDF for the hashsum
If yes, then just return the precompiled PDF from cache
If no, then compile the file, cache the result and return it to user
3. Given a tarball with files structure, compile it
The tarball is saved locally
The hash sum of the tarball is counted in some way
Check in cache if we've got a PDF for the hashsum
If yes, then just return the precompiled PDF from cache
If no, then extract file structure from the tarball, compile it,
cache the result and return it to user
4. Given a git repo, compile it
This kind of request is handled in a bit different way, as we can
get a hashSum of the repo without cloning the entire repository.
Using git ls-remote extracting sha1 of the master branch
Check in cache if we've got a PDF for the given sha1
If yes, then just return the precompiled PDF from cache
If no, then do a shallow copy of the given git repo
Compile it, cache the result and return it to user
DEPLOYMENT
This part is for you if you'd like to deploy the service on your
own machine. There are two ways to do it:
请发表评论