{"id":1974,"date":"2016-12-16T20:32:20","date_gmt":"2016-12-16T19:32:20","guid":{"rendered":"http:\/\/monodes.com\/predaelli\/?p=1974"},"modified":"2016-12-16T14:32:59","modified_gmt":"2016-12-16T13:32:59","slug":"getting-your-latex-book-to-print","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2016\/12\/16\/getting-your-latex-book-to-print\/","title":{"rendered":"Getting Your (LaTex) Book to Print"},"content":{"rendered":"<blockquote><p><a href=\"http:\/\/openlogicproject.org\/2015\/11\/22\/getting-your-book-to-print\/\"><img data-recalc-dims=\"1\" height=\"521\" width=\"772\" decoding=\"async\" class=\"size-full alignright\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2016\/12\/blurb-772x521.png?resize=772%2C521\" alt=\"\" \/><\/a>As I explained yesterday, making a custom text from the OLP source using LaTeX is relatively easy.\u00a0 But, I\u2019d also like to get an attractively printed version with covers and everything.\u00a0 So I\u2026<\/p><\/blockquote>\n<p>Sorgente: <em><a href=\"http:\/\/openlogicproject.org\/2015\/11\/22\/getting-your-book-to-print\/\">Getting Your Book to Print | Open Logic Project<\/a><\/em><\/p>\n<p><!--more--><!--nextpage--><\/p>\n<blockquote><p>As I explained <a href=\"http:\/\/openlogicproject.org\/2015\/11\/21\/making-a-new-logic-textbook-in-seven-easy-steps\/\">yesterday<\/a>, making a custom text from the OLP source using LaTeX is relatively easy.\u00a0 But, I\u2019d also like to get an attractively printed version with covers and everything.\u00a0 So I\u2019m trying out two print-on-demand services: <a href=\"http:\/\/lulu.com\/\">lulu.com<\/a> and <a href=\"http:\/\/blurb.com\/\">blurb.com<\/a>.\u00a0 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.\u00a0 Both Lulu and Blurb let you upload PDFs for this, and they give you the specs to format your books for print.\u00a0 All the files are on GitHub (<a href=\"https:\/\/github.com\/rzach\/phil379\/tree\/b0928eec9534053f67188afb9cfca8c963cb8cb7\/printtest\">this version<\/a>, <a href=\"https:\/\/github.com\/rzach\/phil379\/tree\/master\/printtest\">most current version<\/a>), but I\u2019ll walk you through the process.<\/p>\n<p>First, we have to choose a size. I went with Royal for Lulu (that\u2019s the size, e.g., your standard OUP book comes in. It\u2019s slightly larger than US Trade, which is 6\u2033 by 9\u2033).\u00a0 Blurb doesn\u2019t offer Royal, so there I\u2019m using US Trade.<\/p>\n<p>First, let\u2019s go through the Lulu process. After you <a href=\"http:\/\/www.lulu.com\/create\/books\">pick your binding<\/a> (perfect-bound paperback), size (Royal), and color (B&amp;W on White paper), and clicking \u201cmake this book,\u201d Lulu will tell you what the page dimensions of the PDF should be: 15.593cm x 23.389cm.\u00a0 Setting up the book design can be a long process, but for now I\u2019m just interested in the print quality, speed of delivery, and pricing.\u00a0 Since I use the <a href=\"https:\/\/www.ctan.org\/pkg\/memoir\"><code class=\"\" data-line=\"\">memoir<\/code><\/a> class, setting up the design is relatively easy. [Update: <a href=\"http:\/\/www.logicamani.in\/\">A. Mani<\/a> pointed out that you can also use the <a href=\"https:\/\/www.ctan.org\/pkg\/bookcover?lang=en\"><code class=\"\" data-line=\"\">bookcover<\/code><\/a> LaTeX class, and for more involved covers, esp. dust jackets for hardbound copies, this is probably the way to go.]<\/p>\n<p>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:<\/p>\n<p><code class=\"\" data-line=\"\">\\setstocksize{23.389cm}{15.593cm}<br \/>\n\\settrimmedsize{\\stockheight}{\\stockwidth}{*}<br \/>\n\\settrims{0pt}{0pt}<\/code><\/p>\n<p>Since this is a non-standard size, we\u2019ll also have to tell memoir where to put the text on that page.\u00a0 For this, we\u2019ll first have to determine the size of the typeblock, the are that will hold the running text.\u00a0 That of course depends on the stock size, but also on the typeface and the type size.\u00a0 For optimal readability, the typeblock should be dimensioned so that a line of text contains not more than 70 characters.\u00a0 So you have to determine how long a line with, say, 65 characters in your typeface\/type size is, and that\u2019ll give you the width of the typeblock.\u00a0 That would be a pain to find out, but memoir has a macro for it: <code class=\"\" data-line=\"\">\\setlxvchars<\/code> will set the length <code class=\"\" data-line=\"\">\\lxvchars<\/code> to that length.\u00a0 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.<\/p>\n<p><code class=\"\" data-line=\"\">\\setlxvchars<br \/>\n\\settypeblocksize{*}{\\lxvchars}{1.618}<\/code><\/p>\n<p>The next step is to determine the margins and the positioning of the header and footer.\u00a0 You can set these by hand, and it\u2019ll depend on, e.g., if you want to have space in the margin for notes, etc. For now, let\u2019s keep it simple: Make everything in the golden ratio too, and start the typeblock 60pt from the top edge.<\/p>\n<p><code class=\"\" data-line=\"\">\\setlrmargins{*}{*}{1.618}<br \/>\n\\setulmargins{60pt}{*}{*}<br \/>\n\\setheaderspaces{*}{*}{1.618}<\/code><\/p>\n<p>Now you tell memoir to fix the layout to these specifications using <code class=\"\" data-line=\"\">\\checkandfixthelayout<\/code>. 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.<\/p>\n<p>That\u2019s it. Run it through LaTeX and you have a PDF for the book interior to upload to Lulu.<\/p>\n<p>For Blurb, the procedure is almost the same, except that they want you to include the trim.\u00a0 In the <a href=\"http:\/\/www.blurb.ca\/make\/pdf_to_book\/booksize_calculator#book-attributes\">book size calculator<\/a> on their site, you select the options (trade book, 6\u2033 by 9\u2033). Now the stock size is 6.125\u2033 x 9.25\u2033 with 0.125\u2033 trim, so:<\/p>\n<p><code class=\"\" data-line=\"\">\\setstocksize{9.25in}{6.125in}<br \/>\n\\settrimmedsize{9in}{6in}{*}<br \/>\n\\settrims{.125in}{.125in}<\/code><\/p>\n<p>Everything else stays the same.<\/p>\n<p>After you upload the PDF to Lulu, you\u2019ll click \u201cmake print-ready PDF\u201d. Lulu might now warn you about type that\u2019s too small to print clearly (e.g., subscripts).\u00a0 I haven\u2019t worried about it and will wait for the printed copy to check if that\u2019s a problem.\u00a0 Then you get to design a cover. There\u2019s a cover \u201cwizard\u201d that lets you do that, but we\u2019re nerds and want to make our own PDF using LaTeX. So click on \u201cone piece cover creator\u201d to go to the PDF upload page. Here it\u2019ll tell you what your cover PDF should look like.\u00a0 (Blurb tells you up front in the <a href=\"http:\/\/www.blurb.ca\/make\/pdf_to_book\/booksize_calculator#book-attributes\">book size calculator<\/a>, but you need to know the number of pages in the book, since the width of the spine depends on that).<\/p>\n<p>I made a separate LaTeX file for the cover, also using memoir.\u00a0 Now the stock size is larger (same height, but twice the width + the width of the spine).\u00a0 Lulu gives these dimensions in \u201c<a href=\"https:\/\/en.wikipedia.org\/wiki\/Point_%28typography%29\">PostScript points<\/a>\u201d which correspond to the LaTeX measure \u201cbp\u201d.\u00a0 Lulu says:<\/p>\n<blockquote><p><strong>Spine width:<\/strong> 23.351 Postscript points wide (0.824 cm) (97 px)<br \/>\n<strong>Spine begins<\/strong> 451 Postscript points (15.908 cm) (1879 px) from the left<br \/>\n<strong>Total cover width:<\/strong> 925.351 X 681 Postscript points (32.640 cm X 24.021 cm) (3856px X 2838px)<\/p><\/blockquote>\n<p>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 <code class=\"\" data-line=\"\">\\setstocksize<\/code> etc.<\/p>\n<blockquote><p><code class=\"\" data-line=\"\">\\setlength{\\coverheight}{681bp}<br \/>\n\\setlength{\\coverwidth}{925.351bp}<br \/>\n\\setlength{\\spinewidth}{23.351bp}<br \/>\n\\setlength{\\spinepos}{451bp}<\/code><\/p><\/blockquote>\n<p>Now we have to place the front cover, back cover, and spine text into the right place.\u00a0 Absolute positioning is not something LaTeX is designed to do, but there is the <a href=\"https:\/\/www.ctan.org\/pkg\/textpos\"><code class=\"\" data-line=\"\">textpos<\/code><\/a> package that lets you do it. After you load it:<\/p>\n<blockquote><p><code class=\"\" data-line=\"\">\\usepackage[absolute,overlay]{textpos}<\/code><\/p><\/blockquote>\n<p>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:<\/p>\n<blockquote><p><code class=\"\" data-line=\"\">\\begin{textblock*}{23.351bp}(451bp,0bp) ... \\end{textblock*}<\/code><\/p><\/blockquote>\n<p>Of course, the text on the spine should go along the spine, so we have to use the <code class=\"\" data-line=\"\">\\rotatebox<\/code> macro from the <a href=\"https:\/\/www.ctan.org\/pkg\/rotating?lang=en\"><code class=\"\" data-line=\"\">rotating<\/code><\/a> package. This code in my file centers the text on the spine, horizontally and vertically:<\/p>\n<blockquote><p><code class=\"\" data-line=\"\">\\begin{textblock*}{\\spinewidth}(\\spinepos,0bp)%<br \/>\n\\noindent\\hfil\\rotatebox{-90}{%<br \/>\n\\hbox to \\coverheight{\\hfil<br \/>\nText that goes on the spine<br \/>\n\\hfil}\\hfil<br \/>\n\\end{textblock*}<\/code><\/p><\/blockquote>\n<p>You\u2019ll probably want the text to be styled properly (e.g., larger size, etc).<\/p>\n<p>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 <code class=\"\" data-line=\"\">\\spinepos<\/code> + <code class=\"\" data-line=\"\">\\spinewidth<\/code>.<\/p>\n<p>This will make a boring black &amp; white cover, but of course you can play around with colors and\/or put images on the cover.\u00a0 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 <code class=\"\" data-line=\"\">xcolor<\/code> package, define the colors and set the page background and text color in the preamble:<\/p>\n<blockquote><p><code class=\"\" data-line=\"\">\\usepackage{xcolor}<br \/>\n\\definecolor{OLPiceblue}{RGB}{179,199,227}<br \/>\n\\definecolor{OLPreflexblue}{RGB}{12,28,140}<br \/>\n\\color{OLPreflexblue}<br \/>\n\\pagecolor{OLPiceblue}<\/code><\/p><\/blockquote>\n<p>For Blurb, the procedure is the same.\u00a0 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 (<code class=\"\" data-line=\"\">textpos<\/code> lets you set the background color on each positioned textblock using <code class=\"\" data-line=\"\">\\textblockcolor<\/code>).\u00a0 Blurb also automatically adds a (free) ISBN to the back cover, so you\u2019ll have to take that into account.\u00a0 Lulu also gives you a fee ISBN, but it\u2019s required only if you want to sell the book through retail services (Amazon, Barnes &amp; Noble, and the Ingram network).<\/p>\n<p>That\u2019s it. Upload the cover PDF and enter whatever Lulu and Blur want in terms of metadata, license info, etc., and then order the book.\u00a0 For this 143-page test, Lulu charged $6.77 and Blurb $3.89 (Canadian).\u00a0 However, Blurb\u2019s cheapest shipping option was $5 more than Lulu\u2019s 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.\u00a0 I\u2019ll let you know how delivery speed and quality of the finished product compare.<\/p>\n<p>[Update: See <a href=\"http:\/\/openlogicproject.org\/2016\/03\/12\/an-actual-textbook-and-photos\/\">this post<\/a> for how it turned out in the end!]<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">As I explained yesterday, making a custom text from the OLP source using LaTeX is relatively easy.\u00a0 But, I\u2019d also like to get an attractively printed version with covers and everything.\u00a0 So I\u2026 Sorgente: Getting Your Book to Print | Open Logic Project<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2016\/12\/16\/getting-your-latex-book-to-print\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1,132],"tags":[136],"class_list":["post-1974","post","type-post","status-publish","format-standard","hentry","category-senza-categoria","category-tex","tag-print-on-demand"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-vQ","jetpack-related-posts":[{"id":1931,"url":"https:\/\/monodes.com\/predaelli\/2016\/11\/18\/like-a-lined-notebook\/","url_meta":{"origin":1974,"position":0},"title":"Like a lined notebook?","author":"Paolo Redaelli","date":"2016-11-18","format":false,"excerpt":"Well, I\u00a0really want to make my next LaTeX notes looking like this! From\u00a0templates - How to use Latex to print a document to look like a lined notebook? - TeX - LaTeX Stack Exchange Well, actually I want it with a squared, checkered background, like paper sheets used in booklets","rel":"","context":"In &quot;Tex&quot;","block_context":{"text":"Tex","link":"https:\/\/monodes.com\/predaelli\/category\/tex\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14454,"url":"https:\/\/monodes.com\/predaelli\/2025\/12\/11\/bind-rpg-2\/","url_meta":{"origin":1974,"position":1},"title":"BIND RPG","author":"Paolo Redaelli","date":"2025-12-11","format":false,"excerpt":"BIND RPG BIND is an open-source, grunge-fantasy RPG, designed for printing . And it's made in LaTex! I do love the tables and the decorations!","rel":"","context":"In &quot;Role Play Games&quot;","block_context":{"text":"Role Play Games","link":"https:\/\/monodes.com\/predaelli\/category\/games\/role-play-games\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2458,"url":"https:\/\/monodes.com\/predaelli\/2017\/05\/15\/authoring-rpg-books-in-latex\/","url_meta":{"origin":1974,"position":2},"title":"Authoring RPG books in LaTeX","author":"Paolo Redaelli","date":"2017-05-15","format":false,"excerpt":"publishing - Authoring RPG books in LaTeX: what packages to use? - TeX - LaTeX Stack Exchange I am intending on authoring a role playing game (RPG) and was wondering which LaTeX packages I should use. Fits exactly my needs. Authoring RPG books in LaTeX: what packages to use? up\u2026","rel":"","context":"In &quot;Role Play Games&quot;","block_context":{"text":"Role Play Games","link":"https:\/\/monodes.com\/predaelli\/category\/games\/role-play-games\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4923,"url":"https:\/\/monodes.com\/predaelli\/2018\/11\/17\/css-the-perfect-print-stylesheet-the-jotform-blog\/","url_meta":{"origin":1974,"position":3},"title":"CSS: The Perfect Print Stylesheet | The JotForm Blog","author":"Paolo Redaelli","date":"2018-11-17","format":false,"excerpt":"Here's something I shall add to my themes, expecially \"bollettino\" and \"qualita\": CSS: The Perfect Print Stylesheet | The JotForm Blog CSS: The Perfect Print Stylesheet by Andreas Hecht Even today, there are still many people that want to print out the entire internet. This can have many reasons. Maybe\u2026","rel":"","context":"In &quot;HTML&quot;","block_context":{"text":"HTML","link":"https:\/\/monodes.com\/predaelli\/category\/html\/"},"img":{"alt_text":"a4-print","src":"https:\/\/i0.wp.com\/www.noupe.com\/wp-content\/uploads\/2014\/06\/a4-print.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.noupe.com\/wp-content\/uploads\/2014\/06\/a4-print.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.noupe.com\/wp-content\/uploads\/2014\/06\/a4-print.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1925,"url":"https:\/\/monodes.com\/predaelli\/2016\/11\/17\/texlive-is-crippled-in-centos-7\/","url_meta":{"origin":1974,"position":4},"title":"TexLive is crippled in Centos 7","author":"Paolo Redaelli","date":"2016-11-17","format":"link","excerpt":"Oh, what a joy discovering that TexLive packages in CentOS 7 are bugged or crippled beyond any reasonable amount! Furthermore TeXlive in distros like CentOS 7 is crippled since they don't offer the TeXlive Manager called tlmgr. So updating packages is a pain, since it has to be done manually,\u2026","rel":"","context":"In &quot;Tex&quot;","block_context":{"text":"Tex","link":"https:\/\/monodes.com\/predaelli\/category\/tex\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":11412,"url":"https:\/\/monodes.com\/predaelli\/2024\/03\/05\/css-for-printing-to-paper\/","url_meta":{"origin":1974,"position":5},"title":"CSS for printing to paper","author":"Paolo Redaelli","date":"2024-03-05","format":false,"excerpt":"CSS for printing to paper I do like articles explaining how to use CSS for printing! CSS for printing to paper Introduction Sample files @page @media print Width, height, margin, and padding Element positioning Multi-page documents with repeating elements Portrait \/ Landscape mode Data source Essentials cheatsheet Introduction At work,\u2026","rel":"","context":"In &quot;HTML&quot;","block_context":{"text":"HTML","link":"https:\/\/monodes.com\/predaelli\/category\/html\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/1974","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/comments?post=1974"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/1974\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=1974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=1974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=1974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}