SwiftLaTeX- Exploring web-based true WYSIWYG editing for digital publishing
Elliott Wen, PhD candidate; Dr Gerald Weber, Senior Lecturer, Department of Computer Science
Introduction
The text processing tool LaTeX has prevailed as a standard in many fields of exact sciences; it is evident that LATEX is likely to be here to stay. From that perspective, it is important to explore what are the best possible ways to support the author in efficiently editing documents. There have been several approaches that provide graphical editing support for LaTeX. We argue that a true WYSIWYG (What You See Is What You Get) approach is a justified requirement for future systems, and we present here the first cloud-based true WYSIWYG editor. This allows the author to edit the document in its print form directly in a web-based PDF viewer. Building such a system creates unique challenges compared to existing approaches. We identify these challenges and name workable solutions. We also provide a usability evaluation of the new system. In short, our finding is that editing LaTeX directly in the PDF view is possible for a wide range of edits and valuable for many major user groups and use cases; hence it is a fair requirement for future top-of-the-line LaTeX editors.
Background
The TeX typesetting system developed by Donald Knuth ushered in an era of high quality open source electronic document publishing. Knuth embedded deep knowledge of the traditional art and craft of typesetting into TeXO˙ver the intervening decades, various TeX derivatives have established themselves. Among them, LaTeX is particularly widespread and maintained by a large community. However, the TeX family of tools exhibits a major usability limitation due to their nature as batch processing systems which results in an edit-compile-review cycle. This cycle is generally acknowledged to possess certain usability disadvantages; the user is forced to perform difficult mental mappings back and forth between the one-dimensional textual TeX source codes and the two-dimensional graphical print output, displayed on the screen only after a slow compilation process. This takes longer than the time which users are known to find acceptable in interactive systems. It renders various editing tasks fairly inefficient such as proofreading, which often involves a large share of single-character
edits.
A number of partial solutions to this problem have been developed. Some LaTeX editors (e.g., ShareLatex , now merged with Overleaf ) provide asynchronous and regular refresh of the print output, which is placed side by side with the code editor. Optionally, the editor also features formatted text input, where a fixed number of LaTeX text style commands are displayed in different colors and fonts accordingly, e.g., section headers are shown in a large and bold font.
However in these approaches there is still a large discrepancy between the edit view and the print layout view and the user has to
alternate and switch focus between them in many work cycles.
A thorough analysis of these existing solutions (Our work Section) leads us to the research hypothesis that enabling
WYSIWYG editing of LaTeX documents directly in the print (PDF) layout will bring about a significant improvement in usability for various user groups due to the removal of the notorious edit-compile-review cycle. To match this aspiration, and to keep the usability advantages gained with current cloud services, we introduce SwiftLaTeX, the first cloud-based LaTeX true WYSIWYG system for.
However, implementing a responsive WYSIWYG editor entails three challenges. First, allowing direct editing of the PDF document requires that the product of the LaTeX compilation must be combined with the new user input as quickly as possible. This is challenging since traditional recompiling is too slow for character-wise quick response. Secondly, the editor is expected to intercept the modification on the PDF document and to apply the alternation synchronously in the corresponding position of the source code. To achieve this, the editor requires the ability to infer the source code position of each element in the PDF with character-wise accuracy. This is a stretch target since the highest level of accuracy in existing open-source tools is merely line-level. Finally, for a cloud-based system with a massive number of potential users, maintaining high scalability, reliability and compatibility remains a challenging issue, particularly since as long as we rely on repeated compilations, there is an obvious trade off between computing resource consumption and responsiveness.
Our work
In this research, we present practical solutions to cope with the above challenges. Specifically, to correctly combine the product of the LaTeX compilation and the user’s editing, SwiftLaTeX proposes an asynchronous merging mechanism. To infer the source code positions, SwiftLaTeX explores an advanced text-matching algorithm and dynamically patches the LaTeX engine with a bookkeeping mechanism in pursuit of character-level accuracy. To achieve high scalability, reliability and compatibility, SwiftLaTeX embraces a distributed system back-end architecture and features a responsive front-end design.
We consolidated the above techniques and implemented a prototype of SwiftLaTeX on cloud computing platforms, based on which we conducted a preliminary user study involving six LaTeX users to evaluate the usability aspects of the system. The evaluation results show that participants reacted positively to the innovative web-based editable PDF viewer and praised its efficiency for certain editing tasks such as proofreading.
To sum up, the main contributions of this research are as follows:
- We provide a review of existing LaTeX editors and derive requirements for our system as a cloud-based WYSIWYG editor in a narrower sense.
- We propose a high-level algorithmic standard architecture for asynchronous WYSIWYG editors working on a batch-style text processing system.
- We implement and integrate a fine-grained source code positioning system in LaTeX system.
- We present a working cloud-based prototype which is scalable, reliable and compatible with mainstream browsers on different kinds of devices.
- We conduct a preliminary pilot study evaluating usability aspects of the system.
Conclusion
In this research, we presented SwiftLaTeX, the first cloud-based true WYSIWYG editor that allows the user to edit the document in its print form directly in the web-based PDF viewer. We have identified fundamental architectural challenges in providing WYSIWYG for LaTeX and identified resuable solutions. We have defined WYSIWYG in the narrower sense; the SwiftLaTeX system shows that a cloud-based WYSIWYG sytem for LaTeX is achievable. Although the batch-character of LaTeX poses challenges for such a system, we could show that these challenges can be overcome Manuscript submitted to ACM.
Acknowledgement
The authors wish to acknowledge the Centre for eResearch at the University of Auckland for their help in facilitating this research. Our cloud based WYSIWYG editor is hosted with Nectar virtual machine.