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
%% (hideo.umeki@toshiba.co.jp)
%%
%% 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.
\ExecuteOptions{letterpaper,dvips}

\endinput
%%
%% 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 @@
top=\topoffset,
left=\oddoffset,
right=\evenoffset,
- twosideshift=\oddevenshift,
+ twoside=true,
bottom=0.0in,
noheadfoot}
\ifthenelse{\boolean{flashcards@dvips}}{\geometry{dvips}}{}

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.

About these ads

10 thoughts on “Creating Printable PDF Flash Cards Using LaTeX

  1. Conversational Atheist

    I followed your example exactly, except that I did not have a flashcards.cfg file in the directory that you claim that I should have had. (nor anywhere else on my computer.)

    I’m on Ubuntu 8.10, but I don’t think that that’s the issue.

    Reply
  2. Kortec

    This fixed the warnings and errors I had quite nicely, except for some of the obligatory overfull hbox chatter. Well done!

    Reply
    1. Jason Underdown Post author

      I would not say that I am giving up on them, but I have no immediate plans to update them in the near future. However, I plan to be a college math professor, and will certainly use them in my classes in the future.

      The LaTeX source code is available, so feel free to download that and change or add to them as much as you please. If you post new sets on your web site, please link back to me.

      Reply
  3. Anonymous

    I am using mac OS 10.6 and the following directory doesn’t exist:

    /usr/share/texmf-texlive/tex/latex/flashcards/

    I do have the following directory though:

    /usr/local/texlive/2009/texmf-dist/source/latex/flashcards/flashcards.cls

    I’ve included the geometry.cfg file in the directory with flashcards/flashcards.cls replaced with geometry/geometry.cfg.

    Still no luck! Any suggestions?

    Reply
  4. Jonas

    Instead of creating a global config file, I found that I can put a4paper (or letterpaper…) in the options of the documentclass. This will stop the geometry package from breaking, but will create another warning because the flashcards documentclass itself does not use this option.

    Reply
  5. marvin ambrose

    This is all great but my problem is that i’m on windows nd do’nt know how to go about developing flash cards. So pls, I need guidance from you. THANKS.

    Reply

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 )

Google+ photo

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

Connecting to %s