Today, I’ll conclude my remarks about my passion for using LaTeX. As I was writing the last installment of On Coding, I realized that I had more to say than would fit in just one post.
Yet another wonderful thing about LaTeX is how many mathematicians and scientists use it — and therefore write packages for it. You can go to the Comprehensive TeX Archive Network and download packages which make Feynman diagrams for physics, molecular structures for chemistry, musical scores, and even crossword puzzles or chessboards! There are literally thousands of packages available. And like LaTeX, it’s all open source. That is a feature which cannot be overstated. Arguably the world’s best and most comprehensive computer typesetting platform is absolutely free.
The package I use most often is TikZ — it’s a really amazing graphics package written by Till Tantau. You can do absolutely anything in TikZ, really. One extremely important feature is that you can easily put mathematical symbols in any graphic.
This is nice because any labels in your diagram will be in the same font as your text. I always find it jarring when I’m reading a mathematics paper or book, and the diagrams are labelled in some other font.
There is so much more to say about TikZ. I plan to talk about it in more detail in a future installment about computer graphics, so I’ll stop here and leave you with one more graphic made with TikZ.
Another package I use fairly often is the hyperref package. This is especially useful when you’re creating some type of report which relies on information found on the web. For example, when I request funding for a conference, I need to include a copy of the conference announcement. So I create a hyperlink (in blue, though you can customize this) in the document which takes you to the announcement online when you click on it.
These hyperlinks can also be linked to other documents in the cloud, so you can have a “master” document which links to all the documents you need. Now that I’m approaching 100 blog entries, I plan on making an index this way. I’ll create a pdf (using LaTeX, of course) which lists posts by topic with brief descriptions as well as hyperlinks to the relevant blog posts.
On to the next LaTeX feature! I learned about this one from a colleague (thanks, Noah!) when I was writing some notes on Taylor series for calculus. I used it as a text when I taught calculus; the notes are about 100 pages long.
I wanted to share these notes with others, and the style of the notes was such that the exercises weren’t at the end of the sections, but interwoven with the text. Students are supposed to do the exercises as they encounter them.
But for other calculus teachers, it was helpful to include solutions to the exercises. The problem in creating a solutions manual was that if I ever edited the notes, I’d have to also edit the solutions manual in parallel. I knew this was going to happen, since when I gave exams on this material, I added those problems as supplementary exercises to the text.
Enter the ifthen package in LaTeX. I created an exercise environment, so that every time I included an exercise, I had a block which looked like this:
\begin{exercise}
{….the exercise….}
{….the solution….}
\end{exercise}
Think of this as an exercise function with two arguments: the text of the exercise, and the text of the solution.
Then I created a boolean variable called teacheredition. If this variable was true, the exercise function printed the solutions with each exercise. If false, the solutions were omitted. This control structure was made easy by some functions in the ifthen package.
And that’s all there was to it! So every time I created an exercise, I added the solution right after it. Of course the exercises were automatically numbered as well. No separate solutions manual. Everything was all in one place. If you have ever had to deal with this type of issue before, you’ll immediately recognize how unbelievably useful the ability to do this is!
While not really features of LaTeX itself, there are now places in the cloud where you can work on LaTeX documents with others. I’d like to talk about the one Nick and I are currently using, called ShareLaTeX. This is an environment where you can create a project, and then share it with others so they can work on it, too.
So when Nick and I work on a paper together, we do it in ShareLaTeX. It’s extremely convenient. We can edit the paper on our own, but most often, we use ShareLaTeX when we’re working together. Usually, we’re working on different parts of the paper — but when one of us has something we want the other to see, it’s easy to just scroll down (or up) in the document and look at what’s been done.
Also nice is that it’s easy to copy projects — so as we’re about to make a big change (like use different notation, or alter a fundamental definition), our protocol is to make a copy of the current project to work on, and then download the older version of the project (just in case the internet dies).
It’s wonderful to use. And it actually really came in handy when Nick was working on his Bridges paper for last year. His computer hard drive seriously crashed. But since we were working on ShareLaTeX, the draft of his paper was unharmed.
I hope this is enough to convince you that it might be worthwhile to learn a little LaTeX! I seriously don’t know what I’d do without it. And — as it bears repeating — it’s all open source, available to anyone. So, really, why isn’t the whole world using LaTeX? That’s a mystery for another day….