On printing via Blurb’s PDF to Book: Part 5

Momi with "Harry Potter"

Well, I honestly didn’t think I’d be coming back to the topic of my SoFoBoMo book so soon, but a comment on my page about using LaTeX to make photo books stirred up my curiosity.

“Troy”, who blipped in, made a comment and then disappeared, mentioned something called “xelatex” and how “lots of great fonts should be easy to use”.  I’d never heard of XeLaTeX before, but I looked into it and it looked like a pretty nifty piece of software: “a typesetting system based on a merger of Donald Knuth’s TeX system with Unicode and modern font technologies”.  Basically, it’s a version of LaTeX that can produce a PDF directly, and together with the fontspec package can use and embed any TrueType and OpenType fonts you have lying around.  Well, the difficulty of using a variety of fonts was my only real complaint about using LaTeX to produce the book; otherwise I was thrilled with it–so much easier than all the manual layout I’d done in Scribus.  So this weekend I thought I’d better take a look at xelatex and see if there was anything to it.

I’m a huge open-source fan, but I acknowledge that sometimes the path using open source tools can have significant hurdles. In any case I was prepared to make a modicum of effort at trying to get my Chickens, Anyone? book done with a TrueType font (I have a huge selection lying around) and published via the xelatex tool chain. The first part, getting xelatex installed, turned out to be remarkably easy. I’m running Ubuntu Linux, and a quick search via synaptic revealed that it was in the repositories. A couple clicks later, a quick change in the Makefile from pdflatex to xelatex and I was processing the book into a PDF with xelatex.

The second hurdle was figuring out how to use the TT font in the document.  The examples using fontspec looked simple, it was basically a one liner to name the font you want to use, but you need to know the name first.  A quick search revealed the otfinfo tool (part of the lcdf-typetools package, also in the Ubuntu repositories), which, when run on a bunch of .ttf files will tell you their names.  It turns out that the names are just the common ones, such as “Garamond”, “Times New Roman”, etc.  Simple.  A quick edit to add the fontspec line, another make and boom, I’m cranking out PDFs now with great looking fonts and the fonts embedded.

The third hurdle was the first and only real roadblock, and it was a doozy, but I figured it out in the end.  Blurb requires a kind of PDF called a PDF/X-3.  It’s basically a PDF 1.3 version with some restrictions on the content and requiring certain tags and profiles to be present. When I was using pdflatex, I found a nice example with google that showed how to embed the proper strings in the latex file using special directives to make the resulting PDF smell like a PDF/X-3.  Well, with xelatex I needed to get those same strings into the file, but the directives that I had used with pdflatex weren’t defined. It turns out that it can be done, and quite simply, but there is just not a whole lot of documentation out there right now on xelatex.  I searched every nook and cranny of the web for that info, using clue after clue to get me closer and closer, but the info remained elusive.  I was beginning to think that it could not be done without writing some kind of script to postprocess the PDF, when I finally stumbled upon a reference to a different piece of software, one that was probably an ancestor of xdvipdfmx (the piece of the xelatex tool chain that actually produces the PDF).  It was a manual, and it was gold.  It had lots of PDF directives defined and they seemed to be identical to those used in xelatex.  I tried the two that looked right for the job–Bingo–Bob was now my uncle.

The final proof was getting the Blurb PDF to Book site to accept the PDFs all the way through the preflight check and then ordering the book.  And now yet again another version of the book is ordered and I will report on it when it arrives.  I took the opportunity to use some additional knowledge I had gained about the latex geometry package to tweak things a bit so it should even look a bit nicer.

All in all, I’m very tickled. I now have a way to crank out photo books with extremely precise specifications, using any TrueType or OpenType fonts I want, and using text markup instead of painful hours behind a GUI.  In the next couple of days I’ll drop a new release of the latex templates onto the download area, incorporating these changes.  I’ll make a brief post about it that at that time, so if you are interested in the updated templates, stay tuned.

7 thoughts on “On printing via Blurb’s PDF to Book: Part 5

  1. Have you tried producing a photo book (not necessarily “Chickens, Anyone?”) with TexLive? I have not used it as currently teTeX just about is enough & working without problems (even though its development had stopped long ago.)

  2. Well, that answers my non-question.

    I (a FreeBSD user) am now mildly jealous of Ubuntu & any other system for which TeXLive is available as part of package management.

    • Parv,

      I was a long time Redhat user, but when they (temporarily) pulled the plug on the free desktop versions (just before they realized their mistake and plunged back in with the Fedora series) I went casting about for a new distribution. I loved the package management in Debian, but the difficult install and rigid license policies left me feeling that it wasn’t quite the one. Then along came Ubuntu… I’ve been with it since the first release, and aside from an occasional annoyance in this or that release, I love it. It’s been extremely stable, and the existence of the universe and multiverse repositories means I’ve never really had to mess around with 3rd party repositories at all. Highly recommended.

  3. Ha Ha! I’m the “Troy” who butt in. I’m sorry, I usually don’t follow blogs. I just stumbled onto yours (great blog, btw) because I was searching exactly for what you are doing: photobook using LaTeX. I’ve experimented a little with your templates, and they work! Well, if only I can finish editing all the photos.

    Anyways, XeLaTeX should be pretty straightforward. Almost everything you need to know is documented on the fontspec package, and you can even use standard LaTeX packages.

    I still can’t open your chickens-tex.pdf version on my Adobe Reader (v9 on Windows and Ubuntu 9.04). It gives me an error 18. I don’t know if there is anything I need to configure or what. It does open perfectly using evince.

    I’m staying tuned for your updated templates. Thanks very much!

    • Troy,

      Thanks for checking back in–and thanks for pointing me at xelatex. It worked great! And it was really pretty easy, except for the part about getting the PDF/X-3 stuff embedded. But the proof is in the pudding, and Blurb seems to like the PDFs.

      I will be updating the templates RSN; stay tuned. Oh, and I had no trouble viewing the PDFs on a Mac. Are you viewing the old one made with Scribus, or the second one made with LaTeX?

  4. Please help. I’ve been struggling with this for days. I’m trying to use this interesting xetexCV.cls which I found on another site, but it seems to require fontin. So I get the otf fontin off the web, and stick it here…
    I do a texhash, but nothing. It can’t find fontin. I don’t know what to do. I’m going to read the fontspec page but really if you have any ideas please help.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: