Thursday, August 30, 2007

TeX and LaTeX Cookbooks

Here's a TeX cookbook that I often consult when I can't remember a tex symbol.

A quick Google search for "tex cookbook" or "latex cookbook" points to many similar quick references.

Friday, August 17, 2007

minipage

I tend to use latex's features on a need-to-know basis, only seeking new ones when there's something I want to do but don't know how. This happened recently with an article I was writing. I wanted to group a number of definitions together in a floating environment with a black box around them. Enter minipage. The minipage environment creates...well, um...a mini page with adjustable height and width within a page. A minipage can have footnotes, figures, the works. In conjunction with the figure environment and a framebox, I used it to create my boxed-in definitions as follows:

\begin{figure}[t]
\noindent \framebox{
\begin{minipage}[t]{1.0\textwidth}
\begin{definition}[Definition 1's Name]
\label{def:mydef1}
My Def text here.
\end{definition}

\begin{definition}[Definition 2's Name]
\label{def:mydef2}
My Def text here.
\end{definition}

\end{minipage}
}
\caption{Some definitions}
\label{fig:mydefs}
\end{figure}

I should probably mention the \noindent. At first, I didn't wrap the minipage within a figure environment, and I found that latex kept indenting the minipage because it was treating it like a paragraph. The \noindent made sure that the minipage was flush with the left margin.

Minipage is more powerful than the above illustrates. For instance, it can also be used to make a single figure out of several smaller figures. Each smaller figure simply gets its own minipage. Consider the following:

\begin{figure}
\begin{minipage}[t]{1.0\linewidth}
\center{\underline{\Large{Some Text}}}
\vspace{.1in}
\end{minipage}
\hfill
\begin{minipage}[t]{1.0\linewidth}
\epsfxsize=4.5in
\centerline{\hbox{
\epsffile{a-figure-component.eps}
}}
\vspace{.15in}
\end{minipage}
\hfill
\framebox{
\begin{minipage}[t]{0.45\linewidth}
\begin{tabular}{l}
Stuff inside the tabular environment
\end{tabular}
\end{minipage}
}
\begin{minipage}[t]{0.55\linewidth}
\epsfxsize=2.3in
\centerline{\hbox{
\epsffile{another-figure-component.eps}
}}
\center{\large{b)}}
\end{minipage}
\caption{Caption Text}
\label{figure-label}
\end{figure}

The above figure utilizes four minipages. The first is the width of the page and consists of some text. The second is also the width of the page and consists of a figure I drew with Xfig. The third minipage is 0.45 times the width of the page and consists of some text in a tabular environment. The fourth takes up the remaining 0.55 of the page width and consists of another figure I drew with Xfig. The result is a single figure with title text at the top and a large figure beneath that. The tabular text and the smaller figure are side-by-side beneath the larger figure. Note that I had to play around with \vspace commands to get the spacing right. A Google search for minipage and latex will unearth many more details.

Thursday, August 16, 2007

Banana Bread

If you like banana bread, try the following recipe. It's super-easy and a crowd pleaser, at least among my family and neighbors. My mother used to make it when I was a kid and shared the recipe with me something like 10 years ago. Every time I see my son eat a piece, I'm brought back to my own childhood.

3 ripe bananas
1 cup sugar
1 egg
1 and 1/2 cups all-purpose flower
1/4 cup canola oil
1 tsp baking soda
1/2 tsp salt (I usually just throw in a pinch)

Preheat the oven to 325 degrees Fahrenheit. Put the peeled bananas in a mixing bowl. Beat them with an electric mixer until they are smooth. Add all the other ingredients and beat well. Pour the batter into an oiled loaf pan and cook for 1 hour.

Some serving suggestions: Just plain is great - especially while it's still warm. My son likes it with cream cheese. My mother used to toast pieces and put butter on them.

Sunday, August 12, 2007

Knitting History Correction

After reading my last post, my wife told me that her memory of my learning to knit differs from mine. As she recalls it, we both felt that our son should have a pair of booties to wear after he was born, but that she did not want to knit them because to do so would conform to too many gender stereotypes. Since I wanted to learn to knit anyway, we decided that I'd be the one to make the booties. Therefore, contrary to what I wrote in my last post, I knit the booties and then knit a hat. Meanwhile, after seeing the booties that I had made, my wife decided to knit a pair too.

The actual story of my learning to knit undoubtedly lies somewhere between my recollection and my wife's. I tend to think my wife's recollection is closer to the truth.

Sunday, August 5, 2007

Knitting Resources

I thought I'd take a break from computer-ish posts and mention a few knitting resources I've come across. First a bit of my knitting history: My wife taught me to knit because I wanted to make a hat for our son to wear after he was born. Once I had the ins and outs of it, I worked on the hat and then a pair of booties while she knit him an Afghan. Our son just turned three, and my wife and I continue to knit together.

During the last holiday season, my sister bought me a book called Knitting with Balls. It's probably no surprise that this book is directed at men. Although I find its uber-masculine emphasis somewhat ridiculous (does anyone really need a hand-knit beer cozy?), this book has some interesting pages describing the history of men in knitting and some nice, if somewhat difficult to follow, patterns. Note: Some of the patterns in this book have typos in them, and it makes copius use of esoteric abbreviations that require looking up in its glossary. It isn't that hard to figure out what's going on, but if you're like me, it's helpful to have someone nearby that you can ask questions of and tell you how to take out stitches.

Knitting with Balls was written by the man who started the website www.menknit.net which has some useful links and a bit of history about men knitting. Another useful website is www.knittinghelp.com which has free how-to videos. The last website I'll mention in this post is knitty.com, an on-line knitting magazine. I haven't made anything from it, but it has a lot of nice looking patterns.

The only other thing I can think of now is to say that the book, I Can't Believe I'm Knitting, put out by Leisure Arts gives very good instructions on how to get started from casting on, to the different stitches, to casting off.

Wednesday, August 1, 2007

McAfee Update killed Internet Explorer

One of our computers runs Windows. After downloading an update from McAfee this morning, its Internet Explorer stopped being able to connect to the Internet. After some searching, I found an announcement on McAfee's Technical Support page. (For some reason the announcement did not show up the first time I looked at the page, but after refreshing the page, it showed up.) The announcement includes instructions on how to correct the problem. The fix requires you to uninstall and reinstall McAfee which is time consuming, but not difficult.

AUCTeX - Another geeky post

This one is for anyone who uses Emacs and Latex to write papers. On and off for a few years, a colleague of mine touted the wonders of AUCTeX. He said that it would save me oodles of time. Not unlike my initial reaction to Xfig, I dismissed AUCTeX as not being worth the effort to learn how to use. I was wrong. I started using it seven and a half months ago, and I love it. It has saved me oodles of time, and it adds an element of fun to writing papers which is always welcome.

Thanks to AUCTeX, I no longer need to interrupt the flow of writing to enter "latex my-paper.tex" in a terminal window. C-c C-c runs latex right from Emacs. It also keeps track of the state of the document. In other words, the first time you type C-c C-c it runs latex. The mini-buffer will then tell you to do it again if you need to run BibTeX to get your citations right. It will then keep telling you to do it again to run latex to get the references right. When all references are in order and you haven't made any changes since the last latexing, C-c C-c starts up an external viewer so that you can view the dvi file (or the PDF if you're running it in pdfmode - yes, it can run pdflatex instead of latex if you want it to).

Try it. It's great.

Vector Drawing Program - Xfig to the Rescue

For years, I looked for a good drawing program for Linux to create figures for articles, but each one I tried seemed to be missing some feature I wanted. For some reason, though, I always avoided Xfig. Its interface looked so clunky and the learning curve seemed so high. Then a few weeks ago while revising an article, I tried it out of desperation. Well, Xfig is great. It does everything I want and a number of things that I didn't even know I wanted, but that now I can't imagine living (or at least drawing) without. So if you're looking for a good Linux based drawing program give it a try.