2013-04-26

Thoughts on Typesetting

In 2012 IAP, I taught myself how to use LaTeX by typesetting the 8.033 — Relativity lecture notes. I also did this so that the lecturer I had that semester and the lecturer for the following semester would both have these notes at their disposal; for the record, the former is on sabbatical this academic year, while the latter did indeed use it when he taught the class this past fall. I needed to teach myself LaTeX because I was going to be taking 8.13, which I did this past fall, and that requires LaTeX use for papers (and recommends Beamer for presentations as well). That said, recently I was hanging out with some friends and a couple of them suggested that LaTeX isn't really necessary as far as producing scientific papers goes, because Microsoft Office Word 2013 has an advanced enough equation editor that it can essentially replace LaTeX, especially as it now recognizes basic LaTeX syntax. At first, given how much I had used LaTeX (and also given some of my past negative feelings toward Microsoft), I felt a little defensive. But then I realized I should give the comparison a fairer shot, so I decided to see if I could try to replicate one of my PRL-formatted LaTeX-typeset papers in LibreOffice Writer. Follow the jump to see my findings.



There are two things to note here. The first is that I used LibreOffice Writer rather than Microsoft Word. The main reason is because I do all of my LaTeX on the MIT Athena computers which run Ubuntu, so I wanted the comparison to be fairer by being on the same computer setup. Another reason (or two) will be elaborated shortly.

Anyway, I picked out my in-progress paper for 8.06 — Quantum Physics III for use in LibreOffice. The title could be written just fine. But then right after that, I had issues with the abstract; there doesn't appear to be a nice and easy (or perhaps any) way to get a left-justified block of text that does not take up the full page width where the block is centered with respect to the page width. The closest I could get was to make a single-cell table and remove the border, but that was set at the left edge of the page.

After that, I tried replicating the main content. Most of the content could be replicated because it was a lot of text. Also, the pictures were really easy to add, in stark contrast to LaTeX which generally has issues with adding images. In addition, LibreOffice Writer did not produce weird blocks of blank space due to typesetting issues like LaTeX did in my introduction section; this is intimately tied with LibreOffice Writer being a WYSIWYG word processor. However, I did run into an issue with the section headers, in that the fonts were too big compared to the LaTeX counterpart; this however is fairly easily remedied.

The biggest issue, of course, was with rendering equations, and this is frequently cited as the biggest strength of LaTeX in comparison to WYSIWYG word processing. Even with the LaTeX extension, it still couldn't match the range of characters and symbols possible in LaTeX; this is reportedly an issue even in Microsoft Word 2013. More importantly, though, I don't have complete control over things like vertical spacing and horizontal positioning in equations like I do in LaTeX, and this too remains true in a comparable program like Microsoft Word 2013; for instance, I can't add a certain fixed amount of vertical space in between two consecutive equations except by pressing 'ENTER' in LibreOffice Writer, which is not the same as specifying "\vspace{0.2em}" directly. Essentially, the main issue is that even if Microsoft Word and LibreOffice Writer start accepting basic LaTeX syntax, it is unlikely that they will be able to reproduce the full range of symbols and formatting available in LaTeX (though I will touch upon this later).

This is not to say that LaTeX is not also flawed. In fact, one crucial thing to remember is that WYSIWYG and WYSIWYM document editors each have their own strengths and weaknesses, and it is important to therefore use the right tool for the job. Sure, it is technically possible to write a simple letter in LaTeX, but a lot of formatting commands will need to go into it before it stops looking kind of weird based on LaTeX presets. This works in much the same way as how it may technically be possible to insert lots of equations into documents in LibreOffice Writer, but that doesn't make that a good tool for that job. For example, over spring break, I typeset my CV into LaTeX because it is considered good form for undergraduate physics students to do so for the future. My CV looks a lot prettier in LaTeX than it did in LibreOffice Writer, yet I realized that if I wanted to typeset my CV to look exactly like my 1-minute format job in LibreOffice Writer, it would take so much time to format that it would not be worth the effort at all. It is quite a bit more difficult to consistently specify margins, horizontal spacing for bulleted lists, et cetera. Plus, as far as I have seen, LaTeX basically can't deal with other fonts (unless third-party packages exist), especially if lots of equations are involved.

What are some other issues with the two? Well, LibreOffice Writer requires a lot of clicking in random windows to get stuff done; by contrast, LaTeX requires typing everything, which is convenient because my hands would not have to really leave the vicinity of the keyboard, so my typing flow does not get messed up. Plus, LaTeX is a lot better at handling global properties of the document. For instance, if sections, list items, or figures are rearranged, renumbering is done automatically. That said, if local changes are made, that often takes more commands than the length of the actual content; LibreOffice Writer by contrast can easily change the style of lists or local paragraphs. Speaking of paragraphs, though, LaTeX usually adds spacing exactly as specified (such as "\vspace{0.2em}"), except for when it doesn't, like the weird blank space that I guess is done so that a new section header is not introduced at the bottom of a page with the beginning of its content relegated to the next column; LibreOffice Writer is fairly limited in the sorts of spacing it can add, but it doesn't add any other weird spacing automatically because it follows the principle of WYSIWYG and does not go by any default typesetting rules. This also applies to margins, overall document alignment, and stuff like that.

The final thing to discuss is compatibility. A lot of people say LaTeX is better than Microsoft Office or even LibreOffice because of compatibility. I think the argument for this is basically that LaTeX is available on all major platforms, while the same cannot be said for Microsoft Office; furthermore, to modify a document usually requires the same version of Microsoft Office, while LaTeX documents can be modified by any ordinary text editor. While these are all certainly true, it is also important to note that to be able to compile a LaTeX document (which is what produces a readable end result) requires that all the dependent packages be installed, which is not a guarantee in every situation.

So what's the verdict then? I guess what I really want is some sort of nice hybrid document editor where I can easily switch between WYSIWYG and WYSIWYM. I want to be able to easily choose one right before I start creating a document, so that the document's initial formatting is chosen appropriately. Then, the WYSIWYM-style code should be editable, with the initial formatting reflected there. If I want to add equations and manually specify spacing, I should be able to do that. Meanwhile, if I want to write like I do in LibreOffice writer and be able to modify bulleting formatting through a GUI without writing a bunch of complicated commands, I should be able to do that too. Maybe this is just an unattainable pipe dream, and maybe the WYSIWYG and WYSIWYM philosophies of document editing are fundamentally in conflict, but I can dream, can't I? In the meantime, though, I'm going to use whichever document editor seems more appropriate for the purpose, and for me, that is going to be LaTeX more than LibreOffice. I can certainly say though that I have come to appreciate the nuances of each more, and I can now say that the reason for physics journals requiring LaTeX in a particular format instead of Microsoft Word or LibreOffice Writer templates is a lot more subtle (and perhaps a bit more debatable) than just the fact that LaTeX is made for handling equations. But that could be wrong too; it is entirely possible that this was ultimately an unfair, biased comparison (and it probably was), and that if physics journals had spent as much time and effort creating Microsoft Word/LibreOffice Writer templates to look the same as their LaTeX templates, then I wouldn't be complaining about the former.