Writing and submitting a LaTeX manuscript to mSystems from Overleaf

I really like LaTeX. I like the programmatic approach to writing, the exquisite control in typesetting, and the satisfaction of a beautifully rendered document. I’ve actually written about LaTeX before (my most viewed post, actually!), where I discussed a solution to an italicization issue with Mendeley’s BibTeX output.

I attribute learning LaTeX to another graduate student in Trevor Charles‘ lab who taught me many things, John Heil. I was impressed with the high-quality committee reports he generated and remember thinking: wow, I’ve got to learn this. Not only can you make professional-looking documents, but you can also do things like define your own shortcuts; for example, I can make it so that whenever I type “\Ecoli\”, it will be rendered as “E. coli”. No more manual italicizing!

I used to use a LaTeX editor on Windows/Ubuntu before the major shift to The Cloud. I need to thank John again because he also introduced me to Overleaf, an online LaTeX editor that facilitates collaborative writing. No more email attachments!

Overleaf has templates for a variety of document types, including journal articles. Journals are increasingly making available their templates, and Overleaf now has templates for mSystems, PeerJ, PLOS, Scientific Reports, PNAS (shown below), and many more. It seems like LaTeX templates are used quite widely in other disciplines, so biologists are finally catching up, hurray!


When you open the template to start a new project, the Overleaf editor has three panels, each of which can be resized or hidden:

Screenshot from 2018-03-24 19-32-34

From left to right:

  1. Files. This is a directory-style listing and automatically include files provided by the journal required for the LaTeX document. You can upload your image files, bibliography file, etc.
  2. Source. This is the .tex file. Using the toggle button, you can switch between editing the source versus editing using the Rich Text editor, a more word processor-like WYSIWYG interface. When you open a new template, there will be a skeleton and usually instructions, so it’s not hard to get started even if you don’t know any LaTeX at all.
  3. PDF. This is generated from the code and by default auto-refreshes as the code is modified. Here I used an mSystems template for my most recent publication.

LaTeX itself is kind of intuitive, especially if you’ve done some basic HTML before (remember when it was cool to make your own website on Geocities? — remember frames?!). But even if you don’t know HTML, between what is there in the template skeleton, and Google, Stack Overflow, and other online resources, I believe the average academic can manage. This is a snippet from my Results section, so you can see how the commands look, including those for sections, citations, figure references, and mathematical symbols:

Screenshot from 2018-03-24 21-40-07

Notice that there is a button at the top labeled “Submit to mSystems“. When I used this submission feature, all the files that were associated with my project were sent to mSystems, and I received an email from mSystems with a link to finish the submission process — this includes things like uploading a cover letter and listing potential reviewers. So convenient! I started using Overleaf before being aware of this feature, so colour me very impressed.

I think I may have been the guinea pig or one of the very first few people to use this submission feature from Overleaf because I encountered a little issue. The files that were originally submitted to mSystems included the manuscript .tex file and the .pdf image files. In a few weeks, I got the reviews back for the paper via email, took a few more weeks to make the necessary revisions, and logged back in to resubmit — imagine my shock when I saw error messages saying that .tex and .pdf files were not valid!

Inline images 1

I was very confused by this… changing the image files from .pdf to .eps was simple, but what about the .tex file? Why would mSystems allow me to submit a .tex file from Overleaf, only to force me to submit the revision as a .doc/.rtf…? Something seemed very wrong, so I emailed mSystems that evening to inquire.

I was impressed by the mSystems staff because by the next morning (I’m on the west coast), we had corresponded several times via email, they had communicated amongst their teams, and — in less than 12 hours from the time of my initial email — the issue was resolved. I successfully uploaded my .tex revision and converted image files.

Screen Shot 2018-02-15 at 10.34.16

Isn’t that awesome? The resolution could not have gone more smooth.

I do want to point out one thing that might be difficult with LaTeX / Overleaf for people who are very used to Microsoft Word, LibreOffice Writer, or equivalent software that allows commenting and tracking changes. The folks at Overleaf have been working on tools, like commenting in Rich Text mode, the changes package, and using the compare tool to compare versions. I haven’t tried everything, but so far I really like the compare tools. Under “History & Revisions”, you can save named versions of your document. You can restore old versions, or compare the current version to any of the old versions:

Screenshot from 2018-03-24 22-08-54

Screenshot from 2018-03-24 22-11-07

I really like this. The ability to save named versions is kind of like Overleaf’s own Git.

Finally, as with all cloud-based things, there is no need to install or upgrade software or packages with Overleaf, and you can work on your documents from any computer so long as you have access to a browser and the interwebs. This is great for those of us who can’t carry laptops around every day due to chronic back pain, or who like to work at public library computers to escape distractions. I really like Overleaf and I’m eager to see what new features Overleaf will implement!

TL;DR: Overleaf simplifies writing manuscripts using LaTeX and streamlines the submission to journals. My submission to mSystems went relatively smoothly and the mSystems staff were wonderful to work with when there was a small technical hiccup.

Migrating from Mendeley to Paperpile

I last blogged a couple of years ago (yikes!) about a free reference manager called Mendeley. Since then, and particularly since Elsevier’s acquisition of Mendeley, I had been on the lookout for a reference manager that could integrate with Google Docs to facilitate collaborative writing.

My non-academic but wonderfully resourceful partner suggested I try out Paperpile, a web-based reference manager. They offer a 30-day trial, after which they charge $2.99 per month*. I’ve been really happy with my experience, so much so that I am actually investing the time to write about it! There are two awesome features that I describe below.

The other reason that I am choosing to write about it is to (maybe) help those in Academia that are generally resistant to change and/or may be unaware of the latest and greatest tools; I am generally such a person, but having a partner in Tech has made me much more open to trying out new software and not regarding it as “wasting precious time”, as well as much more appreciative of the quickly changing landscape of software and that one ought try out new things to not be left behind. Thanks, Doubov!

To start, the interface for Paperpile is clean and simple.

Screenshot from 2018-02-11 15-01-38

Awesome feature #1: Adding papers direct from search results

This might be the best feature of Paperpile, possibly because I never expected that something so awesome could exist. Using the Chrome plug-in, articles and associated metadata can be added from search results to your collection with a single click. This is available for many databases, including Google and Pubmed:

Screenshot from 2018-02-11 14-28-12

Screenshot from 2018-02-11 14-27-23

The one-click download can be a problem for pay-walled articles (yet another reason to support open access!). However, if your institutions allows authentication off-campus, Paperpile has implemented a tool to add a proxy connection:

Screenshot from 2018-02-11 14-24-12Screenshot from 2018-02-11 14-23-52

Awesome feature #2: Citing within a Google Document

The main reason I wanted to switch reference managers was to have a way to cite in Google Docs. As far as I know, Paperpile is the only tool that currently allows this. You can insert a citation from the menu, and search your library in the dialog box that appears:

Screenshot from 2018-02-11 15-47-40

And of course, there is a range of citation styles from which to choose:

Screenshot from 2018-02-11 15-49-55

There are a couple of other things that I want to mention.

Migrating a library to Paperpile. This was seamless. The folks at Paperpile have excellent instructions on how to do this, and I don’t remember there being any hiccups.

Enabling the PDF annotator. This feature is currently in beta (I had to manually add it in settings), but it provides all the functions that I typically use, including full text search. Also, notice the 4-colour highlighting options as well as the letters/numbers indicating keyboard shortcuts to switch between annotation tools (gosh, I love hot keys):

Screenshot from 2018-02-11 15-08-51
Current short-comings? 

The only feature that I have really missed is full text search: even though text search is available within the PDF viewer/annotator, it is not yet possible from the main Paperpile app. The current implementation of main search only searches the title, abstract, and other metadata, such as author. The software is constantly being improved though, and according to the Paperpile forum, the full text search feature is underway.

A second shortcoming is not particular to Paperpile but rather is a general design philosophy that I struggle to cope with in general. It is the use of dynamic menus — either options that aren’t obvious until something is selected or options that appear only when the user hovers over an object. This can sometimes be unintuitive; for example, the main menu items only appear after a paper(s) is selected.

Screenshot from 2018-02-11 15-36-29

Screenshot from 2018-02-11 15-36-12

I don’t agree with this philosophy; I think options should be grayed out rather than simply absent, but what do I know, right? I’m just an underpaid academic in the life sciences who blogs about tools when she has lots of work that needs doing. 😉

These two issues are relatively minor considering the great number of features that Paperpile has to offer, and especially that development is likely being done by a small (but clearly awesome) team. Thank you Paperpile for a making a great tool!

*$9.99 for non-academics.

Dealing with italics in bibtex files exported from Mendeley

TL;DR Tags for italicized text in bibtex file generated by Mendeley are not compatible with BibTeX/LaTeX. This is still an issue as of August 2015. I wrote a Python script to fix the tags from <i> and </i> to \textit{}.

I decided to write my Ph.D. thesis in LaTeX because I wanted the culmination of my years of work to beautifully presented. One blip I have encountered though is with my references in the bibtex file generated by the Mendeley reference manager I use. First, let me just say that Mendeley is awesome; I’ve used it for about 6 or 7 years now and has been incredibly useful: I collect, skim, and read a lot of journal articles so it’s been a huge time-saver with its annotation and searching functions. I also have used the plugin for citing in LibreOffice Writer, which has been great (except for this one weird glitch that I think may be related to citing within tables).

So what’s my problem? I needed species and gene names to be italicized in the article titles. This is accomplished by adding <i> and </i> tags in the title field of the Mendeley desktop application, here surrounding the genus name Bacteroides:

ref_in_mendeley_2But these tags are unchanged in titles of the Mendeley-generated bibtex file:


Which this leads to incorrect characters in the citation of the document:


Am I the first to encounter this problem? It doesn’t seem so. Perhaps there aren’t many Biology graduate students writing their theses in LaTeX. Or perhaps those that do don’t care about proper italicization. I myself am not really a stickler for these details, but some people are and these people may be on the committees that decide the fate of lowly graduate students like me.

I corresponded with the Mendeley Support team on Twitter to see if perhaps they had a fix to this italics tag problem:

Screenshot from 2016-01-11 17:22:24

The only solution then was to repair the bibtex file myself, which though it is a bit annoying, is actually very straightforward. I wrote the Python script below to change the html-like tags to LaTeX ones*.

For this script to work as is, the following requirements must be met:

  • Python version 2.7 needs to be installed (Python 3 may work; haven’t tested)
  • The script needs to be in the same directory as the bibtex file it is meant to process.
  • The bibtex file must be named “bibliography.bib”; a new file called “new_bibliography.bib” will be generated that has all instances of the <i> and </i> tags replaced with the LaTeX \textit{} command. (Note: be very careful that all instances of <i> and </i> are correct in the Mendeley title field!)


# By: Kathy Lam
# Date: January 11, 2016
# Purpose: Replace all instances of "<i>" with "\textit{"
#          and "</i>" with "}" in bibtex file generated by Mendeley

oldbib = open("bibliography.bib", "r")
newbib = open("new_bibliography.bib", "w")

for line in oldbib:
    if line.startswith("title"):
        if "<i>" in line:
            fixed_open_tags = line.replace("<i>", "\\textit{")
            fixed_both = fixed_open_tags.replace("</i>", "}")


In Windows, I think the script can be executed by double-clicking for those who want to avoid using the command-line. On a Mac, the file permissions must be changed to allow it to be executable, which I think has to be done through the command line using `chmod +x [script_name.py]`; and if you want to execute the script by double-clicking, the extension of the script should be changed from .py to .command.

Here is the reference after the italics have been fixed — huzzah!:


And, for completeness’ sake, here is the corrected bibtex file entry:


*To make the script as universal as possible, I avoided using libraries like BibtexParser. I hope that this script might be useful to someone out there trying to google a solution to this problem…


Comic Sans and the aesthetics of science

You know what is always very pretty? Autumn in Ontario. Last Saturday, it was gorgeous out, and I went for a hike with a few of my friends in the Forks of the Credit Provincial Park, which is located in Caledon. The Bruce Trail runs through there, and though it wasn’t yet peak colour in that region, it was still beautiful:

VLUU L210 / Samsung L210

That story was a lead-in to my next question: you know what isn’t always pretty? The visual presentation of science. And to that, I say, is that really so bad…?

I’m not saying science shouldn’t be presented in a visually appealing way, or that emphasis on visual appeal is wrong. I’m not saying that. Visuals are important, of course. But can we all admit that it has gotten a bit crazy when the fuss is more about the non-science than it is about the science? Case in point: the hatred of Comic Sans. When the scientists working at CERN gave their presentation about the Higgs boson, it seemed that the media (and especially the social media) were more focused on the font in their PowerPoint presentation than on their science. It made me feel deflated. Yes, okay, fine: Comic Sans probably shouldn’t have been used. But it was. Not every person has an artistic eye, nor do all people have the same taste. Nor should they. Leave it be. Do we have to be jerks about it? We can choose not to be.

It also makes me feel a bit deflated when I hear talk of how science should be presented; that we should think of our presentation of scientific data as if it were marketing or advertising. Doesn’t that seem strange? Advertising is about convincing, persuading, manipulating an audience. While that might arguably be a good strategy, I don’t think it’s something one should do necessarily. I say this as a person who does spend hours and hours and days and days fixing slides and posters. I’ve gotten much better over the years, and when I see presentations now, I can’t help but notice when things aren’t aligned, when there are extra spaces between words, when weird colours and fonts are used, and when images are pixelated. But I also think that that these things are secondary to the science. I try not to be distracted by them, and I envy those whose attention is not mercilessly seized by these aesthetic details — details which, I think, we should actively try not to pay too much attention to. “Too much attention” I would define as the level at which attention must be taken away from the science — in one’s own thoughts, in conversation with others, whatever.

To me, a science presentation is like a painting. Should we stand here and criticize the painter’s technique, the choice of colour, and the quality of the paint? We could easily do that, sure. But shouldn’t we try to see what artist has tried to convey, through his or her painting? The message in the painting is the important thing. We need to forget about the Comic Sans. It’s not easy, but, for the message, I think it’s worth trying our best. Plus, we wouldn’t be jerks, and that’s a good thing, too, because the world has enough of those.

Karma, intuition, and the impotence of science

Karma, destiny, and related ideas aren’t things that I have thought a whole lot about in my time spent being alive. For most of my life, I’ve held a scientific worldview — one in which ideas like karma don’t really have a place, due to a lack of observable evidence (to me). I think it is generally accepted that these ideas are outside the domain of science;  because these ideas are not falsifiable, science cannot not address them. I would even go as far as to say that science is powerless to address them. That seems like a better description, because science — the scientific method that many of us use to understand the universe and our place in the universe — fails us when it comes to the metaphysical. And there are many important metaphysical questions that all of us think about.

I recently came back from a trip to Asia. Among the places I visited was Vietnam, where my parents are from. I had visited Vietnam once before, in the mid-’90s, but I was too young to truly appreciate my experiences. A little before, a lot during, and now after this trip, I am starting to really ponder ideas like karma. I started thinking about karma because my mother holds Bhuddhist beliefs, and during our trip, she took time to make donations to a village elementary school, and also to give out rice and medicine to the poor:


My mom, Luyen, standing under a banner, holding a plaque for her donation to a Vietnamese elementary school.


My mom purchased hundreds of kilograms of rice to give away.


My mom giving away rice and medicine.

In my head and in my day-to-day life, I think that there is no such thing as karma or other similar ideas. But to my self, upon reflection, somehow that doesn’t make a whole lot of sense. It’s not only that the emptiness is unsatisfying in an existential way; it’s also that it feels intuitively inadequate in a way that is difficult to describe. As someone who considers themself scientific, I feel distrustful of this kind of intuiting (even when it is done by me), but there is much “intuiting” done (read: instinct behaviour) by creatures on earth that is powerful and that plays an important role in the existence of said creatures in their place in the universe. Isn’t that true? Then intuition, even about “wild” ideas, shouldn’t be entirely disregarded… should it?

Maybe science won’t be so powerless in the end. Perhaps quantum physicists or cosmologists who study dark matter will be able to give us answers to our metaphysical questions eventually.

Conferences, seminars, and journal clubs, oh my!

I’ve heard a lot of people say that travelling is one perk of being in science, referring to the travelling done for multi-day conferences. I think I disagree more than I agree. Conferences usually have tight schedules, and there’s not much time for exploring a new place, unless one sacrifices some scheduled talks or takes additional days off after the conference is over. When I think of travelling for ‘fun’, I imagine spending a few weeks sampling bits and pieces of a foreign place at a peaceful pace… but, usually, conferences involve sitting in overly air-conditioned rooms, listening to research talk after research talk, scarfing down not-too-healthy food, scrambling from room to room, and tracking down a few (potentially) interesting posters in giant venues, a la ASM 2011, in New Orleans:


I coudn’t resist taking that picture from the balcony that overlooked the poster “room”. In short, conferences are kind of crazy and hectic — and ASM is especially crazy because it involves so many people.

All that being said, I really, really like conferences. I guess I like science discourse — even when I can’t contribute in a meaningful way. I am puzzled by (and sort of suspicious of) people who don’t invest time in meetings, seminars, and journal clubs. Obviously, these can get dry… but still. I guess I’m constantly learning new things that I think I should know, or things that I’m doing or have done wrong, that I find these things useful. Also, I guess it just seems like doing science without doing all of this other stuff is like… painting in a room without immersing oneself in the  world one is trying to paint. You could still be a great painter, but that behaviour somehow seems incongruous with the love of the art.

Anyway, speaking of conferences, my lab is going to CSM this year. My supervisor sent us all some advice on how to make posters, and I wanted to share it because it was good advice as well as entertaining. I was pretty proud of my poster for ASM (design-wise, not results-wise), but I think now that it had too much text:


I’ll have to work on that. Live and learn. (And do science, and make time to enjoy the other science that is in the world. And paint?)

The bimodal distribution in undergraduate education

As I do more TAing (TA-ing? TAing? Neither? Is there an English major in the house?), I am seeing what professors, lecturers, and instructors have been seeing for years — I know this because I sometimes hear the lamentations. Ah, the biomodal distribution. What does it mean? What do we do?

I think we all know what it means. It means that there are two groups here: one group of relatively “strong” students and another group of relatively “weak” students (the cause of this “weakness” I touch on in the next paragraph). One question that arises is: should we expect that grade distributions be unimodal? I think there is reason to believe that they should be  — that is, that the powers that be should try to make it so —  simply because of the logistics of trying to educate a group of people who exhibit this learning behaviour. There is no good way to cater to this kind of two-group population. To “aim for the middle” would be to do a disfavour to both groups.

About the lagging hump: I am of the opinion that we need to stop telling kids that they should go to university. No, actually, not all kids need to go to university. Not all kids want to, not all kids are willing to try even if they don’t like it, and not all kids are good at it. That last category kills me. I mean, if you don’t want to do something, but you’re made to do it anyway, but you’re good at it, then fine. But if you don’t want to do something that you’re made to do, and you’re not good at it, all parties involved are miserable. People need to stop being told that there is one path to success. There isn’t. Miserable students have the potential to be happy, fulfilled, engaged, etc. doing something else. We could have a lot of happier people being awesome at other things. Sometimes, I think about a quote of Albert Einstein’s: “Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.”

What should we do about this problem, and why aren’t we doing it? It seems that universities have become businesses — “branding” themselves, supporting obscenely priced textbooks with ever more frequent edition changes, allowing bubbling enrollment numbers and lecture/tutorial sizes — and, as businesses, it is in their best interest to maximize profits. Because of this approach, there also seems to exist a disconnect between (a) the higher-up administration “running” the business and (b) the frustrated faculty, staff, and students who are forced to deal with the reality of treating university education like a business or service. I ponder how much the powers that be really care about the actual education of students. I don’t know if things can change any time soon, without some sort of bubble popping. One thing I do know is that we really need to fix the problem of the lagging hump — if we care at all about real people, that is… This is a depressing post. To forget about it, please watch this great TED talk about how school kills creativity (har, har):

The tragedy of the commons

Having worked in multiple molecular biology laboratories, it’s not hard to notice that science generates a lot of waste. Some labs are worse than others. I’m lucky to be in a lab in which, due to financial and environmental awareness on the part of both students and staff, we really try to reduce waste. We wash and re-use our weigh boats, plastic syringes, our glass culture tubes, sometimes even plastic conical tubes. Many labs don’t do this; many find this practice laughable. There is also the argument that it costs more in time to wash these things (or in money to pay someone to wash them), than it costs to simply buy more. Herein lies the tragedy of the commons… from the small laboratory to global environmental issues.

The paper The Tragedy of the Commons was published in Science by Garrett Hardin in 1968. I do not remember the exact context in which this piece was recommended to me, but only because it is so applicable to everything and I therefore think about it often. It is something that everyone should read. It discusses the population problem, and obvious related problems. I leave you with a rather long excerpt:


Where does the mind meet the heart?

I’m currently reading a book called, “The Universe in a Single Atom: The Convergence of Science and Spirituality”, written by the 14th Dalai Lama. Increasingly, it seems that Bhuddism is the only (popular) religion that is compatible with science, and I am discovering that more and more people I know — who share my scientific worldview — also find some appeal in Bhuddism.


Scientific writing: writing that bores, confuses, and frustrates

Lately, I have been pondering (a friend of mine might call it “internally lamenting”) the way science is presented in the written form. That is, why must scientific writing be so terrible to read? Why are certain practices — probably bad practices — encouraged?

I tweeted several links yesterday about scientific writing. Appropriately, today I stumbled across a post in the Science Careers section of Science, called How to Write Like a Scientist. It made me laugh… but also sad.

I don’t think that we should write as if we are trying desperately to captivate or move an audience (for example, poetically), but I also don’t think we should write in a manner that induces sleep… or the desire to stab oneself in the eye with the nearest sharp object. And why is the passive “It was concluded that…” preferable to the active “We concluded that…”? And on that note, I leave you with a few opinion pieces concerning use of the passive voice in technical writing, submitted to Nature in the mid-’90s.