Thursday, June 12, 2008

LaTeX generated figures: Using preview instead of pst-eps

I've been using the pst-eps package when I want to generate EPS versions of coded graphics (e.g., graphics produced with PSTricks or the standard picture environment). From the pst-eps description:
Pst-eps is a PSTricks (pstricks)-based package for exporting PSTricks images ‘on the fly’ to encapsulated PostScript (EPS) image files, which can then be read into a document in the usual way.
By wrapping lines in a TeXtoEPS environment, you setup LaTeX to produce an image of the enclosed content with a tight bounding box. It works well, but you must use dvips -E to generate your EPS files with the proper bounding box. If you want to then generate a PDF, you have to use something like epstopdf (possibly with the EPSCrop GhostScript option) to do it. Additionally, there's a lot of overhead within the actual TeX source. In other words, it's not quite easy to use.

A BETTER OPTION: Today, I discovered the preview package, which is described with:
The package is a free-standing part of the preview-latex bundle. The package provides the support preview-latex needs, when it chooses the matter it will preview. The output may reasonably be expected to have other uses, as in html translators, etc.
This package appears to be a much nicer solution. You can use standard latex or pdflatex to compile. If you need to use latex but still want EPS or PDF outputs, you can use dvips and ps2pdf without any special options. Otherwise, the introduced preview environment works very similar to the old TeXtoEPS environment, but it requires less work to use and seems to apply to a broader class of content.

Here's an example that should not require anything fancy to build. If you don't have the amsmath package (you should), you can omit it and get rid of the gather* environment:
\documentclass{article} 
\usepackage{amsmath} % for gather*
\usepackage[active, % Turns previewing on
tightpage, % Squeezes pages around previews
textmath, % Subjects textual math to a preview
displaymath, % Subjects math displays to preview
floats % Subjects floats to preview
]{preview}
% There is a ``graphics'' option too that subjects
% includegraphics to preview. If they are already in a
% float, the ``floats'' option is sufficient.
\begin{document}

This text will NOT get printed.

\begin{equation}
a = b
\end{equation}

The math following the colon gets printed: $x = 5$?

\begin{gather*}
c = d
\end{gather*}

More text not printed.

\begin{preview}
Page 2 is here (with tight border).
\end{preview}

You'll never see this text.

\begin{figure}
\fbox{\fbox{\fbox{A figure that is printed}}}
\end{figure}

\end{document}
If the active option of preview is commented out, the file builds as if preview didn't exist. However, with it turned on, only the sections in preview environments get printed, and they each get put on a separate page with tight borders. Options like displaymath, textmath, and floats cause those types of content to get automatically wrapped with a preview environment.

Related posts:

Tuesday, June 10, 2008

Safari Books On-line: Searchable TLC2

Check out Safari Books Online:It's pretty pricey to pay for a login, but requests that come from many universities (or libraries?) get a free login automatically. For example, from outside OSU, I can use my OSU login at:That is, I added ".proxy.lib.ohio-state.edu" to the end of the server name, which forces the request through the OSU library's proxy server.

There are lots of useful digital copies of reference books on-line. I think all of the O'Reilly books are available. More importantly (to me), you can find a digital (and searchable) copy of The LaTeX Companion (Second edition) by Mittelbach and Goossens. You can even copy and paste code samples directly out of the book!

Thursday, June 05, 2008

Trashy "untrash Ohio" campaign

UPDATE: I have received a response from the Executive Director of the campaign:
Hello Ted,

Thank you for your email. In this case, the apple core is the trash as it is waste out of place. The Trash Spoils Everything, Untrash Ohio campaign is specifically targeted at males ages 18-35. Research shows that the majority of littering is done by Caucasian males, aged 18 to 35-years-old. In fact, 71% of the litter found along streets and highways is caused by persons less than 35 years of age, according to the Institute for Applied Research. Most individuals litter because they have no sense of ownership or responsibility to the property they are trashing and assume someone else will pick-up what they have left behind. Of course, not all males in this age range litter and we know that.

This age group does use the environment for activities they enjoy but do not think about the trash they leave behind. The idea of the campaign is to show how one piece of trash spoils the environment for everyone and the activities that they enjoy. I understand your thoughts on the apple core but the idea is to get people to think about proper waste disposal and not just throwing their waste on the ground, whether it is biodegradable or not. No, apple trees are not littering when their fruit falls on the ground, but when people put it there it is litter. KOB is addressing litter in this campaign, not the issue of golf courses.

I hope that this answers some of your questions. Please let me know if I can be of further assistance.

Sincerely,

Kerry

Kerry Crossen
Executive Director

Keep Ohio Beautiful
P.O. Box 12776
Cincinnati, OH 45212-0776
614.604.2136
www.keepohiobeautiful.us

On Ohio roads, you can now find billboards for the new untrash Ohio campaign. One of them that I see daily is
Image of golf ball sitting on an apple core that looks like a golf tee.
It confuses me. Which one is the trash? Is it the biodegradable apple core that will rot away in a week? Or is it the golf ball that will sit in that spot forever until some animal chokes on it and dies?

What's worse? An apple tree dropping lots of apples or a golf course dropping lots of golf balls? Evidently untrash Ohio has something against apple trees.

I haven't done the leg work, but I bet that untrash Ohio is just a front for some shady collaboration between Microsoft and the NGCOA...

Pictures of Apple Snail ("Golden Mystery Snail") Laying Eggs

We have two apple snails (sold as an "ivory mystery snail" and a "golden mystery snail") in our small 6 gallon Eclipse tank. Evidently, the golden snail is a female and the ivory snail is a male, and so they mate all the time. In most tanks, this isn't a problem because the amphibious apple snails have to leave the water to lay their eggs and they can't do that when the tank has a lid on it. However, the Eclipse tank has a large dome-shaped lid so that everything (pump, filter, etc.) can be built into it. So, our female has been crawling up into the lid and laying eggs.

This morning, I couldn't find the female in the bottom part of the tank, and so I lifted the lid... and there she was! I've never seen pictures of an apple snail LAYING eggs, so I thought I'd take some. Unfortunately, they came out kinda blurry, but at least it's something!
You can see the egg sac she's laying right next to her. You can see that as she moves backward, the egg sac gets longer.

In the first picture, on another part of the lid, are some of the remnants of an old egg sac that has hatched (before we realized she was leaving the tank to lay her eggs).

Anyone have any ideas about how to prevent the snails from leaving the water? (note: throwing away the tank is not an option) We'd move the snails to our big tank that has a flat lid, but we're pretty sure our freshwater puffer would slowly dine on the snails until they died a long slow death.

Saturday, May 31, 2008

Alaska Grand Casino: Fake Check Scam

I got a fake check scam in the mail yesterday! Isn't that exciting? Check it out:In this particular scam, I was given a very real looking check for $4900.00. The scam claimed that I had won $100,000, and by some "sweepstakes act," I had to pay 3.9% of that money back (or $3900). So, I was supposed to cash this check and mail them $3900, leaving me $1000.

These fake checks are so realistic that banks can't tell the difference for a few days. So, if I would have cashed it, I would have gotten $4900, mailed them $3900 of it, and then the bank would have gone after *ME* for defrauding THEM of $4900.

This particular scam was from the Alaska Grand Casino. I had to contact the "Claims Attorney" in order to find out where to send the $3900. His information:
Allen Goodmann
1-647-219-5567
cnitelfin_sol@yahoo.com
If you'd like to contact this person, feel free! I'm sure he's lonely.

The check and letter were both signed by scanned-in signatures. I'm GUESSING that these signatures were taken from checks mailed to them from victims. Isn't that sad? Several (fake?) addresses and PO boxes were given on the letter and check. One of them listed both a PO box and a street address. The street address and city name were constructed from other state names, which I thought was cute.

The mail was sent from Canada. I've notified the Ohio Attorney General and the US Postal Inspection Service (USPIS). If you receive something similar, you should also notify your state attorney general and the USPIS.

Monday, May 12, 2008

Thanks, Microsoft, for SP3. I was getting tired of being happy.

UPDATE (THE FIX!!!): I decided to search Google again, and I found that several days after my support request, a new Microsoft support article (KB951830) was posted that describes the SAME problem as the old one (KB951446). However, in the new one, a HOTFIX is given. Strangely enough, that hotfix is NOT being distributed via Windows Update, and so you'll have to manually download and install it. I have informed the Microsoft support engineers (I've racked up two of them by now) about all of this.

NOTE: It might be important to note that before applying this patch, on the advice of the Microsoft support staff, I removed all registry keys that started with "$%&'()*+." (without the quotes). Evidently these keys are created by the SP3 install, but McAfee (which I was unable to disable due to network policy) wouldn't allow it. There were HUNDREDS of these keys (in each HKLM\SYSTEM\ControlSet*) and I had to delete them in SAFE MODE (to disable McAfee).

I also was asked to remove the keys (wordwrapped here):
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_CCPROXY
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_LIVEUPDATE_NOTICE_EX
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_LIVEUPDATE_NOTICE_SERVICE
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_LIVEUPDATE_NOTICE
None of those keys existed on my system.

UPDATE: After weeks of back and forth between me and Microsoft support, I'm finally in touch with an "Escalation Engineer" who is trying to get to the bottom of the problem.

Every morning, I'm still manually restarting my SharedAccess service after reconnecting my laptop. Otherwise, the Windows firewall blocks my access to the DNS running on the gateway. However, every other service gets through fine. That is, if I hard-coded my laptop's DNS, I think everything would be fine.

IF this problem is not a universal bug in SP3, it's something that was caused by installing SP3 with McAfee turned on (I can't turn it off due to network policy).

The Escalation Engineer seems to think that the problem might be fixed by installing a third party unsupported VBS script from some random blog by some Microsoft "MVP", but as far as I can tell, that fix prevents rebooting when SP3 is installed on some AMD systems. My system is an Intel Xeon system, and so I don't think it will make a difference. In fact, if I run it, it tells me that I don't need to run it because I'm on an Intel system. That's a good thing, because otherwise I'd have to uninstall SP3 and then run it. I would have been PISSED if the Escalation Engineer told me to uninstall SP3 and run the script just to find out that I had an Intel machine and the fix had NOTHING TO DO WITH IT.

Hopefully a hotfix is coming soon...
What a stupid fucking bug (KB951446) posted on May 6 with no indication that it will ever be fixed.

So, if you have a single computer (e.g., a laptop) connected to your ICS machine via a crossover cable, every time you disconnect that single computer, your ICS is going to die. The next time you reconnect, you have to restart the ICS service MANUALLY.

Remember that scene in High Fidelity where Rob explains to Barry that he just wants noise on in the background that he can ignore? That's the way I feel about Windows. I don't use it. I don't need it. I don't want it. I just have to have it for a few tedious things, and so I'd like it to sit back and do its thing without getting in my way. Right when I start forgetting that it's there, Microsoft goes ahead and does something to remind me it's still around. It's like some disease that just won't go away.

I've also heard a rumor that XP3's ICS restricts you to sharing your connection with no more than 10 other computers. That's pretty dumb too.

Monday, April 14, 2008

(Am I Just) Fooling Myself

NPR Song of the Day (April 11, 2008): "Eli 'Paperboy' Reed Channels Soul's Giants" by Marc Silver
Just who does Eli "Paperboy" Reed think he is? The reincarnation of the wicked Wilson Pickett? A skillful James Brown imitator? Winner of the Austin Chronicle's award for "best Otis Redding impersonation by a 23-year-old Jewish boy from Massachusetts"?

  • Song: "(Am I Just) Fooling Myself"
  • Artist: Eli "Paperboy" Reed
  • CD: Roll with You
  • Genre: Soul

Hear the track at the story page.

Wednesday, March 12, 2008

Haverin on LiveJournal

From xkcd/77:

Because it drives me nuts...

From xkcd/394:

On a serious note, "kB" is "kilobyte" and "kb" is "kilobit." An uppercase "K" is "Kelvin," and so it should never be paired with either "B" or "b". For most modern machines, a "B"yte is 8 "b"its, but there is NO GOOD REASON to assume this case. The meaning of "kilo" is context-dependent, though it's computationally convenient to use 1024 rather than the standard 1000 (because computers address things in base-2).

Monday, March 10, 2008

Snow Wall in Columbus, Sno-hio

If you didn't hear, over Friday night and Saturday morning, 20 inches of snow were dumped on Columbus, OH. That made driving a little rough Saturday, but the main roads cleared up substantially Sunday. Nevertheless, nearly every school is closed today and Ohio State sent out an e-mail warning people that parking might be a little hairy today.

So, I came to work early this morning not knowing what to expect. After previous big snow weekends, the parking lot would get a little smaller because the plowed snow gets pushed to the edges of the lot causing it to contract. However, as you can see, the lot really looks very good:

So, where did all the snow go?! Well, if I turn 180 degrees around, here's what I see:

Now, I walk a little to my left:

So, you're probably thinking that they just plowed all the snow to one end of the parking lot. However, I'm leaving out a big part of the story. If I KEEP walking, you see this:

and this:

and this:

In other words, they've put a SEVEN FOOT SNOW WALL in the MIDDLE of the parking lot, separating one LARGE parking lot into two smaller lots.

Happy melting!