Marking up Tables in LaTeX

Recently I’ve been writing a LOT of LaTeX for slides (using powerdot) and I’m trying to collect some of what I’ve learned here so I can refer back to it later (and so it’ll be in words I can understand, some LaTeX documentation is slightly too academic for my tastes!)

I find the default formatting for table output in LaTeX can look a bit … squashed, so I always precede my tables with this:

\renewcommand{\arraystretch}{1.5}

To define a table, you use the tabular keyword and define your columns using l, r or c depending whether you want each one right, left or centre justified:

\begin{tabular}{l | l}

Continue reading

Combining PDF Files With Pdftk

I’m currently delivering all my talks with PDF format slides, using Jakob’s PDF Presenter Console, which is awesome but lacks a “goto slide” button and is a little slow to click forward. It doesn’t matter for a short talk but I had 200+ slides for my ZCE preparation tutorial at the Dutch PHP Conference and I was concerned about losing my place! Therefore I split my slides up into several decks, but still need to publish them as a whole.

For years I’ve used PDF Shuffler for this sort of thing but I wondered if there was an easy way of doing this from the command line this time, since I literally wanted to glue together a bunch of files one after another. Predictably, there is and it’s called pdftk – the PDF Toolkit. Continue reading

Git Tip: What Did I Just Merge?

As a lead on an open source project, I spend a lot of time merging awesome contributions from our community into our main repo on github. Sadly, some of them are slightly less awesome (rarely but it does happen) and I sometimes need to unpick what happened to understand the problem and give good feedback. Since the project is hosted on Github, this means having some git tricks up my sleeve, and I thought I’d share.

I have the main repo cloned onto my local machine. Before I do anything, I fetch and merge from the origin and then push back to it, so I know my repo is in sync with the github one. Then I fetch the branch I want to merge – usually one that we’ve got a pull request for. To see what’s in the branch:

git log [branch] --not master

This is nice because it doesn’t show what’s in the master branch of this repo but missing from the incoming branch, it just shows me what’s new on this branch.

I can diff and merge at this point, but more than once I’ve merged and then wondered what changes I have in my repo that aren’t in the github one (this is where it is helpful to have fetched from the remote one first). I have the github repo mapped as “origin” as per the excellent documentation so I can just do:

git diff origin/master..HEAD

This shows me the differences that are in my current repo as compared to origin/master, which is the tip of the main repo shown at the version it was when I last fetched it. I particularly use this when I’ve merged someone’s changes in for testing and am wondering quite what was supposed to happen – sometimes just reading the diff beforehand isn’t enough, it’s only when I get the code merged I realise something unexpected is happening!

PDF Presenter

Recently I’ve switched how I prepare and deliver presentations, using LaTeX to mark up the content and producing PDF slides from that. Which is great but I miss having some of the during-presentation functionality of LibreOffice such as a timer and being able to see what’s on the next slide. Happily for me, there’s a PDF Presenter Console on github and it does what I need!

Getting the thing installed was a bit of a puzzle as it has many dependencies (and that’s just the compiler) but I now have it working like a dream on both my laptop and my netbook. I discovered that it didn’t work with my presenter mouse but with a bit of help from a friend, I have a patch for that and now when I’m presenting I see something like this:

You can set which screen show this, and which shows just the main slide, and you can also set what duration the countdown timer should start from. One really key feature is that the timer doesn’t start counting until you advance from the first slide … unlike in open office where I usually put up the title slide during the break before my talk, then have to stop and start the presentation to reset the clock so I’ve got some vague idea of my running time!

So in true open source form, there’s a tool out there already (thanks Jakob, and thanks for responding to my emails!), and I was able to adapt it to my use case, or rather Kevin was able to! I would love to have the presenter console packaged so I could recommend it for more users, but for now I have a great open source solution enabling me to do what I’m good at – delivering content.

Slide Markup with LaTeX: First Steps

Since starting to create (a large number of) presentations using LaTeX, I’ve been impressed at how easy this is to pick up and also how quick it is to work with marked up content rather than dragging objects around in Impress or equivalent. With that in mind, I thought I’d outline the very basics of the markup (with probably more snippets to follow as I discover them).

Start at the very beginning

First of all, LaTeX templates are fussy things, start with someone else’s outline (for example the one Dave posted, which I use), or one you made earlier. There is some preamble and then the main contents of the presentation go between the \begin{document} and \end{document} bits.

Continue reading

Creating Presentations with LaTeX

This spring/summer, I’m giving quite a few talks at conferences, and I have a number of my own clients that I’m writing new training materials for. That’s a lot of content in total and so, inspired by Dave’s article about LaTeX and powerdot (and with some help from Dave himself!), I’ve started to write my own presentations this way too.

Getting started was a struggle, I’ve never really used anything like it before and if there’s one thing LaTeX doesn’t do well, it’s error messages! The blog post I linked above has a sample presentation in it and I used that as my starting point. The source code goes in a file with a “.tex” suffix, e.g. presentation.tex. I then installed the texlive-latex-extra, latexmk, vim-latexsuite, latex-fonts-recommended and texlive-fonts-extra packages from aptitude, and generated a PDF by running:

latexmk -f -pdfps presentation.tex

Continue reading

Using Persistent Storage with Gearman

I’m using gearman for the first time in a new project, and two things in particular were bothering me. Firstly, there doesn’t seem to be a built-in way to see what’s in the queue. Secondly, if the gearman server dies (which seemed quite likely when I was first getting to grips with this stuff and writing really buggy code!) you lose your queue. Therefore I decided that I would switch gearman over to running with persistent storage. Continue reading

Mercurial Primer

I am a source control nut, I’ve been speaking about Subversion for years, I co-lead an active open source project which uses git and GtiHub, and I’ve also dabbled with Bazaar. So far I’m feeling the limits of Subversion, loving the code-hosting features of some of the DVCS tools, and hating git and github in equal measure (don’t bother to try to talk me out of this, I’m well aware the problems are mostly on my side). I don’t know anyone else using Bazaar in the PHP community but I do know quite a few people raving about Mercurial, or Hg. This post is a quick introduction to the commands I have been using since I started trying out Hg and BitBucket for myself.

Continue reading

Ticket Giveaway: DC4D:2

Did you know that there’s a second edition of the DayCamp 4 Developers event coming up in March? The daycamps are a chance for developers to invest a day in their careers, wherever they are, focussing on the soft skills we need to grow beyond coding monkeys and into accomplished and upwardly-mobile professionals. It’s a virtual conference, so you can join us from anywhere in the world!

In the new edition of DC4D, I’m giving a session entitled “Could You Telecommute?”. I have worked from home for three years and if there’s one thing I’ve learned along the way, it’s that it isn’t always easy! Telecommuting doesn’t suit everyone so if you think you’d like to work this way one day, then I hope to give some pointers for how to tell if it will work out, or how to make it work for you. The event is on March 5th but there are also video-only tickets for those people who would rather watch their sessions back at their own pace.

I have a ticket to give away, so if you want to be my guest, leave me a comment and tell me why I should choose you! NB the tickets are only $35 so this isn’t quite as impressive as it might sound, sorry!

I’ll pick winners on 26th February, with a week to go to the event.