Coming soon: LaTeX support

The most important new feature in the upcoming UX Write 2.0 release is support for typesetting your documents using LaTeX. It’s been a major effort to implement this, and the full benefits will take some time to materialise (see below). Nonetheless, this sets the stage for a lot of great new features important for academic and technical writing, which will be added in subsequent 2.x releases.

I’m looking for beta testers for this release; if you’re interested, let me know.

What is LaTeX?

LaTeX is a file format and typesetting system designed for producing high-quality print output suitable for publication in books and academic journals. The file format is similar in nature to HTML; it can either be written by hand, or exported from a visual editor such as LyX. The typesetting system is based on TeX, which implements sophisticated typography including hyphenation, ligatures, and kerning, as well as beautifully-rendered mathematical equations. The result is print and PDF output that looks just great.

LaTeX has been the de-facto standard in many scientific and technical disciplines for decades. In the business world however, it’s not so well-known. But like switching from Windows to a Mac, or from working an office job to being a digital nomad, there’s just no going back once you come to appreciate the benefits. I’ve used LyX and LaTeX for my PhD thesis and all of my research papers, and like most people in my field, would never even contemplate anything else for a formal publication.

LaTeX comes to UX Write

From the very beginning, the design of UX Write has been driven by my desire to have something like LyX on the iPad. As much as I like the output of LaTeX, I don’t like writing the markup by hand; I find it much less distracting to have a visual editor where I can see headings, lists, bold/italics and so forth without special syntax. LyX does this on the desktop, exporting to LaTeX and producing a PDF identical to what you would get if you’d written the LaTeX source in a text editor. I’ve always wanted this same functionality in UX Write, but like most features, it involves an incredible amount of time and effort to implement.

Finally, after months of work, I now have a functioning port of LaTeX running under iOS, and integrated directly into UX Write. I’ll discuss the challenges I had to overcome to get this working in another post, but for now the key point is that this will be included in the upcoming 2.0 release.

First successful on-device typesetting run

The first successful on-device typesetting run

Why is this important?

Even if you’ve never heard of LaTeX before or aren’t obsessed with typography, this work is a huge step forward for UX Write because it lays the groundwork for many features people have been asking for but I haven’t been able to provide with the current WebKit-based PDF output. These include:

  • Footnotes
  • Headers and footers
  • Page breaks
  • Custom page layout
  • Cross-references to specific page numbers
  • Bibliography and citations

To be clear — these features won’t be in 2.0: the LaTeX integration has only been working for a few weeks, and I have a great deal more work to do in order to add all this functionality to the editor and convert these elements from the HTML (used internally by UX Write) to LaTeX syntax. And for the time being at least, LaTeX support will be export-only; parsing and conversion to HTML for editing is whole other story.

However, the hard part is now done, and you can expect to see these features gradually appearing in updates throughout the 2.x release cycle. In the initial 2.0 release (which will be a free update for all existing users) you’ll be able to get LaTeX typesetting with basic formatting for English documents, both when printing and exporting to PDF.

6 thoughts on “Coming soon: LaTeX support

  1. Hey Kelly,

    I’ve just checked and latex support is not included on ux write 2.0, is it?
    I also look forward to that.

    All the best,

    Fran

  2. Sorry, I meant “a welcome solution for a number of LyX users”…
    If possible, please correct my post (last sentence) and remove this one!
    Thanks.

  3. Though I do not have UX Write on my iPad yet, I am excited to see the LaTeX support coming! For people who use LaTeX on the desktop, this will be great.

    I would love to try UX Write, but for now I just keep checking this page every few months, waiting for LyX files support. My idea of a perfect workflow is:
    – edit your papers in LyX on the desktop
    – keep the files on Dropbox
    – work on the same files with an iPad and a future version UX Write.

    Any chances for that coming? It would not need to be an all-encompassing support for all LyX features. I would be perfectly happy with provisional provisional support, where you can just open the file, edit it, and save, in LyX format, without the need to convert. I imagine that “LyX format” may be a moving target, but I am happy to live with limitations, like:
    – upgrade my desktop LyX only after it is supported by UX Write
    – have some parts of LyX documents displayed incorrectly within UX Write, e.g., as placeholders, as long as they are unchanged on file save.

    What I really need is to be able to edit basic text and formulae, but I do not necessarily need a visual editor for the formulae — ERT (TeX code) would be fine. Even some weird hierarchical representation corresponding to what LyX stores in the file would be workable for emergency situations, though it would not suffice for everyday work.

    I have noticed a few posts on the LyX fora asking for an iPad LyX. I think having UX Write open and save LyX documents would be a welcome solution to a number of LyX users.

    • I too would love to have LyX support. I still think it’s the greatest writing app for desktop, and continue to use it myself sometimes.

      In theory (and everything is simply “in theory”… ) it shouldn’t be *too* complicated to support. LaTeX itself is a nightmare to parse, because it’s possible for macros to change the language syntax on the fly, so the only way to truly parse it properly is to run TeX itself and keep track of it’s internal state while doing so (and I hope to achieve this some day). However LyX’s file format could, I assume, be parsed using a formal grammar like most other file formats.

      The format certainly looks fairly simple – there’s a clear notion of tree structure with things like \begin_layout and \end_layout, which define a paragraph style.

      The approach I use with Word documents is a so-called “bidirectional transformation”, where when UX Write saves a Word document, it doesn’t actually create an entirely new one, but rather *updates* the existing one based on changes in the HTML source that is uses internally. This is possible because Word documents are based on XML. For LyX files, with suitable parsing and serialisation, I’d be able to use a pretty much identical approach.

      It’s certainly on my list of desires, though unfortunately there are some more pressing features that I have to prioritise, such as change tracking, which there seems to be very strong demand for. But I certainly agree that UX Write on iPad + LyX on desktop would be the perfect combination and would like to get that happening when time permits.

Comments are closed.