CMYK Output for Printing Prepress

Happy Chinese New Year! Well traditionally CNY is celebrated up till the 15th day, so this isn’t a belated greeting. 😉

I thought my post on the front and back covers (+ISBN bar codes) was the last thing I wanted to document in the bookdesign series, but I just realised that I’d still yet to talk about producing a CMYK version if your printer is using a offset-printing process.

You can read about the CMYK colour model and how it it’s different from RGB. In a nutshell, RGB is for on-screen viewing and is more vibrant, CMYK is for commercial printing and seems more “dull”. Check with your printing service if they’re using (on-demand) laser printing or offset-printing to print your material; it may depend on the type of printing stock (i.e. the paper) you choose.

If laser printing is used, RGB is fine, and you can hand over your pdflatex-generated file over as it is. However if offset-printing is to be used, you’ll need to produce your PDF in CMYK colour model instead. Your printing service might be willing to do the conversion for you at their end; but I think it’s more efficient to do this yourself as you’ll have more control over the final PDF. It’ll also give you a more accurate idea of how your design will look in print, so you’ll have a chance of selecting your colours.

Convert all graphics files to CMYK

Any graphic files that you include (via \includegraphics, for example) must be converted to CMYK. If you have imagemagick, the quick way is

convert image_RGB.jpg -colorspace CMYK image_CMYK.jpg

But I’ve been told that the resulting PDF, when loaded into other applications e.g. Illustrator, contains the “wrong” colours. For more accurate results, you’ll need to use colour profiles as discussed here.

Invoke xcolor CMYK mode

By default, the xcolor package uses the RGB colour model. To invoke CMYK mode:

\usepackage[cmyk, …other options…]{xcolor}

And then there’s the issue of different kinds of black. If your design contains large areas of black, and particularly if it involves light-coloured text (e.g. white) on a black background, the RGB black directly converted to CMYK would have values of C: 100% M: 100% Y: 100% K: 100% (over-saturated rich black). You then run high risks of getting unwanted “shadows” if the four colours print out of registration, as shown in the sample on the right from this excellent article:

Now the cmyk mode of the xcolor package automatically redefines the colour black to C: 0% M: 0% Y: 0% K: 100%, i.e. flat or standard black. Flat black can look rather “washed-out”, so you might want to define a different shade of black, especially for large areas of black. Check with your printing service for further advice. E.g. our printer recommended to use a “cool black”  C: 30% M: 0% Y: 0% K: 100% for the covers of our Grid Computing Cluster book. Unfortunately I couldn’t figure out how to do it previously, but now I do:

\usepackage[cmyk, …other options…]{xcolor}

%% cmyk values have range [0,1]
\definecolor{CoolBlack}{cmyk}{.3,0,0,1}

%% In case you want to redefine the basic black
%% (0,0,0,1) across the board. Check with your
%% printer if this is advisable!!

\definecolor{black}{cmyk}{.4,.3,.3,1}

%% Force the new black into effect, because
%% xcolor issues \color{black} with the old
%% black before all its initialisations.

\color{black}

In other words, you should always liaise with your printing service concerning the technical specs. You’ll thank them for their expert advice, and you’ll learn a lot about graphics design and the printing process as well.

OK that’s it! That’s truly the last of the bookdesign series. I hope you’ve enjoyed it as much as I did.

Front and Back Covers (and ISBN Bar Codes)

Sorry this post is so late after the last one, it was hard finding time to write between work and a toddler. We’re drawing to a close for this bookdesign series now… just as we’re starting a new year.

I’m not very imaginative, nor am I a graphic designer. So for my book cover, I go for a huge title across the top, a background illustration, and author/editor and publisher information at the bottom. Yes, very boring, but playing it safe — I think with a careful choice of fonts, colours and illustration, the end result wouldn’t look too bad at all. 🙂 I personally find the wallpaper package very handy for the cover page. So it might go something like this:

%% No header nor footer on the cover
\thispagestyle{empty}

%% Cover illustration
\ThisLLCornerWallPaper{1}{grapes-in-my-studio-little-too-much-dust}

%% Bar across the top
\tikz[remember picture,overlay]%
\node[fill=Sienna,text=white,font=\LARGE\bfseries,
text=Cornsilk,minimum width=\paperwidth,
minimum height=5em,anchor=north]%
at (current page.north){Exercises in \LaTeX};

\vspace*{2\baselineskip}

{\bfseries\itshape\color{LightGoldenrod!50!Gold}
\fontsize{36pt}{46pt}\selectfont
The Wonderful Calmness\par
of Still Life Photos\par}

\vspace*{2\baselineskip}

{\LARGE\color{LightGoldenrod}
A small dummy example book by
\scshape{Curutari}\par
}

\tikz[remember picture,overlay]%
\node[fill=Sienna,font=\LARGE\bfseries,
text=Cornsilk,minimum width=\paperwidth,
minimum height=3em,anchor=south]%
at (current page.south) {Malaysian \LaTeX\ User Group};

\begin{center}
\LARGE\bfseries\color{SaddleBrown!30!black}

\end{center}

%% Clear to next odd page
\cleardoublepage

Then comes the back cover. Now if the book is published with an ISBN, you’d want to put a bar code for it. I was wondering where I could get a free bar code generator, when a gut instinct told me to look around CTAN for a LaTeX solution. And sure enough, the ean13isbn package does the trick without any hassle:

%% In preamble
\usepackage[ISBN=978-80-85955-35-4]{ean13isbn}

%% Print the ISBN bar code
%% See the documentation for other sizes e.g. SC0, SC1…
\EANisbn[SC4]

So here’s the code for my backcover:

%% Temporarily enlarge this page to push
%% down the bottom margin
\enlargethispage{3\baselineskip}
\thispagestyle{empty}
\pagecolor[HTML]{0E0407}

\begin{center}
\begin{minipage}{.8\textwidth}
\color{Cornsilk}\Large\bfseries
\lipsum[1]

\begin{center}
\huge\bfseries\sffamily\color{lime}`So Calming.’
\end{center}

\lipsum[2]

\end{minipage}
\end{center}

\vspace*{\stretch{1}}

\begin{center}
\colorbox{white}{\EANisbn[SC4]}

\vspace*{\baselineskip}

\textbf{\textcolor{LightGoldenrod!50!Gold}{Malaysian \LaTeX\ User Group \textbullet\ \texttt{http://latex-my.blogspot.com}}}

\textbf{\textcolor{LightGoldenrod}{Cover Illustration by Dusan Bicanski \textbullet\ \texttt{http://www.public-domain-image.com}}}
\end{center}

I’ve also added a table of contents with a simple \tableofcontents. The ToC heading is printed as a chapter heading, so I created a fancy style for it, without the chapter number and background picture, by modifying our fancy chapter code from earlier.

All in all, here’s what our sample book now looks like (empty pages omitted):



Download links of the LaTeX code producing the above:

Illustrations courtesy of PublicDomainImage.com here, here and here; OpenClipart Project here.

Epilogue

Well it’s been fun writing this series. It sure took me some time to prepare the sample code, search for appropriate illustrations and write up the posts, but I’m glad I documented how I achieved some of the effects in that Grid Computing Cluster book. Many thanks to all the readers and especially those who kept the comments section lively. You sure motivated me to finish writing this series! 😀

Customising running headers and footers

By default, the running headers in a two-sided book (resp. article) produced by LaTeX displays the chapter (resp. section) number + title and the page number on even pages; and the page number and section (resp. subsection) number + title on odd pages. On chapter pages, however, the running header is blank, and the page number is displayed in the centre of the footer.

All these default headers and footers can be customised, either with the facilities already provided by the memoir class, or via the fancyhdr package. Basically, you need to redefine the “plain” pagestyle for chapter pages, and the “headings” pagestyle for the non-chapter pages. Using memoir, you’d do something like

\makeevenhead{plain}{left}{centre}{right}
\makeoddhead{plain}{left}{centre}{right}
\makeevenfoot{plain}{left}{centre}{right}
\makeoddfoot{plain}{left}{centre}{right}

% respectively \makeevenhead{headings}…

While if you’re using the fancyhdr package:

\fancypagestyle{plain}{
  %% Clear all headers and footers
  \fancyhf{}
  %% e.g. if right footers on odd pages and left footers
  %% on even pages are some content:

  \fancyfoot[RO,LE]{…}
  %% this applies to right headers on odd pages:
  \fancyhead[RO]{…}
  %% and this to left headers on even pages:
  \fancyhead[LE]{…}
  %% and this to centre headers on both even and odd:
  \fancyhead[C]{…}
}

\fancypagestyle{headings}{…}

As always, see the respective manuals/user guides for extensive instructions.

Here are some examples of what I’ve done:




(Download links of the .tex source files are at the end of this post)

Here are my specs:

  • On chapter pages:
    • page number in a coloured box on the right in the footer on odd pages;
    • ditto, but on the left in the footer on even pages;
    • blank running headers.
  • On non-chapter pages:
    • same footers as above;
    • on even pages, the chapter title on the left in the header, and a decorative line extending to the right all the way to the paper margin;
    • on odd pages, the section title on the right in the header, and a decorative line extending to the left all the way to the paper margin.

I used the tikz package for the coloured box containing the page number, as well as the decorative lines in the header.

You’ll probably notice that on the non-chapter pages, I’ve got some coloured background going on, too. I could’ve used the wallpaper package to achieve this effect, but just for kicks, I did them using the tikz package, using the headings pagestyle as a hook.

So here are the .tex source (plus the public domain images used) for producing the sample pages above:

Note that my examples require wallpaper.sty v2.5. If you’re using MikTeX, your wallpaper.sty is most likely v2.4, so you’ll have to grab the latest version yourself.

Fancy Chapter Headings

This is the 3rd post in the bookdesign series. Previous posts in this series:

If you look at my post that started this series, you might notice that the first page of every chapter in the Grid Computing Cluster report is rather fancy. I’ve initially got my inspirations from Stefan Kottwitz’s post on ‘Fancy chapter headings with TikZ‘.

Here are the samples of how the chapter pages would look like:

(Download links of the .tex source files are at the end of this post)

The chapter number and title are rendered with TikZ, similar to what’s described in Stefan Kottwitz’s post. I threw in a background image across the top of the page, and another one at the lower corner, using the wallpaper package.

Just so we can choose a different image for every chapter, I defined a new command that holds the image filename (\newcommand\chapterillustration{}) and re-define it at each chapter (\renewcommand\chapterillustration{cherry-tomatos}).

Notice that the positioning of the chapter title and the fern leaf background image is different depending on whether the chapter starts on an odd or even page. The memoir document class provides the commands \checkoddpage and \ifoddpage…\else\…\fi, so that you can define what to do in each case.  Don’t worry if you’re not using the memoir document class, these commands are also available via the changepage package.

Now to actually implement these definitions. The memoir document class lets you define chapter styles (e.g. \makechapterstyle{FancyChap}{\def\printchaptertitle##1{…}} see the manual on “Chapter Headings” for more details) in the preamble, which you would activate in the document body with \chapterstyle{FancyChap}.

On the other hand, if you’re not using the memoir document class, use the \titleformat and \titlespacing commands from the titlesec package instead.

Sorry I’m too tired to even post relevant snippets; here are the links to the .tex sources to produce the sample pages above. I’ve incorporated the code for Changing page size and sizes, too. (By the way I used the lipsum package to generate the dummy text. You know, Lorem ipsum dolor sit amet…)

The sample public domain images are from here (cherry tomatos), here (computer chips) and here (fern leaf).

Setting page size and margins

There’s quite a bit of interest in the .tex code behind the Grid Computing Cluster report, but I think posting the raw code in its entirety would be a bit too overwhelming to quickly glean useful tips from it. (Also to avoid getting into any issues with my university… etc…)

So instead, I’ll be doing a series of short posts on how I achieved certain effects and book design, starting with this one. It’s probably faster for people to “zero-in” on what they need. 😉 Posts in this series will be tagged “book design”. But before you implement your next major book project with LaTeX, do check with your printing company about the printing process used. If you’ll be using on-demand laser printing, everything should go fine since the RGB colour model of your PDF should be adequate. However, if you’re going with offset printing, your printing company will most likely prefer CMYK colour model to be used instead, and I haven’t quite figured out how to tweak that perfectly with (pdf)LaTeX. In our case, only the book cover was printed with offset printing, and the effect was acceptable — so that ended well…

IMPORTANT DISCLAIMER: I am NOT a graphics designer, so my choice of colours/illustrations/etc probably sucks. Don’t shoot me. 🙂

Now there are multiple ways to achieve the same effect in LaTeX (that’s FOSS for you). For this report, I’ve decided to use the memoir document class, which incorporates the functionalities of many other packages. (Do take some time to browse or search through the excellent manual with texdoc or mthelp.)

The flowfram package looks like a very interesting solution for designing dynamic layout, but I didn’t find out about it until too late into my own project. Do find some time to look at it yourself. If you want to go with the standard document classes (report, book) or the koma-script classes, I’ll indicate what extra packages you’ll need where relevant.

In this first post we’ll just look at how (custom) page sizes and margins can be specified. Basically my page design is:

  • Stock paper size is 303mm x 216mm. The stock paper is the raw original paper that a commercial printer will print the page on, which will be trimmed down to the page size
  • Page size is A4 i.e. 297mm x 210mm.
  • The printer advised us to leave a good 10mm from the page edges around any printed text.
  • I decided the main typeblock will be 20mm from the top, bottom and spine (inner) edge of the page, and 15mm from the outer edge.
  • Also, the running header should occupy the height of a line of text, 7mm from the top edge of the typeblock. Whereas the baseline of the running footer is 7mm from the bottom edge of the typeblock.

These are not necessarily good measurements for an aesthetically-pleasing book design, but more because I was trying to strike a balance between aesthetics and to fit everything in (Lesson: Get in touch with the printing company early to check with their printing specifications per minimum page margins, etc!)

These can be implemented using commands from the memoir class. (The notion of ‘stock’, although a common concept in publishing and printing industries, is only available in memoir, not in the standard document classes.)

\documentclass[twoside]{memoir}

%% The stock paper size
\setstocksize{303mm}{216mm}

%% The ‘real’ page size
\settrimmedsize{297mm}{210mm}{*}

%% The stock paper will be trimmed 3mm from the
%% top edge and 3mm from the left edge

\settrims{3mm}{3mm}

%% Spine and trim page margins from main typeblock
\setlrmarginsandblock{20mm}{15mm}{*}

%% Top and bottom page margins from main typeblock
\setulmarginsandblock{20mm}{20mm}{*}

%% Header occupies height of a single line;
%% Bottom edge of footer is 7mm from bottom edge
%% of typeblock

\setheadfoot{\baselineskip}{7mm}

%% Bottom edge of header is 7mm from top edge of
%% typeblock

\setlength\headsep{7mm}

%% Apply and enforce layout
\checkandfixthelayout

In my case, due to some later issues with colouring the 3mm bleeding edges too (as per our printing company’s request), I decided to make the trimmed page size the same as my stock size and increased the page margins instead:

\documentclass[twoside]{memoir}

%% Custom stock paper and page size
\setstocksize{303mm}{216mm}
\settrimmedsize{\stockheight}{\stockwidth}{*}

%% Adjust margins accordingly to achieve
%% same previous layout

\setlrmarginsandblock{23mm}{18mm}{*}
\setulmarginsandblock{23mm}{23mm}{*}

\setheadfoot{\baselineskip}{7mm}
\setlength\headsep{7mm}

\checkandfixthelayout

If you just need to print on exactly A4-sized paper, you can forget about setting the stock and trimmed size explicitly and just do

\documentclass[a4paper,twoside]{memoir}

\setlrmarginsandblock…
\setulmarginsandblock…

\checkandfixthelayout

One last thing: if you’re not using the memoir class, you can still change the page margins via a high-level interface with the geometry package:

\documentclass{article}
\usepackage{geometry}
\geometry{
   paperwidth=216mm, paperheight=303mm,
   left=23mm,  %% or inner=23mm
   right=18mm, %% or outer=18mm
   top=23mm, bottom=23mm,
   headheight=\baselineskip,
   headsep=7mm,
   footskip=7mm
}

Again, if you’re just going to print on A4 (or letter) paper, you can just do

\usepackage[a4paper]{geometry}
\geometry{
   left=20mm,  %% or inner=20mm
   right=15mm, %% or outer=15mm
   top=20mm, bottom=20mm,
   headheight=\baselineskip,
   headsep=7mm,
   footskip=7mm
}

i.e. just pass the a4paper option to the geometry package; there’s then no need to set the paper height and width explicitly.

True or False: LaTeX can produce only boring, drab-looking stuff

I was asked to compile and produce a report for a research project to be published, with instructions to make it “look professional”, something like this report here.

I was too stupid to learn how to use PageMaker, Illustrator or FreeHand properly in a short time, so I jumped at LaTeX as  my tool. Well after all, the glossaries (or acronym) package kept the acronyms and abbreviations consistent, and biblatex (a new, experimental package that offers much more flexible citation and bibliography features) meant easy inclusion of list of publications anywhere in the report and without having to manually format the entries. The tikz package provides drawing capabilities which I used liberally all over the page designs. Heck, even adding a barcode for the ISBN was effortless with ean13isbn.

I reckon a few eyebrows were raised, and indeed the printing company expressed surprise when told that our PDF was prepared with LaTeX (“You mean LaTeX can produce colour stuff?”)

Without going into too much details on all the packages I used, here are some excerpt pages from the final product, designed and typeset by yours truly. While I’m certainly not a graphics designer by any means, and really professional layout designs is much more easily achievable with other applications mentioned earlier (if you know how to use them properly), I’m pretty happy with the end result. But never, ever let it be said that LaTeX is capable of producing drab, boring, black-and-white scholarly articles only again!