## Thursday, July 28, 2011

### The Problems of LaTeX

By request a post that may create the biggest backlash since I declared myself Unix free.

\begin{rant}
LaTeX is a great system for mathematical documents...for the 1980s. But the computing world changed dramatically and LaTeX didn't keep up. Unlike Unix I can't give it up. I write papers with other computer scientists and mathematicians and since they use LaTeX so do I. LaTeX still has the best mathematics formulas but in almost every other aspect it lags behind modern document systems.

WSYWIG: I love seeing the final document as I write it. There are front ends to LaTeX that approximate this but they produce LaTeX code that make it near impossible to collaborate unless everyone uses the same editor and we don't. "Code" is the right word, I have to compile a LaTeX document then start a separate program to see it.

Collaboration: The very reason I'm stuck with LaTeX is its greatest weakness. We all have different macros, style files and bibtex formats (and some don't use bibtex at all). We all have to agree in the beginning which of our homegrown stuff we want to use and merging already written documents is a bear. How often does some one send you a LaTeX document and you have to email back that they forgot some style file?

LaTeX documents are saved as text files which have different formats on different machines. I hate seeing ^M at the end of every line. Some people to break up LaTeX lines at reasonable places, other people don't messing up my editor and trying to figure out what my co-author has changed.. At least email attachments avoid the old ¿From problem.

Microsoft Word has a great system for tracking revisions. Google Docs lets people edit at the same time. Nothing close to either for LaTeX.

User Friendly: LaTeX is not user friendly. Try opening a text editor and (without looking at an old LaTeX document) write a LaTeX document to say "Hello World!" that will compile on the first try. Now go to Google Docs, create a new document and type "Hello World!". See the difference. Don't even get me started on creating a table.

Backward Compatibility: In the early 90's, LaTeX went through a major upgrade. There was a compatibility mode that claimed to be fully backward compatible. Not even close. Then they changed the font system, rendering my old documents unreadable. Luckily LaTeX hasn't changed significantly since then.

It's not difficult to convert between Word, Docs and most other document systems but nearly impossible to move to/from LaTeX.

I don't use LaTeX when I don't need to. I usually use Word or Docs for recommendation letters and other documents without much formulas and references including my upcoming P/NP book.

What we need is a way out of LaTeX, add-ons to Google Doc that make it as nice for math as LaTeX, and the ability to import old LaTeX documents, style files and bibtex files. Not holding my breath.
\end{rant}

1. Have you checked out this tool? Its google docs for latex
http://docs.latexlab.org/

You can have a private installation too. The only limitations for it is really document processing time. You can attach a external document processor.

2. I more or less completely agree with your criticisms of LaTeX, and would love to stop using it. But to me, the most compelling reason to keep using it is that it enforces separation between style and content. This makes it easy to enforce a consistent look and feel for documents, and makes it way, way easier to migrate from one style to another. Try doing that in Word.

3. You need a good front end. Have you tried LyX? Also modern TeX editors have built in viewers which show and automatically update your modifications. A good front end would solve the first and the third problems.

I agree with the second complaint. I don't think that LaTeX is designed with collaboration in mind, but we have the same problem with program codes and other off-line editors. I don't use MS Office and cannot say how good it is. But again, the problem is the front end, not LaTeX itself. If MS Office supported LaTeX you would be able to use the same "great system for tracking revisions", same with Google Docs.

4. I would think that one could use some sort of revision control software e.g. git, subversion, CVS, etc.

5. No doubt, LaTeX is outdated. I believe, the reason why it is not being reconsidered so as to address the issues you named is partly because nobody really expects to achieve such a significant progress, which would worth changing the matter; and partly it is because there no geniuses like Knuth and Lamport around ready to invest their intelligence into such an ambitious project.

Your comparison with MS Office and Google is not correct. They are so simple and uncomplicated precisely because they can not in principle produce documents of that typographic quality as LaTeX does. Not even close. If you typeset a complicated formula the only way to make it look perfect is to give enough hints to the typesetting program - this is unavoidable for the latter can never beat the user at that. You should do comparison not to Google and MS but to the professional tools for typesetting. And these are really complicated.

6. You need to use a version control system like svn or git and a good editor along with latex. That will solve many of your problems, other than, of course the WYSIWYG. Which in my opinion is a feature, not a bug.

7. Most of the time I love latex and have few of the problems you describe. This is because (like many of the above posters) I use a great editor (Emacs + AUCTeX) and version-control system (svn + emacs psvn mode), all tightly integrated with each other. This mitigates most of the above problems: it closely approximates WYSIWYG with forward/reverse-search; coauthors can seamlessly do concurrent edits on different parts of the documents (with each of us using our preferred editors and OSs); and I can see exactly what a coauthor has changed, nicely color coded, with just 2 or 3 keystrokes using psvn mode.

Granted, this is definitely a "power user" system, very much in the Unix tradition of combining many highly specialized and powerful tools, and it took many years to refine to its current state. It takes time to learn, but if you're going to be spending hundreds of hours working with a set of tools, I figure it pays to invest in learning how to use them most efficiently. And in recent years I have been able to collaborate seamlessly with many people who have never before used version control, and who work on different platforms (Mac/Windows/Linux), so it's not as if you have to be an uber-hacker. Even a small investment of time to learn the basics can save hours of trouble later on.

With all this said, there are definitely still quirks and problems with the LaTeX ecosystem. It would be terrific to have a well-behaved "velvet glove" around the LaTeX hammer, for beginners or those who just don't want to learn new tricks.

8. The main reason why I like LaTeX is its "self organization".

When you write the first draft, you don't need to worry about things like "what notation should I use", "how to get right references", etc. Just use \newcommand, put here any "draft notation", and only come back to these "notational problems" when the paper is finished. That is, if you don't like the current look of the document or formulas, you later can change ALL this in few minutes, without going through the whole document. And you can be sure that all changes will be consistent! Exactly what a lazy mathematician needs.

The problem with collaboration is "home made": one should just avoid any external style files, except those present in any LaTeX system. The rest is a plain ASCII file which can be opened on any platform.

The only real weakness of TeX system I see its poor graphic interface. Making pictures in MSWord or the like is indeed much easier. Programs like xfig or xygraph still require to much effort.

9. % Oh, please, it's really NOT that hard.

\documentclass{article}

\begin{document}

Hello world!

\begin{quote}
Microsoft Word has a great system for tracking revisions. Google Docs lets people edit at the same time. Nothing close to either for \LaTeX.
\end{quote}

Get a real editor!

\begin{quote}
It's not difficult to convert between Word, Docs and most other document systems but nearly impossible to move to/from \LaTeX.
\end{quote}

Unless, of course, your document has \emph{math} in it. Or footnotes. Or pictures. Or an automatically generated index, table of contents, bibliography. Or any non-default document formatting.

\begin{quote}
other documents without much formulas and references including my upcoming P/NP book
\end{quote}

Ah, I see. You're writing a scholarly book about mathematics without formulas or references. Got it.

\begin{quote}
In the early 90's, \LaTeX\ went through a major upgrade.
\end{quote}

You're complaining that your document processing program is stuck in the past, and as evidence you mention compatibility issues in a revision released \emph{twenty years ago}? Really?

\end{document}

10. Programs like xfig or xygraph still require to much effort.

You're doing it wrong.

\includegraphics[height=2in]{anyPDFfile}

11. #3: I try LyX every few years and based on your comment I just tried it again.

After figuring out how to open a .tex file (answer: you can't import anything until you first start a new document), I discovered that it doesn't handle proof environments, lemma or theorem environments, or any custom mathematics macros, and in general is terribly ugly (in an editor that claims to be WYSIWYG, why is the default background color PINK?).

With those complaints out of the way, it is still better than I had expected, and might be suitable for simple latex documents without much math.

After a few more minutes of use, I have changed every display color with "background" in its name to white and math equations still have a pink background. Random toolbars keep popping up -- they seem to be tied to mouse gestures. It just doesn't work.

12. Jean-Frédéric1:00 PM, July 28, 2011

Microsoft Word has a great system for tracking revisions. Google Docs lets people edit at the same time. Nothing close to either for LaTeX.

13. http://en.wikipedia.org/wiki/Collaborative_real-time_editor#List_of_current_editors

I think what LaTeX needs is a more intelligent diff program that would work with svn.

For editor, I use LEd (latexeditor.org). It is very easy to learn and has a built in viewer. The authors said they were going to add utf-8 and built in pdf viewer but it seems they have stopped working on it. Also try TeXMakerX, it is a good editor.

14. Your points are not about LaTeX, they are about editors and tools, and you are right, they can be much better. Google Docs with LaTeX support would be awesome.

15. Check it out: http://www.lyx.org/

16. All in all, Lance seems to prefer "write what you want, I'll show how it will look". The basic principle of TeX is "say what you want, I'll do the rest for you". LaTeX cares about things which an MSWord users must care themselves about: abbreviations, cross-references etc.

God bless TeX/LaTeX inventors: I remember this dark time of typing papers with a real typewriter, and about hours spent to get all consistent. Google Docs, MSWord an similar are designed for *quick communication* (twitters and the like), not for a serious work.

17. #11: LyX absolutely supports theorem environments. If you're using LyX 1.6 or newer, go to Document -> Settings... -> Module and add "Theorems (AMS)", "Theorems (AMS-Extended)", and one of the numbering modules if you care about whether your theorems are numbered sequentially / by section / etc. The relevant environments should then appear automatically in the pull-down environment menu.

Similarly, you can add custom macros by adding them in Document -> Settings... -> LaTeX Preamble, or right in the middle of the document by using Insert -> Math -> Macro. See http://wiki.lyx.org/Tips/MathMacros for details.

Sorry about the pink background, though. I've never tried to change it, so I don't know if there's an easy solution.

18. I agree, there haven't been enough flame wars in this comment section lately.

WYSIWYG: There are wonderful editors that compile as you edit.

Collaboration: Combine with Subversion or Etherpad.

User friendly: Depends what you're trying to do. When you make a Word document, how do you adapt it to a specific journal's style?

Backward compatibility: How does Office do with your Microsoft Word for DOS files from the 1980s? Just curious.

While OpenOffice has gotten better recently, I wish there were a real Microsoft solution for at least viewing Office files on Linux, because the last time I looked it was still faring pretty horribly on all of the advanced features you like (notations, version control). At least PDF files can be displayed faithfully, for free, on any platform.

19. My god, I wonder why I was even subscribed to this blog. *unsubscribes*

20. Today I opened up a dissertation. I immediately went "eww, this was written in MSWord."

LaTeX is just _pretty_.

21. I find Scientific Word is pretty convenient. I have not attempted to collaborate with anybody using it, though.

22. "How often does some one send you a LaTeX document and you have to email back that they forgot some style file?"

Never. Don't use email for document collaborations. Put it all on Dropbox.

If you think LaTeX is missing WYSIWYG, you're missing the whole point.

And when it comes to convenience, imagine just writing a load of raw text, wrapping it in \begin{document} and \end{document}, picking a documentclass, and it looks pretty. Super-professional looking letters, you name it, not just journal articles. As an undergrad, I used to write papers for literature classes or whatever using LaTeX, it is so versatile.

24. A few minor comments: of course, latex macros are one way to make it easy to change notation very quickly without introducing errors. As many have mentioned, using a version system (like svn, git, mercurial, etc.) makes collaboration easy, and there are free public ones out there. Another reason to use latex is that it is fast to go between paper, slides, and poster (eg latex, beamer, a0poster, etc.) using the same figures (pdf includes).

An of course, we can't forge the top 10 ways to tell that a mathematical result is wrong :-) --- see reason one at:

http://www.scottaaronson.com/blog/?p=304

25. I love LaTeX. MS Word is a joke. Too much crashes, unreliable, unstable and ugly.

26. Windows: monstrous programs that do many things. The Unix philosophy: programs should do one thing and do it well. LaTeX is a typesetting language and nothing else, and it does what it's supposed to do very well. This is not a problem, it's a philosophical choice. Since the typesetting is kept separate from the editor, the spellchecker, the version control, etc., users now have more choice to use different software to provide each of these functionalities so that they can create a personalized document-creating experience for themselves.

27. Latex allows me to use my favorite editor vi.

28. What I don't like about LaTeX is that whenever you want to do something little bit nonstandard (like having a table with double-line boundary or or putting Fig. 1 and Fig. 2 side by side), then this is typically possible, but you have to go through extraordinary efforts involving hunting down obscure outdated/unmaintained/deprecated packages and getting used to weird syntax. On the other hand, in MS products, everything is either only a few clicks away or impossible :)

29. On the other hand, we now have a very nice place to get great answers from experts on *tex-related things: http://tex.stackexchange.com/

30. "That's the way it is with any powerful tool: There's always more to learn, and there are always better ways to do what you've done before." D. E. Knuth

If you have no idea of how to use a language, don't blame the language. What else? Read the comments. They point out the most important flaws of your arguments. The only thing I need to add is, give texlipse a try. It lets you use eclipse for writing LaTeX documents. My favourite tool chain in conjunction with SVN for eclipse.

http://www.texample.net/tikz/examples/

The sourceforge page:

http://sourceforge.net/projects/pgf/

Happy editing!

32. Incidentally, on the issue of style files, there's really no good reason to be using antiquated hand-coded style files. You should be using standard packages in standard distribution and that generally works fine.

For the anon complaining about doing non-standard tables, have you ever had to battle with bizarre hidden forced fontification/itemization/tabbing behavior in word, or even wrangling with tables ? Ugh.

33. No doubt, we could do better... but my experience with Word has not been positive.

34. Here's Donald Knuth's take on this topic.
An Earthshaking Announcement
I haven't enjoyed a video this much in a long time!
http://river-valley.tv/media/conferences/tug-2010/Don-Knuth/

35. Check "aurora" for MS Word and PowerPoint (http://elevatorlady.ca/). With an add-on like this in Google Docs probably you'll get closer to nirvana...

36. I firmly believe Tex to be the greatest achievement in Computer Science and wouldn't want the program to change in any way.

37. "a post that may create the biggest backlash"

My experience: mathematicians use LaTeX, amateurs use MS. B.t.w. all P=NP and P!=NP "proofs" I've seen were in MS. Is this just an accident, or a difference in genomes?

38. Post completely misses the point. LaTeX is terrible, but not for the reasons your describe.

The programming language itself is terrible (I'd love to see a modern take on TeX using functional programming concepts). The error messages can be extremely cryptic. Sometimes getting LaTeX to do *exactly* what you want takes hours because you have to fight its internals (and often "turning off" default behavior doesn't). The libraries have lots of annoying corner cases (oh, you wanted to do THAT with a verbatim environment?). Coding anything slightly non-trivial is an exercise in memorizing the entire TeXbook, which is probably why people on mailing lists love to say "oh you just shouldn't do that--stick with the defaults!"

> and partly it is because there no geniuses like Knuth and Lamport around ready to invest their intelligence into such an ambitious project.

Nobody rewrites it because the only people who care are researchers, and rewriting LaTeX doesn't count towards your tenure case. Also, it would take forever to rewrite all of the macros and styles that people have developed over TeX's long history. It'll never happen.

39. Thanks for the link Eleanor. It was hilarious.

40. When will your upcoming P/NP book be out?

41. @Anonymous 6:42 PM, July 29, 2011

Good point. TeX feels like assembly language. LaTeX is better but still far away from high level languages like C++, Java, or Python.

But to address those points we don't need to reinvent the assembly language part, we just need a good high level language hiding all TeX internals that can be translated to TeX, the same way Python and C++ codes are translated to assembly by GNU compiler. With this view, there is not a need to translate all packages, macros, and style files, they can be just like external libraries written in assembly.

42. I use mathoverflow.net "New Question" to do WYSIWYG Latex editing. Regarding style/content separation -- Latex has \Beta but no \Alpha, forcing people to use A, even though capital alpha and capital A have different unicodes and render differently in some fonts

43. You guys must do all your programming in assembler.

LaTex is a bad joke. You're supposed to be writing not typesetting. If you want to be a writer rather than a typesetter get MS Word and Mathtype. Mathtype produces the same quality typeset equations as LaTex and will even produce LaTex code if you want. Better yet, get ScienceWord and start doing technical writing.

44. I'm really surprised that you're so upset with Latex. Most of us computer science students do not have any problem with programming in Latex. Similarly, I'd rather program up my images in Tikz, which has loop structure which means we can program up rather complicated graphs easily. Moreover, the same code can be reused in other situation painlessly.

I also don't see why WSYWIG is so important. With all the big LCD monitor we have these days, we can always use half of the monitor for the editor and half of it for the viewer, and so viewing typesetting results is rather immediate.

45. "including my upcoming P/NP book" merchandise-much?

46. Aaronson's ten signs a claimed mathematical breakthrough is wrong starts with "the authors don't use TeX"

47. How often does some one send you a LaTeX document and you have to email back that they forgot some style file?

Speaking as someone at the other end, I've found one of the biggest problems is authors who don't send in bibliographies. BibTeX does not work by magic. It doesn't get the bibliographic data from thin air but from .bib files. If use BibTeX to produce a bibliography you must send the .bib (or .bbl at least) files.

48. \ifproceedings
The proof is in the full paper.
\else
\begin{proof}
blah blah blah
\end{proof}
\fi

Wonderful!

49. I highly commend Donald Knuth's Bulletin of the AMS article Mathematical Typography (1979) which begins 'Mathematics books and journals do not look as beautiful as they used to ...'

Here the point is that LaTeX was created as a tool for preserving and increasing the beauty of mathematical typography ... no-one has ever accused MicroSoft Word, Google Docs, or even Amazon's Kindle of achieving *that*.

May I confess too, to a great fondness for TeX add-ons like Beamer, TikZ/PGF, and memoir.cls. Tools this powerful are *never* going to be easy-to-use. Good! :)

50. Dear Lance,

Please stick to writing about what you know: academic life and complexity. You only embarass yourself when you try and start a technical discussion on subjects you know little about.

51. ... he said while writing on a blog.

HTML isn't WYSIWIG, and has always trended towards _more_ abstraction of form from content. I suppose that HTML isn't a modern document system either?

52. I would never ever see myself using anything else than latex for writing papers.

it is ridic that u even mention other possibilities.

and yes, use emacs/gnu as editor and u will be fine.

53. By the way, I see that Peter Wilson, who is the author of the memoir class, is past Editor-in-Chief of IEEE Computer Graphics and Applications.

Now I understand why the documentation for "memoir.cls" is so terrific, not only in the technical sense, but also in its pithy advice:

-------

“Sometimes, such as when trying to meet a University’s requirements for the lay-
out of your thesis, you may be forced to ignore the experience of centuries.”

--------

Wilson's documentation for the memoir class is included in most TeX/LaTeX distributions as the file "memman.pdf".

What's terrific about Wilson's documentation is that it describes, in far greater detail and depth than any other document (known to me), the nuts-and-bolts interface between the centuries-old principles of good typography and the idioms of TeX/LaTeX.

The world of Microsoft Word, Google Docs, etc. offers nothing comparable.

54. I'm disturbed by this post; I see it as a personal attack on Knuth. He is the smartest man since Van Neumann; if he says TeX is way to typeset then that is the final word on the question. Nobody has the credentials to gainsay his wisdom.

55. Anonymous, please understand that Knuth and von Neumann are modern-day agents of a far older typographic cult dating to Claude Garamond (1480–1561).

Other active agents of this cult are Dr. Seuss, J. K. Rowling/Harry Potter, Dave Eggers, the Nvidia corporation, and most of the O'Reilly computer science books.

That is why "Resistance … is … futile." :)

56. Haha, i love the \begin{rant} and \end{rant} functions that is the first time i have seen them be used

57. Package incompatibilities and the requirement that some packages be loaded in certain orders is really annoying. I agree with Lance that LaTeX could be much improved, but the extreme network effects make such a move unlikely.

58. @Anonymous 7:59 PM, July 31, 2011

If you see Lance's post as a personal attack on Knuth then you should visit an optometrist.

I am pretty sure that Don would not agree with what you wrote, and he will never say that TeX is the final word on the question.

ps: learn to use a spell checker.

59. What, there's an O'Reilly computer science not set in TeX? Tell me more!

60. Not just set in TeX ... set in the ancient cult-font Garamond. :)

% --------------------------------------
% -- "Harry Potter" LaTeX typography ---
\RequirePackage[mdugm]{mathdesign} % Garamond
\RequirePackage[small,euler-digits]{eulervm}
\renewcommand{\boldsymbol}[1]{\mathbold{#1}}
\RequirePackage[tracking]{microtype}
\UseMicrotypeSet{all}
\SetTracking[spacing = {35*,0*,0*}]{encoding = *}{7}
% ----------------------------------------

Your mileage may vary ... :)

61. I attempted to make my thesis in Word. After around 2 months of work and constant fight about styles (there were 5 title levels), I decided to move to latex. Everything was lot easier in latex. In fact, we were 3 persons working on the document and we had no collaboration problems. Each chapter was separated in different folders and documents and in general only one of us was editing a given document. Having the input diagrams in PDF allowed you to insert true vector images into the document (try that in word having your diagrams designed in Inkspace). Also, since latext is text-based, we were able to set up a repository (subversion in a remote server), so we could commit changes and diff previous versions, also merging changes from different users. It was possible to compile each chapter by separated or the entire document, there was a Python script doing the magic.

Sometimes styles were a problem, but you need to solve it just once. Some of the problems in word is that it decides when to change your style, and fixing does not guarantee that it will not break again.

After all of this, I only can think "Why didn't we use LaTeX since the beginning?".

62. I was heavily involved with Scientific Word---then called T^3---at Oxford in the 1980's. I used it thru my first two years in Buffalo, then came to appreciate the NON-Wysiwyg-ness of LaTeX and its ability to represent mathematics by function rather than appearance. I would like to see a study of typo-prone-ness in Word vs. (La)TeX.

I told a personal story about T^3 here.

63. As far as WYSIWYG is concerned there is a relatively new software named BakomaTex. It is 100% WYSIWYG. you have the code and the exact result at the same time and can edit any of them directly.
It also has a lot of common styles available to choose and many formula typing facilities.
And it is commercial.
But I would be more pleased if I could use such a tool in google docs.

64. Lance, could you please tell me the package you are using for the rant environment? I Googled but couldn't find it.

65. "It's not difficult to convert between Word, Docs and most other document systems but nearly impossible to move to/from LaTeX."

I have no problems converting .tex to .pdf.

As far as converting to .doc format:

Here is Micro$oft's specification of the .doc format. http://msdn.microsoft.com/en-us/library/cc313153.aspx For your information, it is 621 pages long. And for your information, they posted the specification in .pdf, not in .doc format. If .doc was so portable as you claim, why do Micro$oft themselves post their spec's in .pdf format?

66. The success of TeX and LaTeX and the lack of comparable alternatives have impeded the development of better systems. The subjective evaluation that the cognitive load imposed on the user by the technicalities of LaTeX sidesteps discussion of engineering trade offs. TeX and LaTeX mix concerns that ought to be separated. Content and presentation are convolved. Better macro systems were available when Knuth invented TeX, and have evolved since then. TeX's memory management still reflects limitations of hardware of the late 70s and early 80s. This can manifest itself in various non-obvious ways. For example, beamer presentations with several packages can run out of memory unless the etex package is included. The error messages generated are uninformative, and the solution eluded me for several months. TeX and LaTeX could be viewed as great software engineering accomplishments in a period in computing comparable, from the perspective of engineering, to the period of civil engineering at the time of Babylonians.

67. Correction in square brackets: "The subjective evaluation that the cognitive load imposed on the user by the technicalities of LaTeX [is minimal] sidesteps discussion of engineering trade offs.

68. Historically, revolutionary improvements in typographic quality occur approximately once every three centuries.

(1) Gutenberg: from the 1400's
(2) Garamond: 1400 + 300 = 1700
(3) Tex: 1700 + 300 = 2000

Thus we can expect some better typographic tool than TeX/LaTeX to come along ... in about 300 more years.

As for de-evolutionary typographic tools---tools that produce *uglier* typography---why those tools appear very commonly, in every century.

69. LaTeX has gotten so much better than it used to be. I keep coming back to it, each time with amazement at what creative things people have done to make it better. I get little of the same mathematical wonder from the pre-programmed and unmodifiable GUI tools meant for people who don't care as much about precision, consistency and extendible functionality.

70. Professor Fortnow,

Your comment on UNIX made me laugh (and happy that someone shares what I think). You must see this http://twitpic.com/4owris :)