Getting Your Book to Print

As I explained yesterday, making a custom text from the OLP source using LaTeX is relatively easy.  But, I’d also like to get an attractively printed version with covers and everything.  So I’m trying out two print-on-demand services: lulu.com and blurb.com.  The challenge is now to (a) format the book so that the can print it and (b) to find a way to produce a cover.  Both Lulu and Blurb let you upload PDFs for this, and they give you the specs to format your books for print.  All the files are on GitHub (this version, most current version), but I’ll walk you through the process.

First, we have to choose a size. I went with Royal for Lulu (that’s the size, e.g., your standard OUP book comes in. It’s slightly larger than US Trade, which is 6″ by 9″).  Blurb doesn’t offer Royal, so there I’m using US Trade.

First, let’s go through the Lulu process. After you pick your binding (perfect-bound paperback), size (Royal), and color (B&W on White paper), and clicking “make this book,” Lulu will tell you what the page dimensions of the PDF should be: 15.593cm x 23.389cm.  Setting up the book design can be a long process, but for now I’m just interested in the print quality, speed of delivery, and pricing.  Since I use the memoir class, setting up the design is relatively easy. [Update: A. Mani pointed out that you can also use the bookcover LaTeX class, and for more involved covers, esp. dust jackets for hardbound copies, this is probably the way to go.]

First, we set the stock size, i.e., the size of the paper the thing will be printed on, and the trim size, i.e., the area on the stock that will remain after the pages are trimmed. For a Lulu PDF, you ignore the trim. So:

\setstocksize{23.389cm}{15.593cm}
\settrimmedsize{\stockheight}{\stockwidth}{*}
\settrims{0pt}{0pt}

Since this is a non-standard size, we’ll also have to tell memoir where to put the text on that page.  For this, we’ll first have to determine the size of the typeblock, the are that will hold the running text.  That of course depends on the stock size, but also on the typeface and the type size.  For optimal readability, the typeblock should be dimensioned so that a line of text contains not more than 70 characters.  So you have to determine how long a line with, say, 65 characters in your typeface/type size is, and that’ll give you the width of the typeblock.  That would be a pain to find out, but memoir has a macro for it: \setlxvchars will set the length \lxvchars to that length.  Then we can set the size of the typeblock to be that width, and whatever height makes the ratio of height to width the golden ratio.

\setlxvchars
\settypeblocksize{*}{\lxvchars}{1.618}

The next step is to determine the margins and the positioning of the header and footer.  You can set these by hand, and it’ll depend on, e.g., if you want to have space in the margin for notes, etc. For now, let’s keep it simple: Make everything in the golden ratio too, and start the typeblock 60pt from the top edge.

\setlrmargins{*}{*}{1.618}
\setulmargins{60pt}{*}{*}
\setheaderspaces{*}{*}{1.618}

Now you tell memoir to fix the layout to these specifications using \checkandfixthelayout. This will also make some slight adjustments, e.g., guaranteeing that the height of the type block is an even multiple of the line height.

That’s it. Run it through LaTeX and you have a PDF for the book interior to upload to Lulu.

For Blurb, the procedure is almost the same, except that they want you to include the trim.  In the book size calculator on their site, you select the options (trade book, 6″ by 9″). Now the stock size is 6.125″ x 9.25″ with 0.125″ trim, so:

\setstocksize{9.25in}{6.125in}
\settrimmedsize{9in}{6in}{*}
\settrims{.125in}{.125in}

Everything else stays the same.

After you upload the PDF to Lulu, you’ll click “make print-ready PDF”. Lulu might now warn you about type that’s too small to print clearly (e.g., subscripts).  I haven’t worried about it and will wait for the printed copy to check if that’s a problem.  Then you get to design a cover. There’s a cover “wizard” that lets you do that, but we’re nerds and want to make our own PDF using LaTeX. So click on “one piece cover creator” to go to the PDF upload page. Here it’ll tell you what your cover PDF should look like.  (Blurb tells you up front in the book size calculator, but you need to know the number of pages in the book, since the width of the spine depends on that).

I made a separate LaTeX file for the cover, also using memoir.  Now the stock size is larger (same height, but twice the width + the width of the spine).  Lulu gives these dimensions in “PostScript points” which correspond to the LaTeX measure “bp”.  Lulu says:

Spine width: 23.351 Postscript points wide (0.824 cm) (97 px)
Spine begins 451 Postscript points (15.908 cm) (1879 px) from the left
Total cover width: 925.351 X 681 Postscript points (32.640 cm X 24.021 cm) (3856px X 2838px)

My file will do some calculations for you, so you just have to put those measurements in. You can also do it by hand, of course using \setstocksize etc.

\setlength{\coverheight}{681bp}
\setlength{\coverwidth}{925.351bp}
\setlength{\spinewidth}{23.351bp}
\setlength{\spinepos}{451bp}

Now we have to place the front cover, back cover, and spine text into the right place.  Absolute positioning is not something LaTeX is designed to do, but there is the textpos package that lets you do it. After you load it:

\usepackage[absolute,overlay]{textpos}

you can place stuff onto the page with absolute positioning. For instance, our spine will be a box of width 23.351bp positioned at 451bp from the left margin:

\begin{textblock*}{23.351bp}(451bp,0bp) ... \end{textblock*}

Of course, the text on the spine should go along the spine, so we have to use the \rotatebox macro from the rotating package. This code in my file centers the text on the spine, horizontally and vertically:

\begin{textblock*}{\spinewidth}(\spinepos,0bp)%
\noindent\hfil\rotatebox{-90}{%
\hbox to \coverheight{\hfil
Text that goes on the spine
\hfil}\hfil
\end{textblock*}

You’ll probably want the text to be styled properly (e.g., larger size, etc).

The front and back cover are handled similarly. The width of the front and back cover is the same as the spine position, and the front cover begins at \spinepos + \spinewidth.

This will make a boring black & white cover, but of course you can play around with colors and/or put images on the cover.  To keep things simple, I just set the background color to Ice Blue and the text and logos in Reflex Blue (the colors of the OLP logo). You do this using the xcolor package, define the colors and set the page background and text color in the preamble:

\usepackage{xcolor}
\definecolor{OLPiceblue}{RGB}{179,199,227}
\definecolor{OLPreflexblue}{RGB}{12,28,140}
\color{OLPreflexblue}
\pagecolor{OLPiceblue}

For Blurb, the procedure is the same.  In my test, I tried something a bit different with the colors: invert the colors on the spine and add a 1cm edge on the front and back (textpos lets you set the background color on each positioned textblock using \textblockcolor).  Blurb also automatically adds a (free) ISBN to the back cover, so you’ll have to take that into account.  Lulu also gives you a fee ISBN, but it’s required only if you want to sell the book through retail services (Amazon, Barnes & Noble, and the Ingram network).

That’s it. Upload the cover PDF and enter whatever Lulu and Blur want in terms of metadata, license info, etc., and then order the book.  For this 143-page test, Lulu charged $6.77 and Blurb $3.89 (Canadian).  However, Blurb’s cheapest shipping option was $5 more than Lulu’s regular mail option. In the end, I paid Lulu $13.40 and Blurb $14.61 for a single copy, but if you order a bunch (e.g., for your class), Blurb will be cheaper.  I’ll let you know how delivery speed and quality of the finished product compare.

[Update: See this post for how it turned out in the end!]

 

Making a New Logic Textbook in Seven Easy Steps

I’ll be teaching the University of Calgary’s second logic course, imaginatively titled “Logic II,” next term.  It’ll be the first time for me to use the Open Logic Text for this course.  I used it for McGill’s “Intermediate Logic” earlier this year, and Nicole Wyatt has been using parts of the text the last time she taught it a year ago.  Lots has changed, and I’m aiming to provide a nice, self-contained book.  I’ll document the steps to make this happen.

To start, I have to pick the material to include. Logic II is supposed to cover “Introduction to the metatheory of logical systems. Completeness, compactness, Löwenheim-Skolem, and undecidability theorems for first-order logic.”  In previous iterations, I’ve used Boolos, Burgess, and Jeffrey’s Computability and Logic as a textbook, and that’s also what my colleagues who also teach it have used.  In part because of this, I’ve previously covered set theory, then Turing machines, first-order logic, undecidability, completeness and Löwenheim-Skolem theorems in that order: it’s the order BBJ covers it. But with an open text, I can rearrange things if I want to. And I think I do.  Once you cover relations, it’s sort of natural to continue with first-order semantics, definability, and expressibility.  So I’ll go with set theory, metatheory of first-order logic, Turing machines, and undecidability. (Right?)

To make a new book, you have to start by setting up a driver file that does all the setup and loads the parts and chapters you want in the right order.  Of course, I’ll use Git also for that driver file and anything else I’ll need to pull things together. So,

Step 1: set up a GitHub repository [You can skip this step if you don’t want to use Git to keep track of changes.].

create-repo

Step 2: Clone the repository, so I have it on my local drive.  The Git URL is git@github.com:rzach/phil379.git.  I use SSH, but there’s also an HTTS URL: https://github.com/rzach/phil379.git.  Where do you put it?  It’s probably easiest if it lives with the other courses in the OLP directory.  So I go to where my OLP clone lives, then to the subdirectory holding the courses, and clone there:

$ cd ~/tex/openlogic/courses/
$ git clone git@github.com:rzach/phil379.git
$ cd phil379

[If you don’t want to use git, just make a new subdirectory of the /courses directory.]
Step 3: We have to start somewhere, so I’ll copy the files courses/sample/open-logic-sample.tex and courses/sample/open-logic-sample-config.tex from courses/sample to my new directory, renaming them to phil379.tex and phil379-config.tex, respectively. I’ll also add a license and a Makefile, but you wouldn’t have to.

Step 4: The main file, phil379.tex contains the instructions for what to include and in what order.  I’ve changed it so that only what I need is included.  Here is what it looks like at this point, and here are the changes I made to the original open-logic-sample.tex file.  I haven’t yet done anything to the formatting or layout, just changed the title page and what chapters are included.

Step 5: I do want to do a few things a bit different from the default.  First of all, I’ll make the text unpretentious: no Greek formulas, no Fraktur letters for structures.  I haven’t yet made up my mind about terminology, but I think I might want to use “countable” instead of “enumerable”.  (I wouldn’t if I were going to talk about “computably” or “recursively enumerable” sets, but I think I won’t.  And when you’re talking about sizes of sets, “countable” and “uncountable” is a bit more conventional and easier to say. Maybe. I might change my mind later.)  There are some switches I can adjust, too: e.g., I’d like to have everything but biconditional and “true” be primitive symbols: That way there are more cases to prove, but I’ll get all the cases for the conditional and the universal quantifier as exercises.  Lastly, the first-order-logic part includes both sequent calculus and natural deduction as proof systems, but I’ll cover only one.  Maybe natural deduction.  Might change my mind on that too.  Anyway, all these things can easily be specified in phil379-config.sty.

Step 6: Run phil379.tex through LaTeX, get a nice PDF.

Step 7: Commit everything and push to GitHub, so it’s saved (and I can link to the source files here).

[UPDATE: (a) The current version has phil379.tex containing only the content, and the layout and setup is done by phil379-screen.tex and phil379-print.tex, which generate a version for on-screen reading and a version for printing, respectively. See also this post.]

University of Calgary Student Paper Profiles OLP

Nicole Wyatt and I were interviewed (and photographed) for an article on open textbooks in the University of Calgary’s student newspaper, The Gauntlet, last month.

[Photo © Louie Villanueva/Gauntlet]