Three Great LaTeX Tools for Academics

Love it or hate it, LaTeX has become the go-to writing tool for academics in the sciences. It does have some undeniable advantages, including great citation and bibliography management, terrific templates, and unparalleled control over equations and tables. It also produces documents that look ridiculously good. But it leaves more than a little to be desired as a writing environment, and the built-in facilities for versioning and comments aren’t all that optimal.

Fortunately, there are a few really handy tools out there that are easy to set up and use.

LaTeXdiff

LaTeXdiff is a great tool for highlighting changes from one version of a manuscript to the next. Text from the first version that’s been deleted in the second is formatted in red and crossed out. New text is formatted in blue and underlined. I ask my graduate students to use it for successive drafts of dissertation chapters, and it’s a huge time-saver.

Example of LaTeXdiff output from the online LaTeXdiff tool.

The simplest way to use it is to go to the online LaTeXdiff tool at https://3142.nl/latex-diff/ and copy and paste your old and new versions into the two windows there, then click “Generate LaTeX document showing differences.” If that doesn’t work for some reason, some LaTeX distributions come with LaTeXdiff built in. To see whether yours does, open the Terminal window (Mac) or Command Prompt program (I guess?, for Windows) and type

latexdiff -V

at the prompt. If that doesn’t produce an error, navigate to your document directory and type

latexdiff version1.tex version2.tex > versionsdiff.tex

to produce a differenced version of your manuscript. If latexdiff -V does produce an error, well, installation is going to be a bit of a pain, but Dean Bodenham at ETH Zurich has a handy set of installations here.

todonotes Modifications

LaTeX has a built-in facility, called todonotes, to let you add marginal notes to your manuscript. It’s OK. My main complaint is that, thanks to the default typeface size and spacing, you can’t really fit much text into a note. I went looking for a simple fix to that problem and, thanks to the generosity of user MLC in this post on StackExchange, found five of them. If you add the following text—

\usepackage{xargs} in a new commands
\usepackage[pdftex,dvipsnames]{xcolor}
\usepackage[colorinlistoftodos,prependcaption,textsize=tiny]{todonotes}
\newcommandx{\unsure}[2][1=]{\todo[linecolor=red,backgroundcolor=red!25,bordercolor=red,#1]{#2}}
\newcommandx{\change}[2][1=]{\todo[linecolor=blue,backgroundcolor=blue!25,bordercolor=blue,#1]{#2}}
\newcommandx{\info}[2][1=]{\todo[linecolor=OliveGreen,backgroundcolor=OliveGreen!25,bordercolor=OliveGreen,#1]{#2}}
\newcommandx{\improvement}[2][1=]{\todo[linecolor=Plum,backgroundcolor=Plum!25,bordercolor=Plum,#1]{#2}}
\newcommandx{\thiswillnotshow}[2][1=]{\todo[disable,#1]{#2}}

—to the preamble of your LaTeX document, it’ll create a handy little suite of new commands (\change{}, \unsure{}, etc.) to generate marginal notes that are correctly sized, attractive, and functionally differentiated by color. If you don’t like the colors, it’s easy to change them.

User MLC’s example of different kinds of marginal notes.

Summary page of notes and their locations.

 

LanguageTool Integration

This is the trickiest of the three tools to use, but it’s well worth it. I was inspired to look for it when I noticed blurt, a really cool-looking little writing app with a very clean interface. Blurt flags spelling mistakes, as most programs do, but it also issues warnings about usage, grammar, and style. Could this be useful for academics?

Writing in the social sciences is so notoriously terrible that there’s actually a book about it.

Mmmmmmmmaybe. Unfortunately, there aren’t any LaTeX environments that I know of that do the same thing out of the box.

Enter LanguageTool. LanguageTool is a powerful general-purpose proofreader with a downloadable desktop version. The ability to use it is built in to TeXStudio, which happens to be my LaTeX editor of choice. (If it’s not yours, it’s worth a try.) Downloading, activating, and connecting LanguageTool to TeXStudio allows TeXStudio to flag a wide range of flaws in your writing, from usage and grammar to sentences and paragraphs that are just too damn long.

LanguageTool, implemented in TeXStudio.

When you fire up LanguageTool’s desktop program, you can easily specify the rules that you want it to apply when it’s proofreading your writing.

The LanguageTool interface.

The price for all of this awesomeness is a bit of hassle when it comes to setup. LanguageTool’s desktop program is written in Java, so you’ll need the most recent version of the Java Development Kit in order to make it work. That last sentence is very important. You can get the newest version of Java from quite a few sources, but they will not necessarily update the version of Java that your computer uses from the command line, and that’s the version of Java that TeXStudio uses to connect to LanguageTool. Only the Java Development Kit replaces this version too.

If you don’t screw that up like I did, installing LanguageTool and connecting it to TeXStudio should be pretty straightforward:

  1. If you don’t have the most recent version of TeXStudio, go to the TeXStudio download page, download it, and install it.
  2. Go to the Oracle Java Development Kit download page and download the correct version of the JDK for your operating system. Install that too.
  3. Go to the LanguageTool homepage, scroll to the bottom, and select “Download Desktop Version.” Uncompress the resulting file and put it wherever you’d like. It makes sense to put it in the Applications folder on a Mac, for reasons that will become clear in a moment.
  4. Open your LanguageTool file and find languagetool.jar. Double-click it to run the desktop version. Click on the “Text Checking” menu and select “Options…” to set your preferred language and grammar/style rules.
  5. Open TeXStudio, select Preferences, and check “Advanced Options” at the bottom. That should create a “Language Checking” tab. Click on it.
  6. In the space for “LT Path,” type the path to your standalone languagetool.jar file. At the time of this writing, mine is /Applications/LanguageTool-4.2/languagetool.jar (see why it’s handy to have it in the Applications folder?)
  7. Make sure that “Start LanguageTool if not running” is checked and the Server URL, Java, and LT arguments fields are all filled. My values for those are
    • Server URL: http://localhost:8081/
    • Java: java
    • LT Arguments: org.languagetool.server.HTTPServer -p 8081
  8. Save preferences and quit all programs.

If you’d like to see all of these steps rather than read them, this handy video by YouTube user AtwoZi shows you how to do it.

Once you’ve done all this, you should be set up. TeXStudio will call LanguageTool when it runs and will access it via an internal server port. That said, for some reason LanguageTool works much better for me when I launch languagetool.jar myself before opening TeXStudio, rather than letting TeXStudio do it. I’d guess that the server version of LanguageTool isn’t picking up the preferences from the Desktop version (why? Beats me), but both versions grab port 8081, so either one can be used by TeXStudio.

A final note: When I was asking around on Twitter about grammar and style checkers for LaTeX, Professor Robert Carroll at Florida State DM’ed me to make the case for writing in a separate environment entirely and then worrying about footnotes, citations, etc., later on, in a different program. Rob’s preferred environment for this is Grammarly, which I like quite a bit.

I think Rob is right, in principle. If I’m not doing academic writing, I prefer to use Writeroom, which gives me a big, distraction-free empty screen to fill with nothing but words. It’s a terrific way to write. I wish I could do it more often. (And I wish there were a LanguageTool plugin.) Blurt also looks terrific, though I haven’t put it through its paces and it requires a subscription. (Word to the wise: Blurt creator Corey Gwin offers a $0.99/month academic rate for students.) But when I’m doing academic writing, I think in text that includes citations, and my digressions come in the form of footnotes. That’s just how my brain works. If you haven’t yet been warped by academic writing, though, I’d highly recommend giving Rob’s system a shot.

So what are your favorite academic LaTeX modifications?

One thought on “Three Great LaTeX Tools for Academics

Comments are closed.