Monthly Archives: January 2009

Creating Printable PDF Flash Cards Using LaTeX

This post details how to make high quality, printable flash cards like I have available at my web site. I am assuming you are using Ubuntu Linux. I did this on Ubuntu 8.04 (Hardy Heron), but it might work on some previous and later versions as well.

First you want to install LaTeX, plus Andrew Budge’s flashcards package. Open a command terminal and type in the following command to install TeX and LaTeX. The flashcards package resides in the texlive-latex-extra Ubuntu package.

$ sudo apt-get install texlive texlive-latex-extra

I also recommend installing Kile which is a great program for editing TeX/LaTeX documents. You can do this with the following command. Depending on your system configuration, apt-get might require you to install several extra packages. The following is optional:

$ sudo apt-get install kile

At this point, if you try to compile a latex document that uses the flashcards package, you’ll get the following error:

! Package geometry Error: You must set \paperwidth properly.

To fix this, we need to create a small file called geometry.cfg, which tells the geometry packages which type of paper we will be using. Create the file using the following command:

$ sudo gedit /usr/share/texmf-texlive/tex/latex/geometry/geometry.cfg

Now copy and paste the following into gedit, save the file and exit from gedit.

%% This is file `geometry.cfg',
%% generated with the docstrip utility.
%% The original source files were:
%% geometry.dtx (with options: `config')
%% File: geometry.dtx Copyright (C) 1996-2002 Hideo Umeki
%% (
%% This package may be distributed under the terms of the LaTeX
%% Project Public License, as described in lppl.txt in the base
%% LaTeX distribution, either version 1.2 or (at your option)
%% any later version.

%% Uncomment and edit the line below to set default options.

%% End of file `geometry.cfg'.

Now, you should be able to compile a LaTeX document that uses the flashcards package without errors, but there will be some warnings. To fix the warnings, we need to change one line in flashcards.cls.

$ sudo gedit /usr/share/texmf-texlive/tex/latex/flashcards/flashcards.cls

The following diff command shows the change you need to make:

$ diff -ru flashcards.cls.bak flashcards.cls
--- flashcards.cls.bak 2009-01-26 17:15:27.000000000 -0700
+++ flashcards.cls 2009-01-26 19:43:57.000000000 -0700
@@ -83,7 +83,7 @@
- twosideshift=\oddevenshift,
+ twoside=true,

Now you should be able to compile a LaTeX document without any errors or warnings, excepting for any errors in your own markup of course.