I’m super proud to be able to say this today:
Some of my friends and I have started a scholarship at West Virginia University. We’re calling it the “Open Source Scholarship“. Here’s our pitch:
The Problem: Paying for school is hard, when you’re finished you haven’t learned enough skills to set you apart from your peers, and your resume is unimpressive.
This is a scholarship to motivate young adults to become involved in open source communities.
Committee members working professionally in the open source market will use their collective 30 years experience to recommend students based on the impact of their contributions.
We’ll show you what open source is all about: how to negotiate the open source ecosystem, show you were to get started, and walk you through your first contributions.
On April 23rd of this month @akbutcher and I will taking a few days off from work to fly back to Morgantown, WV where we’ll make the official announcement to the students. Immediately following the announcement we’ll give the what open source is about and how to become involved in it prezo. We’re hoping that if we pull it off right the students will feel comfortable enough to go out and start looking for ways to become involved.
We know what we’re asking the students to do isn’t trivial, so we’re not going to leave them all on their own! After the announcement has been made we’ll be maintaining an IRC channel on freenode.net and handing out our contact information.
The students will have from the day of the official announcement through the Friday before Thanksgiving this year to make contributions. We’ve put together a simple submission portal where they can enter and track their contributions.
I am so excited to see this take off! Check out the official scholarship website for all the details:
Updating to the 0.3.4 version of dblatex has fixed many of the issues detailed in The Aftermath (end of this blog post). See the blog post for more information.
You’re writing a book in DocBook XML, publishing it with dblatex, and you dislike (or want to customize) the fonts it uses in the rendered PDF.
You hunt around the internet and find a nice family of fonts you want to use in your final product. Best of all, they’re free and released under the Open Font License!(Thanks, Adobe!)
The dblatex documentation shows you how to set your fonts, but you can’t seem to get it to work.
Caveat: I can verify that this solution works for TTF type fonts, I can not comment on how well it works for other font types.
First, you will need to identify the actual family name of the fonts you want to use. If your font is not installed on your system there is a command called otfinfo that can tell you the family of the font file (despite sounding specific to OTF fonts, this works on TTFs as well). The otfinfo command is provided by the lcdf-typetools package:
If your desired font is already installed on your system you can use the fc-list command instead to find the same information (fc-list is provided by the fontconfig package):
If this is a new font on your system then you’ll need to install it. There are (at least) two locations that work:
$HOME/.fonts
/usr/share/fonts/truetype/
The Font Manager application (package: font-manager) also provides a graphical way to install font collections.
Rebuild your font caches with the fc-cache -f -v
command. If I recall correctly, you need to have super user permissions to run this. I may be wrong though.
The necessary changes to consume your custom fonts isn’t difficult. Assume that up until now you’ve been rendering your PDFs from XML source like this:
dblatex -o output/Virtual-Disk-Operations.pdf Virtual-Disk-Operations.xml
We need to use XSLT stylesheets to define what our chosen font families are going to be. In this example I’m using Source Sans Pro for the body font and Source Code Pro for monospaced sequences.
First, make a directory called xsl and put a file like this in it:
Next, slightly modify the command you run to build your PDFs (new parts are in bold text):
dblatex -p xsl/dblatex-pdf.xsl -b xetex -o output/Virtual-Disk-Operations.pdf Virtual-Disk-Operations.xml
-p xsl/dblatex-pdf.xsl: This tells dblatex that we’re providing a “user stylesheet” to use when transforming the XML. This stylesheet only has our font customizations in it, but you can put much more in them than just that.
-b xetex: This tells dblatex that instead of rendering our PDF with pdftex we want to use a different backend driver (or “TeX engine”). Specifically we want to use the xetex driver. We choose the xetex driver because of it’s superior font handling abilities via the fontspec LaTeX package. When we use the xetex engine dblatex will insert some special macros into the intermediate LaTeX document it generates, this process is transparent to the end user:
After this, dblatex runs any custom post-compilation scripts, and then hands the intermediate file off to xetex where it is finally transformed into PDF format.
In my case there were some unexpected side-effects from switching backends. Here’s what I’ve noticed so far:
The only thing that really bothers me is the broken word-wrapping character. I can deal with the others breaking. I had intended to remove them from the final product anyway.
Here’s a shell function which unifies the act of creating a directory and then subsequently changing into it:
Example usage:
In the book I’m working on, the Virtual Disk Guide, I recently decided to start templating out an Acknowledgements chapter. I’m writing the book in DocBook5 and my print (PDF) publishing toolchain looks like this:
The problem I ran into is that dblatex has no stylesheets or templates built in to handle DocBook acknowledgements elements and the PDF is difficult to manage, but systems like sodapdf could be the perfect solution for this. Acknowledgements sections should be fairly simple to render I thought. You really just need a chapter header, and then to process the block elements, like paragraphs, blockquotes, and what have you. To me, the same template used for Colophon sections would create an ideal acknowledgements section.
I’ve never done any real XSLT work before, and even after this I still wouldn’t claim that I have, but here’s what I did to get a working acknowledgements section:
I found the location dblatex installs it’s XSL documents to on my system, /usr/share/dblatex/xsl
, then I used grep to find files that matched colophon
elements: grep colophon *.xsl
. Examining the component.xsl
file suggested that it had the templates I needed to copy and modify for feeding into dblatex. After a few attempts I came up with working results. Here’s what it ends up looking like:
And you consume it with dblatex in this way:
For an example of how this renders you can look at the PDF version of the Virtual Disk Guide. I keep the file in version control on the github project for the book.
Speaking of Acknowledgements: Thanks to my buddy Al for dusting off his XSLT skills and debugging this with me initially.
I’ve been working on my book, The Linux Sysadmins Guide to Virtual Disks, since my post about long-term goals a few months back. I think it’s about time I post some updates.