LaTeX installation on Mac

From Exterior Memory
Jump to: navigation, search
This article was written in January 2007. Given the volatile nature of this topic, expect that the content of this article is outdated after about two years time.

Installation Choices

First of all, there is TeX. An archaic type-setting system. If you want to install TeX, you need to think about three things:

If you use a Mac and don't want to decide yourself: install TeX Live. If you use MacPort, use MacPorts to install it, otherwise install it manually. Download and install TeXShop manually.

Distributions

See for example TeX Distributions at contextgarden.net, Common LaTeX distributions at the Latex Project or .

TeX Live
A multiplatform distribution. It is now the recommended choice, as it contains platform specific latex binaries, such as XeTeX and MacTeX.
XeTeX
A newer distribution originating on the Mac. Has nice features like the ability to include any (TrueType or OpenType) font, and natively supports UTF-8. Recommended for Mac users.
teTeX
One of the most widely used distributions. Pretty good.
MacTeX
Recommended Mac distribution by the TeX Users Group.
proTeXt
Recommended Windows distribution by the TeX Users Group.

Installers

If you use a package manager like MacPorts or Fink, simply use that manager to install the required package. I heard some reports that those package did not get the fonts correct when exporting to PDF, but to be honest: it worked flawlessly for me.

If you don't use MacPorts of Fink, I recommend the i-Installer. It's a package manager for Mac OS X. While support ended at January 2007, it is still a good choice since the main purpose was to install TeX-related packages.

User Interface

To actually use TeX, you can either use the command line:

pdflatex myfile.tex

Or use an editor. One of the best editors is TeXShop, which has a window to edit your TeX files, and allows you to simply click a button to do the typesetting (calling pdflatex, texexec or any other tool applicable).

If you don't feel comfortable using TeX, you way want to start with LyX, a GUI-editor for LaTeX. While LyX allows you to import tex files, I wouldn't count on that to work reliable. That said, LyX is a great way start with LaTex: you can do most of the editing in LyX, and when an article is done, you can export to LaTeX and do some fine tuning of the lay-out. That way you slowly learn the different type-setting commands in LaTeX.

Type Setting Variant

No-one types directly in TeX anymore. Typically people will use LaTeX. But even then, there are many choices for packages. For example, do you use verbatim, moreverb or listings to produce code listings. And for small in-line pictures, do you use picins or wrapfig. I usually deal with it by Googling for the correct package, get overwhelmed, pick one and hope for the best. A good rule of thumb is to only use package that already came with the distribution. A good change that others can then read it too.

LaTeX is the de-facto standard, and great for writing articles. However, if you care about lay-out you may want to consider ConTeXt, which allows you to fine tune your lay-out. So if you simply want to write text with pictures, and want to share with colleagues: use LaTeX. If you want to make a nice looking brochure, use ConTeXt.

Install ConTeXt and LaTeX using ports

As described above, there are multiple ways to install software. This guide installs LaTeX on Mac OS X using ports.

Prerequisites

Requirements XCode and MacPorts. If you haven't installed these yet:

  • Download XCode (aka Developer Tools; need free Apple Developer Account to download)
  • Download and install MacPorts
  • reconfigure shell to include /opt/local/bin
  • sudo port selfupdate

Install TeX Live with Ports

Now that your done, install TeX Live:

sudo port install texlive

This installs texlive_base, texlive_texmf-minimal, texlive_texmf-full, freetype, fontconfig, ncurses, zlib, libpng, texinfo, texi2html, ghostscript and XFree86.

Pick an editor

You can type your tex files in any text editor and run latex or pdflatex from the command line. However, it sometimes is benefical to use a dedicated editor. Some common choices are

  • TextMate, an all-purpose text-editor with LaTeX bundle
  • BBEdit, an all-purpose text-editor
  • TeXShop, a dedicated LaTeX editor
  • LyX, a graphical-only LaTeX editor, targeted at users who do not care about the intrinsics of tex code, but like a GUI editor.

Install TeXShop

Manually install TeXShop.

Open TeXShop, go the Preferences. There are few settings to make, depending on the installer and distribution.

Encoding

First of all, go to the "Document" tab.

Set the Encoding to "UTF-8 Unicode".

You really want to do this. Even if you are going to stick to ASCII, do choose UTF-8, since UTF-8 is fully backward compatible with ASCII.

Installer Path

Secondly, go the to the "Engine" tab, and set the paths based on the installer you used.

For Macports, set the path to the following values:

(pdf)TeX
/opt/local/bin
Distiller (Ghostscript)
/opt/local/bin

If you would have installed teTeX using the i-Installer, this should be:

(pdf)TeX
/usr/local/teTeX/bin/powerpc-apple-darwin-current
Distiller (Ghostscript)
/usr/local/bin

XeTeX Distribution

If you use teTeX, you don't have to change anything.

If you installed XeTeX, you should also change these settings in the "Misc" tab:

TeX Program
xetex
Latex Program
xelatex

See Using XeTeX with TeXShop for details.

You can now use UTF-8 directly in your documents. If you want to use custom Mac-fonts as well, you may want to consider installing the fontspec package from CTAN.

Using ConTeXt with XeTeX

If you use ConTeXt with teTeX, everything is set. You can simply select "ConTeXt" from the TypeSet menu, and you're off.

Also, if you use LaTeX with XeTeX, everything is set. Due to the settings in the Misc tab, you're automatically using XeTeX.

However, if you want to combine ConTeXt with XeTeX, things are a bit more complicated. Since I wasn't interested in that feature, I refer to the ConTeXt wiki on XeTeX