Install LaTeX, AASTeX, and MN2E on Mac OS X

Update (March 8, 2013): New information on adding directories for package management.

Latex LogoLaTeX, pronounced “la tech”, is a typesetting program that we use to write our papers (instead of Word or somesuch nonsense). Over the long US holiday weekend I got LaTeX and all of its bits installed on my new 13″ MacBook Pro (named Gloria). In this post, I’ll walk you through the installation and setup that should work for any of the code and text editors that Tom discussed a couple weeks ago (e.g., TextMate, TexShop, Emacs). In a future post, I’ll describe how to get TextMate setup as the primary LaTeX editor.

Read on for step-by-step instructions for installing LaTeX, AASTeX, MN2E, and more. One new thing that I learned was how to include both EPS and PDF figures in the same document!

Download and Install LaTeX

The easiest way to get LaTeX onto OS X is via MacTex. I recommend downloading the full package (~1.3 GB) and then customizing the install. The package comes with BibDesk, TexShop (which everybody seems to love except me), as well as lots of other stuff.

MacTex uses the paths.d method to modify the PATH environment variable. This works well if you don’t have your path explicitly set in the .cshrc/.tcshrc/.bashrc. To check if your path is set up correctly, in Terminal, typing which latex on the command line should return /usr/texbin/latex.

You’ll need to create a few directories which will store packages for producing a certain “look-and-feel” to your documents, as well as help you manage your references. Under the ~/Library/ directory, add the following subdirectories:


Thanks to Vicki in the comments for pointing out this last step!

Download and Install AASTeX

AASTeX is the package for preparing astronomy publications for ApJ, AJ, and PASP. Download the AASTeX package and put it in ~/Library/texmf/tex/latex/aastex52. If you’re unfamiliar with AASTeX, a handy guide [PDF] comes included in the download. To use the AASTeX style, be sure this is the first line of the tex file:


Setup emulateapj

If you want to get the fancy look of a two-column ApJ paper, you’ll want to use emulateapj. The MacTex-2009 package includes an old version so you’ll want to donwload the new one — emulateapj.cls — and put it in ~/Library/texmf/tex/latex/emulateapj.cls. When you want to use it instead of the AASTeX format, modify the tex preamble:


Download and Install MN2E

MN2E is the package to use for submitting to MNRAS. Download mn2e.cls and put it in ~/Library/texmf/tex/latex/. Also get the guide [PDF]. To use the style file, make this the first line of the tex file:


Set up the Bibliography for Use with BibTeX

The easiest way to create the bibliography is with BibTeX and ADS. Your .bib file (managed with BibDesk or exported from Papers) should live in ~/Library/texmf/bibtex/bib/my_bib.bib. To get the bibliography to display in the journal style format, you’ll need bibliography style files (.bst).

The bibliography style file for use with with AASTeX is part of AstroNat. (However, be advised that many of the AstroNat resources are no longer necessary.) Download apj.bst and put it in ~/Library/texmf/bibtex/bst/apj.bst. In the preamble of the tex file, include:


For MNRAS, download the bibliography style file, mn2e.bst, put it in ~/Library/texmf/bibtex/bst/mn2e.bst, and include this in the tex file:


Where you want the reference list to appear (typically after the acknowledgements, before tables and figures), put this:



If you’re using pdftex instead of latex (as you should be…in this day and age, there’s no need for that DVI -> PS -> PDF rigamarole), you can include both EPS and PDF figures in the same document by loading these packages in the preamble of the tex file:


The filename extension is optional. For example, to include pdf_fig.pdf and eps_fig.eps:


Anything else? Once ya’ll give this the once over, I’ll go ahead and add it to the LaTeX wiki entry which is fairly outdated at the moment.

26 comments… add one
  • kyle kanos Jul 7, 2010 @ 9:58

    Why use a text editor when you can use a front-end that will actually show you what your work looks like rather than \vec{F}=\dot{\vec{p}}=m\vec{a}. LyX operates on all the OS’s (Windows, Linux/Unix, and Mac OS X); for most Linux users it will be in the repositories, for Windows you can download the installer at and for Mac users you can get the installation instructions here

    For inexperienced users of LaTeX, LyX is the best way to go, but for experienced users of LaTeX who are comfortable writing in a text editor it might not be for you.

  • Gus Jul 7, 2010 @ 9:59

    nice tutorial, kelle. I like particularly the link to the paths.d explanation.

    You may want to note though that (if you let it) macports will eventually decide it needs its own tex installation. Given the default way macports takes over inserts itself into your path it will override some aspects of this tutorial (“which latex” and which tex paths you enter in the various applications).

    As I do not use it I cannot say if macports TeXLive presently respects ~/Library/texmf on a Mac. A quick google suggests it does not and a quick review of their bug list indicates that they want things done the “unix” way and macports will look for the texmf tree at ~/texmf by default.

  • Dan F-M Jul 7, 2010 @ 10:59

    A necessary part of my bibliography management is the little app ADS To BibDesk:

    This app was mentioned in the old BibDesk post but now it works with Firefox too and it’s extremely handy for automatically importing refs from ADS. I couldn’t live without it.

  • Kurtis W. Jul 7, 2010 @ 11:29

    I find the modifications suggested by J.D. Smith (adding AucTeX and RefTeX) here: to be quite useful. I can compile LaTeX and BibTeX and launch xdvi from the emacs window, and clicking on text in the xdvi window takes your emacs cursor to that paragraph. And I don’t have to memorize my BibTeX reference tags; I can search for references in my BibTeX file by author or title.

  • Marshall Jul 7, 2010 @ 23:03

    One reason to use a text editor rather than Lyx or an equivalent is the ease of including comments in the text with %. I don’t know about you, but I almost *always* have tons of comments in paper drafts, either detail work or numbers that don’t need to be stated explicitly but I want to remember, or notes like “%this figure was made by running on bar.fits”, or just whole paragraphs that I’ve decided to excise from the current draft but want to keep around in case I change my mind. For all of these reasons, I find text editors still superior to WYSIWYG — though what I really wish was that there was an easy way to combine the best of both worlds. Any ideas?

  • Kelle Jul 8, 2010 @ 8:39

    @Gus: Why would you use MacPorts to install Tex when you can use MacTex? It’s not like it’s a bundle that needs to updated frequently…

    @Dan FM: I totally agree that the Sick ADS to BibDesk script is a crucial part of bib mgmt! I haven’t tried out the app version but instead usually just open up Safari and use the Service. I’ll try it out and update the BibDesk post. I’d like to see if I can get it to work with Quick Search Box instead of putting the app in my dock.

    @Kurtis: There’s also a script to search the BibDesk library in TextMate! More on that in the next post….

  • Gus Jul 8, 2010 @ 10:01

    @Kelle: Although installing tetex texlive via MacPorts is exactly what saurav recommended in an earlier Astrobetter post, I’m not suggesting the above conflict would result from an intentional port install of texlive.

    Instead, TeX is a frequent dependency for ports (specifically for documentation). So sooner or later, whether one intends it or not, a MacPorts user will end up with TeX in /opt/local. If they are using MacTex as well then my prior concerns are relevant.

    Does that make sense as a “gotcha” for your tutorial?

  • John Jul 8, 2010 @ 14:31

    Why *wouldn’t* you use Macports to install TeX Live? A single system for managing all the software you need, complete with dependency tracking, automatic upgrading, and so on, seems like a great idea!

  • Kelle Jul 8, 2010 @ 14:38

    yeah, even with Saurav’s nice post, I’m just not sold on MacPorts. I think it’s my preference for a GUI over the command line…plain and simple.

    so, to make all the above ApJ/MNRAS things work with a MacPorts TeX Live install, is it as simple as using ~/texmf instead of ~/Library/texmf for the .cls, .sty, .bst, and .bib files?

    if somehow you end up with both a TeXLive install and a MacTex install, how do you figure out who’s winning? just with a ‘which latex’?

  • Gus Jul 8, 2010 @ 16:14

    @Kelle Yes, MacPorts TeX Live ‘/opt/local/bin/latex’ (or any standard TeXLive installation for that matter) will only see personal files in ~/texmf/ by default. MacTeX ‘/usr/texbin/latex’ will only see personal files in ~/Library/texmf/ by default. By “default” I mean without the user doing anything else.

  • Jessica Jul 8, 2010 @ 18:36

    Perhaps the ~/texmf/ vs. ~/Library/texmf can be fixed with a simple symbolic link?

  • DS Jul 8, 2010 @ 20:58

    I’m confused about why ADS To BibDesk is so great. I haven’t used it myself, so perhaps someone could enlighten me. (It seems perfectly easy to just use the web browser in BibDesk. It takes two clicks to add the entry from the paper’s ADS page – can ADS To BibDesk do it in one click, or something?)

  • John Jul 9, 2010 @ 8:02

    Jessica — no need for a symbolic link. Just set the environment variable TEXMFHOME to wherever you prefer to keep your texmf tree.

  • Dan F-M Jul 9, 2010 @ 16:01

    @DS ADS to BibDesk adds the pdf and abstract to your library automatically which I don’t remember BibDesk doing itself… but I haven’t explored that method in quite a while. Also, the script incorporates itself into my usual workflow (I always have a browser open) which makes it worthwhile to me.

  • kyle kanos Jul 29, 2010 @ 22:17

    @Marshall On LyX, there is a comment button that will bring up a very bright yellow text box, rather than using %.

  • anon Oct 25, 2010 @ 17:04

    A note on MacTex-2010: AASTeX is included in the distribution (in /usr/local/texlive/2010/texmf-dist/tex/latex/aastex). Although I’m not sure, I would certainly imagine it was present in MacTeX-2009 – I mean, why include emulateapj without AASTeX?

  • Colin Mar 27, 2011 @ 12:33

    Hi all,

    I have installed mac tex and created a directory


    and added a class file which I would like to use, nmeauth.cls. However I am getting the error

    ! LaTeX Error: File `nmeauth.cls’ not found

    Any suggestions?

    • Kelle Mar 27, 2011 @ 12:52

      – you mean ~/Library, right? It should be in /Users//Library/texmf/tex/latex

      – also, what are you using to run LaTeX? you might need to tell it to use the MacTex install in a preference pane somewhere.

  • Sasha Jul 16, 2011 @ 15:21

    Hi Kelle,
    I installed MacTex on my Mac 10.6.8 version and installation seemed to be successful. However, I don’t see any texmf directory in my ~/Library. Thats where you suggest to put the aastex package? Why did my mactex installation not creates ~/Library/texmf ?

    • Natalie Oct 15, 2012 @ 17:51

      I’m having the same issue–did you ever figure it out?

    • Vicky Feb 27, 2013 @ 15:18

      You need to make the directory ~/Library/texmf and its internal directories if they don’t exist. Credit to @astrokiwi for answering this question for me!

      This would be a useful piece of information to add to the post or the wiki — it’s not obvious that the folder shouldn’t necessarily already be there. Everything else is great though, very clear.

  • Niall May 14, 2013 @ 19:54

    Just FYI, MNRAS has a rule that papers with eight or more authors are treated slightly differently in the references. It’s briefly discussed in this post by Andy Lawrence

    Which links to a fix,

  • Simeon Jul 1, 2013 @ 14:48

    If you want to be really slick, you can include arxiv and ADS links in your paper bibliography, as explained in this cosmocoffee thread:

    For MNRAS, the style file linked there has the same problem noted by the previous commentator, which is solved in this version:

  • August Muench Mar 16, 2016 @ 14:46

    hi everyone,

    just a quick update on LaTeX preparation for AAS Journal papers. You can find the new AASTeX 6 and our new aasjournal.bst BibTeX style file at our consolidated journals site:

    it is an approved fork of emulateapj, including all of that package’s functionality and adding new functionality collected from users over the past decade. the BibTeX style file is also an updated version of the AstroNat one that ADS has been maintaining for so many years. It is updated to support DOI based data and software citations.

    the full AASTeX user’s guide can now be found at:

  • Eugene Avrett Jan 14, 2019 @ 14:18

    I have a paper I want to set up in Tex. What is the simplest way to begin?

Leave a Reply

Your email address will not be published. Required fields are marked *