I was a proud owner of the 15″ MacBook Pro Retina from 2013. After years of service, it became a bit unsatisfying in terms of performance. In 2017 I finally decided to build a desktop PC, partly to fullfil some of my craftsman’s desire, and partly to play some graphics intensive games. I was still hanging around with my MacBook, mainly as a portable device for media consumption and academic work. I felt that it was a bit heavy for only that kind of usage. Or maybe I just wanted to get rid of it and play with some new toys. So I sold it and used the money to get an iPad Pro 10.5 (WiFi model with 256GB storage). Since then, I’ve (mostly) been a happy owner of the iPad.
I have been using the iPad Pro 10.5 as my main computing device for over a year now. I’ve put more love in it than the PC that costs three times more. While the PC is a fantastic powerhorse, it has mostly been used as a dedicated gaming machine. The PC also serves as the last resort for things that the iPad is just incapable of doing. Albeit this resort has been shrinking constantly as I get more competent in utilising the power of the iPad.
There are quite a lot online resources covering the usage of iPad as a primary device. However, the workflows are mostly all from professional bloggers, podcasters, programmers and artists. There is little to be found from academics, which is kind of to be expected from the most introvert group of people in the world. So, I needed to figure out an academic workflow on iPad by myself.
In particular, writing and typesetting LaTeX are essential for academics in mathematics related areas. Yet it’s not a trivial matter to get it going smoothly on iPad. The reasons are mostly the lack of software documentations and the lack of research in this area. After fiddling with all the relevant apps that I could find, even including those remotely relevant ones, I think I finally established an optimal workflow. The apps involved are TeX Writer, Textastic, and Working Copy. I will describe both the setup and the workflow in the following sections.
Offline PDFLaTeX Compiler – TeX Writer
To get a barebone workable experience for writing and typesetting in LaTeX, a LaTeX distribution, e.g., TeX Live is of course needed. However, it is not obvious how we can bring TeX Live onto iOS. It turns out that it’s not possible to install a full TeX Live. But all is not lost. We can at least get full PDFLaTeX working on iOS, with the help of TeX Writer. Although there is one competitor on iOS with offline typesetting capabilities, namely Texpad, TeX Writer excels in almost every way. It has a solid file manager, with Files app integration. It supports multitasking technology on iPad perfectly. It has tons of customisation and scripting capabilities. It can show
After installing TeX Writer, it has already shipped a minimal TeX Live distribution with it. When typesetting a document that requires additional packages, it downloads the required packages dynamically from CTAN to its caches. However, the best thing is that it allows users to load any packages, fonts, and etc.. We just need to create a new folder
texmf-local and copy the packages we want into it. Theoretically, we can put the entirety of TeX Live into it. But this is not a good idea. Since only PDFLaTeX related files can be used by TeX Writer, this would waste a lot of storage on iPad. And due to limitations (or bugs) on iOS, that amount of files often crash the whole File Provider system. So the best way to get full PDFLaTeX working offline on iPad is to load only the part of TeX Live useful for TeX Writer, as described below.
- Download the TeX Live installer on supported operating system from TeX User Group;
- Run the installer;
- Open “Advanced” dialog to select the “collections” of packages needed;
- Install and wait for it to finish;
- Open the installation directory and navigate into the foler
- Copy the folders
texmf-localfolder in TeX Writer via iTunes;
- Open “Settings” of TeX Writer, tap on “Refresh texmf-local/ls-R”.
The next typesetting on TeX Writer might take a long time to update
ls-R. It’s better to set the iOS “Auto Lock” to “Never” and let TeX Writer finish its job. In this whole process, there are a few caveats here. I need to mention that it’s better not to install too many additional fonts in the TeX Live Collections. Again, the file system on iOS is still a bit too fragile. Furthermore, there might still be useless files copied in those three folders. But it’s a serious chore to dig through the TeX directory to pick each one of them. I think this is a good compromise to make.
For customisation and scripting in TeX Writer, the developer’s website has a reference manual. The first half of it is about the LISP language and not specific to TeX Writer. The best way to start is to scroll to the bottom and look at the sample files. One important feature not documented in the manual is “RELOAD”. Pasting the code below into the
twininit.l file in TeX Writer adds a “RELOAD” button. This is important when editing
tex files from other apps while typesetting in TeX Writer.
(add-hook tex-mode-hook (lambda () (add-to-toolbar "RELOAD" 'reload) ))
Text Editor – Textastic
Although the text editor in TeX Writer is actually very decent, with some beautifully implemented features like spell-checking, Textastic is my text editor of choice here. One important reason is that it allows users to customise code completion. The developer has some examples of the built-in code completion configuration files on Github. But unfortuanately the syntax is not documented at all. It took me a solid couple of hours to figure that out. I have written up a code completion file for LaTeX (available on Github) based on the LaTeX2e unofficial reference manual.
Git Client and File Provider – Working Copy
You might have noticed the trend that Github is used a lot. Then you shouldn’t be surprised that my entire LaTeX setup is based on Git for file management. Working Copy has integrated with the iOS File Provider to make the files in its repositories available to other apps. Both TeX Writer and Textastic take full advantage of that. Basically all source files for LaTeX documents, e.g.,
bib files, are stored in Working Copy and version controlled by Git, while Textastic and TeX Wrtier open them “in place” to edit and compile.
A typical workflow for writing and typesetting a LaTeX document in this setup is the following.
- Initiate a repository in Working Copy;
- (Optional) Push the repository to Github or other Git hosting services;
- Open the repository in Textastic;
- Create a new
texfile and write the document;
- Open the repository in TeX Writer;
- Compile to see the PDF file;
- (Repeatable) Commit meaningful changes in Working Copy;
- (Repeatable) Switch to Textastic to edit;
- (Repeatable) Switch to TeX Writer to compile again;
- Check spelling for the final draft in TeX Writer;
- Correct spelling in TeX Writer;
- Compile the final document in TeX Writer.
- Commit final changes in Wokring Copy.
Due to the large amount of app switching between TeX Writer and Textastic in this workflow, it’s best to open them side by side in Split View or put TeX Writer in Slide Over.
Although the setup is a significant effort (at least for me), the results are worthwhile in my opinion. Now I can write and typeset documents with LaTeX almost anywhere. Bringing an iPad with me has been much easier than bringing an MacBook becuase of the (lack of) weight. The limitations are also quite limited. Unless I need other typesetting engines, e.g.,
tikz-feynman, and e.t.c., the iPad Pro 10.5 can serve me very well. With the upcoming changes in iPadOS 13 in terms of text selection and mouse support, I think this setup will only gets better.