LaTeX now available in Google Docs

Google Vice President and Chief Internet Evangelist (yes, that is really his title) and inventor of the internet Vint Cerf visited our campus a couple of years ago. At one point he asked about what people wanted from Google. I said that I would love a Google Docs/LaTeX mashup. How great would it be for mathematicians to collaborate on LaTeX documents on Google Docs? I can’t tell you how much I would love that.

So maybe you have me to thank for this news (har har har): Google Docs now has limited LaTeX integration. Now, it isn’t exactly what I asked for. You aren’t writing LaTeX documents. They have it set up like a word processor, with an “insert > equation…” menu item. It gives you a pop-up window and in it you can type LaTeX code (screenshot below). It shows you the corresponding mathematical formula and allows you to insert it into the document as an image. If you need to edit the formula later you can double-click the image and it will send you back to the pop-up window.

I just tried it out and found it to be usable. I can imagine getting frustrated every time I have to go to the pull-down menu, rather than typing LaTeX code straight into the document, but it is a step in the right direction.

In case you want to give it a try and don’t have a Google Docs account, I’ve set up a sandbox for you to play in. Edit to your heart’s content (just keep everything G or PG, please). [Sorry, the document is no longer there.] As with other Google Docs, you can also publish your work as a web page.

I’m still hoping that they will get true LaTeX integration, but it will probably never happen. This is a neat feature, but I won’t be able to use it for professional collaboration.

Full LaTeX integration would be nice, though it just occurred to me that it’s unlikely to happen because LaTeX is Turing-complete. By asking Google to compile our LaTeX code for us, we’re asking them to execute code from a full-featured programming language, which, among other problems, may never terminate. It’s the halting problem all over again!

Of course they could implement a subset of LaTeX, but people would still complain.

Ever since wysiwig editors were invented, I never got the point of maintaining LaTeX…it’s depressing to think that the most modern of technical minds are slaves to such technological inertia as to be hand-coding in an ASCII-based markup language instead of drawing their equations directly from the pictures in their minds, like Newton and Leibniz, then having the computer beautify them into scalable glyphs, like Newton and Leibnitz wish they could have done…

If you want to know why latex is better. You should try latex.
Once you become experienced with latex , it is simply much much much faster than using a wysiwig editor. Typing in equations with a wysiwg is very frustrating to someone who knows latex.

Here’s an analogy. Suppose you had to type in words with a “word editor” You click on a palette of letters and symbols and you have to type by clicking on letters. Now you’ve given up the advantage of touch typing and are forcing people to hunt and peck for letters. Ridiculous.

@blair if your mind set is that you care about how your stuff is displayed, that is, you have “pictures in your mind” then yes latex is a step backwards to you. If on the other you don’t care how it is displayed as long as someone seeing it thinks it looks professional, and all you care about is the content, then latex is great. If you are about controlling content and not representation then you will eventually grow into latex.

I started with latex in my first year as a masters student. I am now in my first year as a phd student and at this point, I am sure latex saves me time on assignments. Probably the first semester I started with it, it did not. Second semester it was probably a tie. After that, it started paying serious dividends.

Though that comes with a caveat: the reason it works for me (as a statistics student) is my course work standards are “turn in something that looks professional”, but there are no specific document rules to follow. That sort of environment is great for latex because you don’t have to get anything exactly right. If you were in course work where instructors typically had very demanding document standards and worse every other course seemed to use a different standard, that could get old very fast (unless they supplied the latex packages and appropriate document stubs in which case latex would be solid gold).

Dana Ernst sent this to me by email and asked me to post it as a comment:

If you type up a full-fledged LaTeX document in Google Docs, then you can use SpartanTeX to compile it. I haven’t used this extensively, but did play with it quite a bit. Here is the link for SpartanTeX:

I meant to say something about Dropbox, as well, but forgot. I’m currently using Dropbox to collaborate on a paper that I am writing (using LaTeX) with two undergraduates. The advantage is that each of us gets to use our own fancy LaTeX front ends. The disadvantage is that two people cannot edit a document simultaneously and there is no structure in place to prevent this. If two people edit the document, it is a race to the line to see who wins. The loser gets relegated to “conflicting version” status and any changes have to be merged manually.

Dana, I completely agree about the pros/cons of DropBox. I’m actually using it for an entire class of students. Fortunately, there is only one “secretary” per day, so only one person should be editing at any one time. But it would be great if they could put something together to make simultaneous collaboration better.

My team has found that LaTeX + Dropbox + Mercurial (or similar) versioning software is a good solution for collaboratively preparing documents. You keep the home copy of the tex file in your shared Dropbox folder and each author pulls a local clone when they are ready to edit. The author then pushes changes back onto the repository, letting Mercurial handle the merge (you sometimes have to resolve the changes by hand). Over the past ~1.5 years my laboratory has used this system for half a dozen papers with 2 to 3 authors per paper. It works quite well. We chose Mercurial over git because it seems easier for beginners to use. This system has the bonus of introducing students to software versioning, which is an important tool for scientists to know.

I love Google docs and use it almost every day. But until Google Docs handles cross-referencing of figures and equations and uses bibtex (or a similar database) for a bibliography, it simply cannot be used to prepare a serious academic document. Just not the right tool for the job.

By the way, I have measured the cost in time associated with using a GUI (in Microsoft Word) to enter equations. The time penalty for leaving the keyboard and picking up the mouse is huge — by my estimate, it is at least a factor of three slower to enter an equation-heavy page using MS Word than in LaTeX.

For internal documents and coursework, you can use one of the nice LaTeX templates provided by one of the professional journal. And not just AMS, AIP/APS, and IEEE journals provide templates. Even PNAS and the American Chemical Society journals have nice LaTeX templates these days!