Mac Latex-mk
Dec
I really like the LaTeX typesetting system. It makes nice looking documents. It’s a bit of a pain to use, however. On FreeBSD, there is a LIFE-SAVING port called “latex-mk,” which is a set of maintained make files that will do all the heavy-lifting for you. It’s only released for FreeBSD and NetBSD, but I’ll walk you through how to install it on Darwin (Mac). I make no warrantees here. You accept all responsibility for following these instructions or deviating from these instructions. I am not responsible for lost data or damaged property, etc.
Installation
Getting LaTeX and latex-mk
First, you need the latex package for Mac: MacTex. Install that the usual way (or read their instructions if you get lost, no sense me repeating them). Once you have that installed, grab the latex-mk file. You’ll have to dig around a big, look under “Obtaining” if that link still exists. You’ll see a SourceForge download. Download this file: latex-mk-1.9.1.tar.gz. I’m sure these instructions will work for future versions too, though I make no guarantees.
Uncompressing/Unarchiving
Go ahead and unzip the latex-mk. Crack open a terminal (Finder > Applications > Utilities > Terminal.app). Change to the latex-mk directory:
cd ~/Downloads/latex-mk-1.9.1
If the version has changed, cd to that. Remember, you must unzip it first. Apple’s archiver should handle it. But you can always do a “tar -xzf latex-mk-1.9.1.tar.gz” if you’re old fashioned like me.
Configuration
Like most packages, you need to run the configuration program. Do this from the latex-mk-1.9.1 directory (you should still be there).
sh ./configure
You will see lots of text fly by. If you get errors, sorry, this tutorial is over. Drop me a line, maybe I’ll be able to help or point you in the right direction. If you see it create lots of little files, then you’re golden.
Compile
Type:
make
And, after a very short time, it will complete.
Install
Type
sudo make install
Sudo will ask for an administrator’s password. Enter it. If you don’t trust this package, you can always install by hand… But I’m not going over that. Once this is done, latex-mk is now installed and ready for use.
Cleaning up
Type:
make clean distclean
That will remove any installation files. You may also simply delete the latex-mk-1.9.1 folder. You should delete the zip file from which you got the latex-mk-1.9.1 folder; you no longer need it.
Testing
Let’s take it for a spin. Assuming you have MacTex installed already:
- Create a new folder somewhere, I’ll call it: “Test”
- cd to “Test”
- Create a new latex document, say, “test.tex” and type or copy in the following:
%test.tex:
\documentclass[]{article}
\begin{document}
\LaTeX
\end{document}
- Now create a new file called “Makefile” and put the following into it:
#Makefile NAME = test TEXSRCS = test.tex BIBTEXSRCS = TGIFDIRS = tgif_figs include /usr/local/share/latex-mk/latex.gmk
- At the command prompt, type: “make pdf”
- You’ll see it build the file. When it finishes, open finder and go to your “Test” folder. You’ll see a shiny new “Test.pdf” so go ahead, click it! You’ll see the strangely formatted LaTeX logo.
Congratulations. You just “ported” a FreeBSD application to Mac. Aren’t command line applications grand?
Why Latex-mk?
Latex-mk takes care of lots of details when creating LaTeX documents. It keeps your bibliography up to date automatically and will re-run the latex processor to ensure all your citations and cross references are up to date and shiny. Otherwise, you have to run latex 2-3 time every change to ensure your references will be linked. Your new friend is “make pdf” as it enables one-stop generation shopping.
More Information
The make file can do much more. You should see what it can do by going to the latex-mk site for instructions.