Mathkey: A great resource for LaTeX on iOS

I’ve been using LaTeX (enjoyably!) on iOS for quite some time now. It is *still* remarkable to me that I can continue chipping away at a manuscript that I was working on in the office outside at the park — on a piece of glass. For those not in the know, LaTeX is a typesetting language that has many uses, and can be particularly useful for writing manuscripts.

After graduating from a 8.2” iPad Mini 2.0 to a 9.7” 6th generation “educational” iPad, I’ve been getting more and more writing done on iPad. The larger screen is more conducive for split-screen usage and the Apple Pencil compatibility is awesome (gives my post on note-taking tools a whole new depth - I should revisit that). Texpad is still my LaTeX editor of choice (I wish this could somehow be integrated with Overleaf) and its latest version, with several updated tools, makes editing in LaTeX rather simple. Although Texpad’s symbol editor tool is handy, I recently came across an app that makes complex typesetting, and equations, in particular, easy and intuitive.

Cue: Mathkey. The iPad app costs $7.99 (rather reasonably priced IMO; although it is also available via Setapp) and is available on the iPad as well as the iPhone (and Macbook). Essentially, it is a LaTeX keyboard (add it under General->Keyboard) that receives input via touch, and can produce output as text or as an image. What exactly does Mathkey do? Instead of struggling with symbol/equation typesetting, Mathkey uses the MyScript engine to parse handwritten equations into an image or as snippets of LaTeX code (as plaintext) that you can insert into your editor of choice. This becomes especially powerful when you have an external keyboard for typing opened with Mathkey as your active keyboard. I’ve been using Mathkey for about 3 months now and its accuracy is rarely off. On the iPad, using Mathkey with the Apple Pencil has been delightful. Finally, Mathkey can also remotely connect to the Macbook so that you can write equations on the iPad/iPhone while editing LaTeX on the Mac.

All in all, this app is a worthy addition to my (iOS-)LaTeX workflow. Here is a screencast of Mathkey usage:

Pubsplained #2: How many forams for a good climate signal?

Citation

Thirumalai, K., J. W. Partin, C. S. Jackson, and T. M. Quinn (2013), Statistical constraints on El Niño Southern Oscillation reconstructions using individual foraminifera: A sensitivity analysis, Paleoceanography, 28(3), 401–412, doi:10.1002/palo.20037. (Free Access!)

Summary

We provide a method to quantify uncertainty in estimates of past climate variability using foraminifera. This technique uses numerous, individual shells within a sediment sample and analyzes their geochemistry to reconstruct seasonal and year-to-year variations in environmental conditions.

Here is a link to our code.

Pubsplainer

This plot shows how uncertainty in IFA statistics decreases (but not all the way!) as you increase the number of foraminiferal shells analyzed.

This plot shows how uncertainty in IFA statistics decreases (but not all the way!) as you increase the number of foraminiferal shells analyzed.

Planktic foraminifera are tiny, unicellular zooplankton that are widely found in the open ocean and can tolerate a large range of environmental conditions. During their short (2-4 weeks) lifespan, they build shells (or tests) made of calcium carbonate. The tests fall to the seafloor and continually become covered by sediments over time. We can access these foraminiferal tests using sediment-cores and analyze their geochemistry to unravel all sorts of things about past ocean conditions.

Typically, ~10-100 shells of a particular species are taken from a sediment sample, and collectively, analyzed for their isotopic or trace metal composition. This procedure is repeated with each subsequent sample as you move down in the core. Each of these measurements provides an estimate of the "mean climatic state" during the time represented by the sediment sample. In contrast, individual foraminiferal analyses (IFA), i.e. the geochemistry of each shell within a sample, can provide information about month-to-month fluctuations in ocean conditions during that time interval. The statistics of IFA have been used to compare and contrast climate variability between various paleoclimate time periods.

There are many questions regarding the uncertainty and appropriate interpretation of IFA statistics. We addressed some of these issues in this publication. We provided a code that forward-models modern observations of ocean conditions and approximates, with uncertainty, the minimum number of foraminiferal tests required for a skilled reconstruction. In other words: "how many shells are needed for a good climate signal?"

Armed with this algorithm, we tested various cases in the Pacific Ocean to obtain better estimates of past changes in the El Niño/Southern Oscillation, a powerful mode of present-day climate variability. We found that the interpretation of IFA statistics is tightly linked to the study location's climate signal. Namely, we found that the ratio of seasonality1 to interannual variability2 at a site controlled the IFA signal for a given species occurring throughout the year. We then demonstrated that this technique is far more sensitive to changes in El Niño amplitude rather than its frequency.

In the central equatorial Pacific, where the seasonal cycle is minimal and year-to-year changes are strong, we showed that IFA is skillful at reconstructing El Niño. In contrast, the eastern equatorial Pacific surface-ocean is a region where El Niño anomalies are superimposed on a large annual cycle. Here, IFA is better suited to estimate past seasonality and attempting to reconstruct El Niño is problematic. Such a pursuit becomes more complicated due to changes in the past synchrony of El Niño and seasonality.

Our results also suggest that different species of foraminifera, found at different depths in the water column, or with a particular seasonal preference for calcification, might have more skill at recording past changes in El Niño. However, care should be taken in these interpretations too because these preferences (which are biological in nature) might have changed in the past as well (with or without changes in El Niño).

You can use our MATLABTM code, called INFAUNAL, to generate your own probability distributions of the sensitivity of IFA towards seasonality or interannual variability for a given sedimentation rate, number of foraminifera, and climate signal at a core location in the Pacific. Do let me know if you have any difficulties running the code!

1 - The difference in environmental conditions between summer and winter, average over multiple years

2 Changes from year-to-year (could be winter-to-winter or summer-to-summer etc.) within the time period represented by the sediment sample

Book Review: Indica by Pranay Lal

IndicaCover.jpg

Balancing the nuanced and involved intricacies of the scientific method versus proselytizing the fantastic “factoids” of popular science is a tough act. Having to straddle this line to focus on the geology and geobiological history of the Indian subcontinent, an ambitiously multidisciplinary topic, on which there are scant accessible texts (popular science or not), is an even tougher act to follow. Fortunately, Pranay Lal manages to achieve such a balance and convey his infectious enthusiasm about the subject matter rather effectively for the most part of Indica’s ~400 pages.

It was refreshing and enjoyable to learn about new geological and paleontological information of the Indian subcontinent - a topic dear to my heart. The detailed place-markers and the McPhee-esque narratives of sites where geological features are found scattered throughout India was highly interesting. The accompanying photographs and schematics are also very nicely done. You can quickly see that Lal put in hours and hours of (non-book-based) research into Indica — it shows. It felt as if Indica was an attempt to channel Sagan or Bryson or Winchester but with a focus on the history of the Indian subcontinent — a fantastic idea. However, it becomes apparent through Lal’s reporting that it is challenging to piece together and chronicle information on such a vastly “big-picture” topic, especially, when construction, urban expansion, and apathy are on their path to eroding many of India’s geological marvels.

Lal is a geneticist by training and his disposition towards anthropology, biology, and paleontology becomes discernible as his writing on these topics shines. For example, his narrative on the evolutionary history of the recently discovered Indian purple frog (Nasikabatrachus sahayadrensis), its evolutionary ties to another frog found in Seychelles, and its parallels to the tuatara or kiwi was a treat to read. Moreover, the lengthy descriptions of India’s Phanerozoic paleoenvironment and the medley of dinosaurs that walked on the subcontinent were entertaining. The closing chapters on hominid evolution and India’s potential contribution to this story were thought-provoking.

As a downside to Indica, there are many small inaccuracies conveyed with certainty that are really more uncertain than presented. My friend Suvrat Kher has an excellent blog post on many problematic sections dealing with sedimentology, tectonics, and mantle dynamics. I can echo Suvrat’s concerns in the paleomonsoon and paleoclimate domain where, amongst other things, Lal makes it seem as if we have a more concrete picture of the vagaries of the monsoon, its initiation, and its intensification than we actually do. Many of these points amount to more than sheer nitpicking. Ultimately, these inaccuracies are a significant downside to Indica, and I wonder about errors revolving around geobiology and other realms removed from my own field. Nevertheless, these inaccuracies did not prevent me from puzzling about them for a few minutes and moving on, driven by Lal’s ardor (one day, on my second read, I might find the time to write down my concerns as well and as thoroughly as Suvrat did).

As a closing statement, Indica is for anyone and everyone interested in the geological natural history of the Indian subcontinent. For students/workers who do read it, I recommend trying to spot the inaccuracies and perhaps making a list.