# Embeddable in browser LaTeX editor/compiler plugin?

I am currently in the writing of an online LaTeX tutorial and I was wondering if it was possible to have something similar to learnpython.org but for compiling and editing on the fly simple LaTeX documents on a page? Because I would love to embed this on my website so that readers could interact with LaTeX without the need to install something or having to leave the page.

An example would be to compile this in browser in the form of an image or PDF:

\documentclass{book}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}

\title{L'histoire de bob}
\author{John}
\date{June 6 2078}
\begin{document}

\maketitle

\part{Introduction}

Some stuff

\end{document}


Is it possible? If it isn't, are there any possible alternatives?

-
@bobicool For equations there is MathJax, which is JavaScript driven. Wikipedia has something very similar. For LaTeX itself you can capture the input and sent it to the server. Depending on the server language you can then run the executable and process the input. I have tried this on localhost using php and there are no issues. However, security needs to be addressed on a public system. There is nothing off-the-shelf though that I know. –  Yiannis Lazarides Jan 14 '12 at 8:48
For the purpose of an online LaTeX tutorial I would not use MathJaX. Whilst it is based on LaTeX, it is not LaTeX and any discrepancies might serve to confuse those for whom you are writing a tutorial. –  Andrew Stacey Jan 14 '12 at 10:16

## migrated from stackoverflow.comJan 14 '12 at 7:42

This question came from our site for professional and enthusiast programmers.

You could look into the Common LaTeX Service Interface which powers ScribTeX and, I believe, LaTeX Lab. The CLSI exposes TeX compilers as a web service by accepting requests with document code, compiling the documents in a sandboxed environment and returning the PDF results.

For displaying PDF output in the browser, you might want to check out Mozilla's PDF.js project. The code is still in beta, but the feature set and rendering quality is pretty impressive.

-
This looks like some good code. –  Yiannis Lazarides Jan 14 '12 at 19:08

You could use ScribTeX which runs a TeX Live 2009 distribution (at the moment). It allows you to create files (for, say, storing .bib content) and even compile using pdflatex, latex or xelatex. In fact, your document compiled without problem.

It does not require a login, but temporary users would lose their saved content without one.

Of interest, on a smaller scale, might be the Online LaTeX equation editor. It seems like this can be driven from your own web page (click on the install link). However, this only provides limit online capability for editing equations and not entire documents.

-
Is it possible to embed ScribeTeX on a webpage? –  bobicool Jan 14 '12 at 2:52
@bobicool: I'm not familiar with doing that kind of thing. –  Werner Jan 14 '12 at 3:36
If you're only looking for math, MathJax is the best (and most common, I think) option. Other se sites like physics and math use it, I believe. –  Tikhon Jelvis Jan 14 '12 at 3:38
For a tutorial, MathJaX is not a good option. It is not LaTeX and so the differences would confuse the students when they come to write real LaTeX. –  Andrew Stacey Jan 14 '12 at 10:16