Archives for posts with tag: linux

I’m sure that someone out there is struggling with this. So, here is a quick screenshot of the security settings, in the Network Manager applet, that you need to get Ubuntu to run on the University of Arizona’s secure wireless network. The same will apply for Debian and most GNOME-based desktops.

UAWifi network security settings

…and you’ll want to put your NetID username and password in there, for the last two entries.

Fairly straightforward once you get it.

Advertisements

I’m in the process of preparing my first manuscript to submit to the American Meteorological Society (AMS) and their Journal of Applied Meteorology and Climatology. This is a write-up explaining how I go about doing this. Hopefully it will save you some time if you are in the same boat.

Tools used

The immediate tools I’ve been using at this end of the project are:

Ubuntu
My operating system of choice. I’m using version 10.04 Lucid Lynx.
ArcGIS 9.2 (via VirtualBox)
A proprietary GIS system that is something of a standard in the field. It’s important here because I use this for all my cartography.
GNU R
A must-have language for data analysis. One of the most powerful ways to plot and visualize data.
GIMP

An excellent tool for image editing. Here, I’ve been using it to convert TIFF to EPS.
Zotero

A very hand Firefox extension that handles all my bibliographic data. An essential tool for any Modern Grad Student worth their salt.
LaTeX

The feared type-setting system.

Why go through all this trouble?

AMS lets authors submit papers either through a DOC template or a tarball of their LaTeX template. I’ve chosen to use LaTeX not only because I love pain, but also because Microsoft Office is evil. My paper shifts between 20-30 pages and is loaded with massive, high-resolution graphics (1200 dpi) and loads of special characters and formatting. Managing this kind of work in a slow, bulky (and proprietary) DOC would drive anyone crazy. I say this thinking several years down the line when I may want to access the paper and this particular version of DOC may be obsolete. Having said that, I will be quick to note that writing in LaTeX can be a big pain in the ass. The results, however, are awesome (do not Google awesome LaTeX).

At this point in the project, the majority of my writing is done. When I need to collaborate with a bunch of people or have digital copies that people can annotate I’ll have a rough DOC, TXT, or ODT file that I can pass around. Many of my associates use MS Windows and MacOS and are generally not fluent in LaTeX. This is just something to keep in mind if you haven’t already started writing (which is not likely if you’re reading this).

Setting up your workspace

Go grab yourself a copy of the most recent AMS LaTeX template and their author’s guide (for God’s sake, read this!).

The template tarball has the file structure you’re going to want to be working with. Mainly, a working director with two sub-directories: figures and bibliography. I’m sure you can guess what these are for. Feel free to change the name of the parent directory to anything you like, but AMS_Latex does have a nice ring to it.

Now, lets get you the software you’re going to need to build the documents. (Note that these directions are for Ubuntu Lucid and its software repositories. They will likely work on most Debian-based systems, but your mileage may vary.)

You’ll need two packages and their dependencies: texlive-publishers and texlive-latex-extra. You can install these using your favorite package-manager or with the command:
sudo apt-get install texlive-publishers texlive-latex-extra
This should give you everything you need to do some damage.

Bringing on the pain

The only files that you really should be worrying about are 1) the contents of bibliography 2) the contents of figures and 3) the file blank_template.tex.

Your .tex document

You’re going to want to open blank_template.tex and save it under a new name. This new file is going to be where you do all your typing. Use the original blank_template.tex and amspaper.tex as guides to format your document. You can see the final output of blank_template.tex and amspaper.tex in the files with the same name, but using the PDF extension.

These two .tex documents are full of helpful comments and guidance to get you started. Most of your text can just be cut and pasted from OpenOffice or whatever you use. I’ll briefly cover citations/bibliography and figures below. If you need help with more specific, advanced formatting or syntax, just Google it. Chances are there is a nice guide or forum post that will point you in the right direction.

The bibliography

Exporting a bibliography for LaTeX from Zotero is very easy. Open up Zotero and be sure you have the folder with your bibliography highlighted in the left-most pane. Under the Actions menu (the little gray gear) select Export library… and you want to select BibTex from the Format drop-down menu. Now, place this in your bibliography directory so that it replaces references.bib.

That should be all you need to do. Watch for error messages when you build your .tex document, you may need to go back and check references.bib for syntax shenanigans… incomplete parenthesis, quotations, brackets and the like. But, these kinds of problems are rare.

Citations in your .tex document are fairly simple. Here is a brief reference sheet to get you started. The key used to designate each citation in your .tex document is in the first line of each item in your references.bib file.

Figures

Once again, read the author’s guide or you will end up redoing alot of your work! There are specific format and size requirements for all of your figures.

One of the biggest problem I had is with image file format. You’re going to want to use EPS for all of your images. This isn’t too big of a deal, because you can easily export high resolution TIFFs from ArcGIS and R and then use the GIMP to convert them to EPS. Be sure that you export them and convert them using the proper image size.

I wouldn’t be surprised if R had the ability to natively export EPS, I export TIFF because it seems to give me a few more options.

If you are using ArcGIS, you’ll want to avoid exporting EPS directly from ArcGIS. In my experience, the results have had poor scaling and used the wrong icons. Instead, export it as a high-resolution TIFF and then use the GIMP to export it as a EPS.

Place all your .eps files into the figures folder and be careful of how you name them because you’ll have to cite these names in your .tex file to insert the images. The original AMS template .tex files are a pretty good example of how to embed your figures, so I wont go into that here.

Creating your document

You need to run a series of commands to put everything together into a PDF. Open up a terminal in your working directory (the one with your .tex file) and line-by-line run:


latex yourfile.tex
bibtex yourfile # Note that there is no .tex file extension here.
latex yourfile.tex
latex yourfile.tex # This 2nd run of latex cleans-out reference dependencies.
dvips yourfile.dvi -o yourfile.ps
ps2pdf14 yourfile.ps

Pay attention to the output of each of these commands and pick through the output to look for errors or any mistakes. Once your more comfortable with what’s going on, we can put all of this into a bash script to automate the process:


#! /usr/bin/env bash
#publishTex.sh
#2010-06-08
#This is a quick script to help produce a PDF from .tex files for AMS publication.

if [ ! -e "$1" ]
then
    echo "The file or directory given does not seem to exist."
    exit 1
fi

filename=${1/${1: -4}}

echo "########## $(date +%F) - RUNNING LATEX1 ##########"
latex $filename.tex
echo "########## $(date +%F) - RUNNING BIBTEX ##########"
bibtex $filename
echo "########## $(date +%F) - RUNNING LATEX2 ##########"
latex $filename.tex
echo "########## $(date +%F) - RUNNING LATEX FINAL ##########"
latex $filename.tex
echo "########## $(date +%F) - CONVERTING DVI TO PS ##########"
dvips $filename.dvi -o $filename.ps
echo "########## $(date +%F) - CONVERTING PS TO PDF ##########"
ps2pdf14 $filename.ps
echo "########## $(date +%F) - ALL DONE! ##########"

Run this script with the path of (or simply the file name if it’s in your CWD) your .tex file as the only argument. It will build everything, giving you error messages, and eventually produce your PDF.

That should be enough to get you started, and maybe do some damage. Good luck doing all the rest.

I found some classic bash code on reddit this morning that shows your most frequent bash commands:

cut -d\    -f 1 ~/.bash_history | sort | uniq -c | sort -rn | head -n 10 | sed 's/.*/    &/g'

This should work with MacOS as well as linux, if you’re interested.

I’ve been running Ubuntu Lucid since alpha2 (it’s now on beta1). This is my output:

131 exit
128 sudo
43 top
25 man
19 ssh
8 python
8 ping
8 cat
7 scp
7 R

It shows a surprising amount about how you use your system.

EDIT: Props to Patrick! I had chopped off the ‘sed’ command when I cut and pasted. It has been corrected.

%d bloggers like this: