Building LaTeX Lab (read)

By Bobby on Wed, 26 May 2010 08:08:02 +0000

Building LaTeX Lab

The following outlines the evolution of various implementations of LaTeX Lab. This document was created in Google Docs with Google Drawings. There's also a PDF version, created and compiled in LaTeX Lab.

Goals:

  • Open Source.
  • Single Eclipse code project (GWT + AppEngine in Java)
  • Consume services already available on the web - promotes reuse and standardization.

First Draft


In this draft the LaTeX Editor is built with GWT and interacts with a collection of web services - possibly all third party - directly from the browser. The application does not have a dedicated server-side presence and could be served from the AppEngine or live in the user's desktop.

Implementation:

  • File System - Google Docs with GData API
  • Authentication - GData AuthSub
  • LaTeX Compiler - No 3rd party service available. Build as generic a LaTeX service as possible, allow 3rd parties to host a LaTeX service with minimum effort.

Challenges:

  • How to expose LaTeX as a service?

    Build a minimal chroot containing a stripped down TeX Live instance. Dynamically provision a jail per user. Expose as a web service - in LaTeX Lab, as an XML based PHP service - see CLSI project.

  • How to compile projects with multiple resources? (e.g. one LaTeX document, 1 style file, 4 images)

    Have GWT app send current document contents, along with references to required project resources, to the LaTeX service. The LaTeX service should be able to fetch and process all resources, using a resource cache for performance.

  • LaTeX compiler will need to live in a separate domain (it can be plugged into LaTeX Lab as a third party service). How to get around cross domain issues?

    Use hidden form to POST compile request to LaTeX service. LaTeX service writes a response .js file containing the result. LaTeX Lab checks for response. Times out after X seconds and informs the user.

  • How to interact with Google Docs directly from the browser?

    There is a JS client library for GData. Create GWT bindings for this library and use within app - see gwt-gdata project.

  • How to emulate Google Docs UI?

    Use as many native GWT elements as possible. Leave all style definitions in external .css file. Use gwt-dnd for drag-and-drop and gwt-incubator to fill in the gaps.

Problems:

JS client library for GData does not support reading or writing document contents - though it can be used to create, delete, rename and list documents. This means that a GWT friendly service will need to sit in front of GData.

Second Draft



In this draft the client app still interacts directly with Google Docs via the GData JS client library, but only for creating, deleting, renaming and listing documents. Queries to retrieve or update document contents go through a new dedicated GWT RPC service - this service introduces additional costs and adds a server-side dependency, on the AppEngine.

Problems:

  • Allowing the LaTeX service to retrieve resources in Google Docs requires sharing the authentication token. This would share all of a user's documents with what may be a 3rd party service. This risk can be eliminated through the use of secure AuthSub, which imposes a requirement that all Google Docs queries be signed with a certificate. The 3rd party service will not be able to sign unsolicited queries because it does not have the certificate. Since Secure AuthSub is not supported by the GData JavaScript client library, it can no longer be used.

Third Draft (final)




In this draft all Google Docs queries are routed through a dedicated AppEngine service. Secure AuthSub is used. When compiling, the client obtains signed authorization headers for the documents to be compiled and includes them in the compile request. The LaTeX service will be able to access only those resources.

Adding Collaboration:

Collaboration can be added as an additional dedicated service, manipulated directly from the browser, though there will be cross-domain issues to deal with:


Some additional features would also fit the service model and could exist as dedicated services:
  • Cloud clipboard service.
  • Spellchecking service.
By adding reusable services we significantly decrease the level of effort and upfront costs inherent in building web based applications.

Open Questions:

  • Can a Collaboration service live separately from the File System service.
  • Can the AppEngine dependency be removed, yielding a pure GWT, serverless app?
  • How to register a custom app, such as LaTeX Lab, in Google Docs, as the default editor for a given file type?





(see all) web service, tile engine, google docs, flash, window, penn, pixel, python, game, compiler, server, tlslite, token, reference, rtmp, vmware, p vs np, Google Docs, poweredge, javascript, component, vbulletin, proxy, networking, vmware esxi, GData, forum, plugin, gwt, outlook, scales, puzzle, GWT, java, attach, shining force, subsets, appengine, permutations, pong, authentication, roland, screenshot, np-complete, gdata, neural net, php, latex, audio, AppEngine