A-  A  A+ RSS Feed

Deep Thoughts by Robert Felty

thoughts on wordpress, latex, cooking et alia

Archive for 2008

Tuesday, December 2nd, 2008

Trying out bbpress

My wordpress plugins generate a lot of comments. Personally, I find it can be pretty hard to scroll through all the comments, and it can be quite slow to load as well. I have decided to try out bbpress for comments on my wordpress plugins. I created a forum for each plugin. I have turned off comments for the collapsing archives pages, and instead ask you to use the forum. We’ll see how that goes. If people don’t like it, I can always switch back.

So please check out the forums

Thursday, November 6th, 2008

TeX Live 2008 — reasons to upgrade

new features in pgf tikz
New features in pgf/tikz

TeX Live 2008 was finally released about a month ago. I am a member of TUG, so I should be getting a DVD of it sometime soon, but today I finally decided I couldn’t wait, and I would just download it. The main impetus came after reading a discussion in comp.text.tex, in which someone was trying to reduce his compile time. He had a bunch of pgf/tikz graphics, and they can take a long time to compile. Pgf/Tikz version 2.0, which was released in February, now includes the ability to save pgf graphics as external files, and then automatically include them using a standard \includegraphics command. So you only have to compile your graphics once, which can reduce compile time a lot. I think most LaTeX users probably compile often, especially if writing equations, since it is easy to mess those up and have your document not compile. So I can definitely appreciate the desire to speed up compile time. My most unproductive are days when I am running programs that take on the order of 30 seconds to 5 minutes to run, because I end up checking my e-mail or surfing the web while the program is running, and I usually end up spending more time doing that than the time it took for the program to run.

Anyways, so I wanted to try out this new functionality in pgf/tikz, so I downloaded the latest version from CTAN and installed it. (There is a nice tutorial on externalization in the manual (which is now 560 pages long) — search for “externalization”). Then I tried to compile a beamer presentation, and it failed. I was sort of expecting this, since I know beamer relies heavily on pgf. So I decided to just upgrade my whole texlive. By default, texlive gets installed into /usr/local/texlive/year, so I actually now have 2007 and 2008. I will keep both for awhile just to make sure I don’t have any problems. My non texlive packages are in /usr/local/texlive/texmf-local, so those did not get modified at all.

The first thing I did after installing the new texlive was to test a beamer presentation, and there were no problems, as I had expected. Then I used texdoc to check the manual for pgf and beamer to make sure that they were the newest versions, which they are. When I did so, the manuals got opened in evince. I prefer kpdf, and I had changed this in texdoc in my old version. I thought about just copying the old version over, but I decided to run a diff first, expecting to see just a few lines of output. I was quite surprised when lots and lots of changes started showing up, so then I did a word count on each. texdoc from 2007 was 206 lines long. texdoc from 2008 is 890 lines long. The old version was just a bourne shell script. The new version uses texlua. And the new version is much, much improved!! With the old version, to read the beamer manual, or the pgf manual I had to type:

texdoc beameruserguide
texdoc pgfmanual

There were quite a few other packages that had similar problems. But now in the new version, it works as one would hope.

texdoc beamer

So, I stuck with the new version of texdoc, but I did modify it give preference to kpdf over evince for viewing pdf documents. I just searched for evince, then changed the order of the two lines. Even though I don’t know lua at all, the code was very nicely formatted and easy to read.

Another nice thing about the new version of pgf is that it has a bunch more features, including easy ways to create drop shadows, and some new default shapes, like callouts. A few more of the new features are explained at this texample post

Thursday, October 23rd, 2008

Collapsing archives updated

I have been very busy lately, but I have been working on the collapsing archives update for awhile. I have incorporated new features from collapsing categories into it, while trying to keep all the old features. One thing I have learned is that it is difficult to write code with many options, especially when some of them interact.

Since I released the collapsing categories update a bit prematurely, I have dubbed this one 0.9.alpha, and I have not given it a stable tag yet. So you will not see that it needs updating when you look at your plugins. I do think it is fairly stable, and would be very appreciative if a few people tried it out.

You can download it from the official wordpress plugin repository.

Monday, September 22nd, 2008

Beamer fragile frames

If you want to include verbatim text, say for some program code, in a frame in beamer, you have to pass the fragile option to the frame, like so:

\begin{frame}[fragile]
\frametitle{a fragile frame}
\begin{verbatim}
some verbatim text here
\end{verbatim}
\end{frame}

Though latex usually doesn’t really care about whitespace at the beginning of a line, in this case it does. If you don’t have your begin and end frame statements at the beginning of a line when you are trying to use the fragile option, your document will not compile. It’s frustrating.

p.s. also note that you can’t use verbatim text with overlays in beamer.

Monday, September 15th, 2008

Why doesn’t Mac update standard UNIX utilities?

I am currently teaching a course on programming for linguists. We are using python, but for the first few classes, I have been going over some standard UNIX utilities like cd, ls and such, plus using regular expressions with grep and sed. I actually don’t use sed that much. I tend to reach for perl, since I know it better, and it can do pretty much all the same stuff that sed can plus much more. But sed is simpler than perl, and I basically just wanted to use it for doing substitutions.

Today I got an e-mail from a student asking why the following did not seem to be working:

echo abcd123 | sed 's/\([a-z]*\).*/\U\1/'

The student reported the following output: “Uabcd”. (The expected output is “ABCD”, which is what I get on Linux)

I tried it, and it worked fine for me. Then I thought: maybe this is a Mac/Linux problem. Sure enough, when I look at the man page for my Fedora 7 box, it tells me that my version of sed is GNU 4.1.5, from June 2006. Mac Leopard (10.5) is using BSD sed from July 2004. Leopard came out in 2007, as did Fedora 7. Why is it 2 years behind? Why is it still using python 2.4? Why doesn’t it come with useful utilities like dos2unix? Mac has done a great job of making a nice GUI, with some pretty cool applications like iLife. It is falling behind when it comes to the command line utilities though.