Mac Latex-mk

Posted by Christopher Wojno Sun, 30 Dec 2007 19:27:00 GMT

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.

Posted in  | Tags , , , , ,  | no comments

X11R6-R7 Upgrade Problem: elf_load_section: truncated ELF file

Posted by Christopher Wojno Sun, 18 Nov 2007 05:09:00 GMT

The Problem

I attempted to update X11 from X11R6.7 to X11R7.3 about a month ago. However, I was not successful and after getting this cryptic message when running startxfce4:

elf_load_section: truncated ELF file
Abort

Launching startx yields that same message repeated six times. Oddly enough, launching X worked and also had two truncated ELF files (or the same one repeated). So, X worked, despite the inability to read a few files. I was confounded to say the least.

I spent hours, which lead to days trying to find what ELF file was truncated. Google searches and digging through help forums turned up nothing. I did:

pkg_delete -rx ".*xorg.*" 
pkg_delete -rx ".*font-.*"

(deleted everything xorg and that which depended on it), then reinstalled xorg (/usr/ports/x11/xorg) to no avail. I even updated from FreeBSD-6.1-RELEASE to FreeBSD-6.2-RELEASE.

As of today, I have resolved the problem and I almost lost my mind when I discovered that xinit, a critical component of startx (startx is invoked by startxfce4), was not even installed. Keep in mind, I was getting this error before I deinstalled everything, so I did not deinstall it inadventently and send myself on a wild goose chase.

I assume the port maintainers moved this component out of the xorg port for some reason when they went from X11R6.9 to R7.2. Indeed, the dist file for the port xinit supports that conjecture.

In Summary

Simply INSTALL: /usr/ports/x11/xinit and you’ll be able to use X11 again. You need not deleted everything. Oh, please be sure you updated according to the /usr/ports/UPDATING file’s directions. X11 upgrades have always required special treatment (this one’s no different).

Best of luck to you.

Posted in  | Tags , , , , , , ,  | no comments

My History with FreeBSD

Posted by Christopher Wojno Wed, 08 Aug 2007 05:38:00 GMT

I’m writing about my transition from Windows to FreeBSD with the hopes that you will enjoy my journey or attempt to enter the larger world of operating systems yourself. I understand if you are busy or can’t endure a switch (due to work or school). I made my switch over a Winter break, I encourage you to take your time if you decide to try. In the meanwhile, enjoy.

The Road at my Back

I was like you once. I had used Windows 3.1, 98, 98SE (__ it), ME (see 98SE), and XP all my life (well, since I was 6-7 and as they appeared). Unix was some big mainframe server running the Internet and was attended to by vampiric, cave-dwelling programmers, Linux was a cult of Unix wannabes who landed slightly above the Unix folk on the afraid-of-people scale. It’s not nice to stereotype! At least those were my notions until my friend told me OSX (Darwin) was essentially a modified FreeBSD distribution (AKA: Unix). Today I use all three genres of operating systems as they suit me. If you’re thinking of moving away from your current operating system to something else, fear not; it’s not that hard.

I’ve been using FreeBSD for quite a few years now (since 2004/2005) as an operating system for my laptop (a Sony Vaio). I dual boot to Windows when need be (various sites require IE, sadly). This was my first foray into the world of non-Windows operating systems. Starting with 5.3, 5.4, 6.1 and finally 6.2, FreeBSD has served dutifully as a stable, reliable, intuitive, and transparent operating system. I am especially fond of that last part. There is no “magic” to this operating system. Everything runs like clock-work and all the components are available to an interested mind.

You can complain about the lack of support iTunes and video and DVD programs, because I never use that stuff anyway (FreeBSD is primarily designed to be a server, not a workstation or recreation station).

Sounds Good

If you need music, use XMMS. It’s the best mp3 player I’ve ever used (I’ve used Windows Media players since version 7, Real Player, and Quicktime). There’s nothing frilly about it. I plays music, PERIOD. Sure you can add more features. Stay away from XMMS2 though. I think it’s a step in the wrong direction for a personal player.

But there is no spyware (and if it is, it’s not obnoxious, but honestly I have not looked at even one line of its source code). You know what I’m talking about, Windows Media player is annoying. I’m confounded every time I want to create a playlist with music on my hard drive. Real player is annoying, but has a better playlist feature than Windows Media player. The reporting and pop-ups and use of IE really annoys me though. Quicktime is less annoying than the previous two, but still annoying. So if you want music for FreeBSD, XMMS is not the only choice, but it’s my choice. They also have some command-line players which work well if you’re a purist. If the developers at XMMS had bungled the interface as badly as Windows Media Player, I would be using that now. But I like XMMS’ UI.

A Window Manager even I Could Love

Speaking of UI’s, the primary reason I wanted to move away from Windows concerned usability. I’m very demanding when it comes to how I get things done. I just don’t like that layout and behavior that the Windows window manager uses (it slows me down and stops me when I don’t care to be stopped); unfortunately for Windows users, you have little flexibility with the behavior. I fell in love with FreeBSD (well, Unix and Linux in general) because, for the first time, I had a choice how I wanted my windows to behave.

Have you ever launched a program, and were then repeatedly assaulted with pop-up windows asking for your input? If you’re like me, you launch a few programs that you’ll need all at once and wait for them to load. So if I needed to browse files, edit the HTML, and view my work, I’d hit control-E, control-R, type notepad, then double-click the Firefox icon. Most of the time, Firefox will take approximately 45 seconds to load. At which time, I would be editing my HTML, only to be interrupted as Firefox steals the focus. You know what happens next, Firefox has what you intended to type into the HTML. Very annoying.

My favorite window manager is XFCE4. It’s light-weight compared to other managers and does a good job of getting out of your way when you really need to work. You can even set it to spawn without them stealing focus. I’d like it to spawn windows UNDER the old windows, but I’ll take a partial victory. The newer versions are starting to get complicated again. They made their own file browser (Explorer in Windows) called Thunar which I couldn’t stand for more than 5 minutes. I’d rather use the terminal (but I’ve never liked graphical directory browsers, I’m just strange). I like being able to issue commands or execute programs while I’m looking at the files. Call me old fashioned… Here’s the great part: you don’t need, nor are you mandated to install Thunar! Just go about your business. This is the common strength of Unix/Linux: if you don’t like something, don’t use it. The default software is adequate for performing every task. It might not be pretty or the most efficient, but you can get the job done with little hassle.

What’s this Do!?

Ports: the programs of FreeBSD. The folks nice enough to write programs for FreeBSD, for free, are also kind enough to make them easy to install and manage with ports. Don’t let the name fool or scare you. They are just programs wrapped up in an installer. For some reason, they are called “ports,” probably because the software was written for other operating systems and “ported” over to FreeBSD or vice versa. FreeBSD lists all the ports and heaping spoonfuls of information at their site. Want to find a program? Look no further! Odds are, anything you need is already in that list. The best part is, they’re all free to use! I don’t know where they find the time to make them, but I sure am glad they do.

Not all Good

I’ve had my share of problems: internal WiFi card causes a kernel panic (despite custom drivers), rare (once every 6-8 months) inability to launch XFCE4 without hitting a black screen of death (system is unresponsive), the inability to access a Flash player (even with Linux emulation, see the next reason), and finally the inability to use the 3D accelerator (OpenGL) on the laptop’s graphics card. As of 2007/09/09 I fixed OpenGL, turned out to be a configuration error. FreeBSD just got better! That is my conclusive list of peeves. Mind that this is a laptop and it has lots of custom hardware to be “energy efficient” and “compact.” I suspect (but have not verified), that the desktop support for hardware is more accomodating.

Hope: There is Help

While the package management is no where near as brain dead as that of Gentoo (2.6.19), it’s still very usable, if you have the time to read and understand what you need to do. Of course, the FreeBSD Handbook offers loads of useful and reliable information for anyone that needs to have key concepts explained (trust me, I used it quite a bit). If you’re new to Unix, that’s a great place to start; however, the best way is to get your hands dirty. Find an old box (256MB of memory is generous for FreeBSD, you can do much with very little with FreeBSD) and start playing.

While I’ve never made use of the various chatrooms, I’ve seen references to various IRC channels concerning Unix and Linux enthusiasts. You can probably ask questions there, though the FAQ’s and Handbooks are more likely to answer your questions faster.

Not the End

As I said, I’ve been using FreeBSD for years now and I do not plan to retire it any time soon. As a matter of fact, I can’t wait for 7, which has native serial support (so I can plug my microelectronics into the ports directly and configure them, if you were curious).

If you decide to take the plunge, try FreeBSD. It has a steep learning curve, but the results are spectacular. If you are satisfied with your current operating system, I encourage you to try it any way. Maybe you will discover something you never thought possible? My real hope is that you discover how you can task more effectively. Fear not the command line, it is your friend (well, it’s mine).

Posted in  | Tags , , , ,  | no comments