74

People are nowadays increasingly often reading papers on screen, using ebook readers, tablet PCs, laptops, etc. A typical PDF file generated with Latex is far from ideal for such use; in particular, there is a lot of empty space around the text.

Of course there are applications with which you can take any PDF file and trim the margins. But when I'm preparing PDF versions of my own papers, it might make more sense to do this directly in Latex.

Hence two questions:

1. How do I easily prepare a PDF file for screen reading if I'm lazy? In particular, I don't want to change the line breaks or page breaks or placement of floating figures, etc. I'd like to keep the original font size, \textheight, \textwidth, etc. However, I'd like to remove as much white space as possible around the body (and possibly between the body and footer/header).

Using the geometry package and experimenting with its settings might look like an obvious idea, but it doesn't seem to be easy to preserve the original layout (unless you manually re-set textheight, textwidth, etc.).

For backwards-compatibility, I'd prefer to have a solution that works both with pdflatex and with latex + dvips + ps2pdf; in particular, I'd prefer to not add any special command line switches on dvips command line for specifying the non-standard paper size. And I'd like to have a somewhat robust solution that I can use not only with standard class files such as article and amsart but also with publisher-specific styles.

2. What are the best practices to follow if I'm not lazy? If I'm willing to re-do the layout, are there any guidelines of recommended font sizes, fonts, page dimensions, aspect ratios, margin sizes, etc., that I should follow? Do we perhaps have a Latex document class or a package that produces an ebook-friendly layout?

7
  • A related (but not identical) question: Creating Kindle-friendly versions of existing LaTeX documents
    – Lev Bishop
    Sep 14, 2010 at 19:30
  • Actually you shouldn't use PDF at all for screen reading; a linear, paginated format is just not optimal. Try using a neutral source like DocBook and create an HTML and a PDF version from that.
    – Philipp
    Sep 15, 2010 at 18:24
  • 3
    a linear, paginated format is just not optimal - This is rather controversial. Note that many (most?) ebook readers will impose their own pagination onto reflowable formats like Epub. Sep 16, 2010 at 11:58
  • @jukka suomela: I see you just opened a bounty for this question. Are you interested in the generation of mobi/epub from LaTeX sources specifically?
    – raphink
    Aug 26, 2012 at 22:52
  • @Raphink: As the title suggests, this question is specifically about producing PDF files from a Latex source. All answers are from 2010, and I decided to open the bounty to see if anyone has new ideas related to this question. Aug 26, 2012 at 22:56

10 Answers 10

23

PhilTeX has a nice article about it: Reading PDFs on portables. It answers some of your TeXnical questions, but I'm afraid it is hard to give advice on things like aspect ratios and font sizes. The medium you're targetting is very diverse and something that works for a laptop might not work on a Kindle.

Update: I just stumbled across a talk on typesetting for the iPad given at TUG2010. It could be interesting, he gives a demo too.

2
  • 12
    I'm the author of the article in question. Thanks for mentioning it. I hope you find my advice useful, though it's not geared towards preserving the same \textwidth, figure placement, etc. (Though perhaps the other advice there about cropping could be used instead.) A more radical option would be to convert to ePub: tex.stackexchange.com/questions/1551/use-latex-to-produce-epub
    – frabjous
    Sep 14, 2010 at 15:46
  • 1
    charlietanksley.net seems to be down at this point.
    – Ernir
    Jul 3, 2013 at 9:43
15

The memoir class supports an ebook paper size, designed to be nicely displayed on digital readers.

12
+100

Personally, I set the paper size to be the same as the physical size of the device, use extremely tiny margins, and use fonts that have large x-height (Fontin + Cambria Math is my current choice). I blogged about the setup with some samples. I use ConTeXt, but the style can be easily replicated in LaTeX.

1
  • 1
    That is the obvious solution. If someone has to read a pdf (unfortunately) on an ebook reader, then the author needs to know the screen dimension. I'm scanning this answers have still yet to find what the screen dimensions are for the Kindle Reader, or the Kindle Fire, or the various IPads. A 7" Kindle Fire, for instance, is 7" diagonally. Authors need to know the exact dimension of not just the screen, but the dimensions of the display area allocated to the pdf page. With LaTeX, it should be easy to several versions, one for ebook reader, another for Kindle Fire7" another for laptop etc
    – user12711
    Dec 13, 2013 at 4:42
5

TeXLive provides a Perl utility named pdfcrop, written by Heiko Oberdiek, and based on LaTeX.

pdfcrop is a utility to calculate and remove empty margins from each page in the input PDF file. The resulting output file occupies the minimal paper size needed for the contents.

You can keep some margins using the --margin option:

--margins "<left> <top> <right> <bottom>"
(0 0 0 0) add extra margins, unit is bp. If only one number is given, then it is used for all margins, in the case of two numbers they are also used for right and bottom.

3

To answer the 2nd part: You could argue that from a user's perspective, PDF is not the optimal choice of format for an ebook device.

Mainly because the ebook devices differ a lot in screen-size and users want to some users want to use custom font settings on their devices.

E.g. epub is a format choice that deals better with these issues.

I.e. you would need to convert your LaTeX document to some HTML-subset that is used by epub.

Which is obviously complicated to do right (convert formulas, figures etc.).

Related to this - (as mentioned in a comment to another post,) someone asked a question on StackExchange regarding the LaTeX to epub conversion process.

1
  • 3
    PDF is not the right format if you are tagetting multiple devices for multiple user. But if you are only interested in the one device that you have, and the one reader that is going to read on that device, you can optimize the settings (page size and fonts) to your liking. In my opinion, epub readers in these devices leave a lot to be desired in terms of line breaking, etc and rendering of mathml.
    – Aditya
    Sep 15, 2010 at 19:05
1

You can have a preable in your class that can set parameters for either viewing or printing.

%% UNCOMMENT the next line for a PRINT-OPTIMIZED VERSION of the text %%
%\setboolean{ForPrinting}{true}

%% Initialize values to ForPrinting=false
\newcommand{\Margins}{hmarginratio=1:1}     % Symmetric margins
\newcommand{\HLinkColor}{blue}              % Hyperlink color
}

I had a similar problem sometimes back. The best information came from an unlike source. A Project Gutenberg book Calculus Made Easy. Download it and have a look at the class. On my screen the Page settings are perfect for reading.

1

Regarding your second question, the guidelines are the ones that are valid for web design, and you can't do much with LaTeX.

1

I just use:

%%For margins: for printing/for viewing on screen.
%\usepackage[textwidth=5.5in,textheight=9.0in,centering]{geometry}
\usepackage[papersize={6.5in,10in},margin=0.5in]{geometry}

Put after the hyperref package. The second line works well on computer screens and 10 inch tablets, but not on 6 or 7 inch devices --- for them, you have no choice but to change the paper size so that you have roughly double the number of pages (so half the material on each page).

1

eBook readers, the ones dedicated to reading books (Kindle, Nook) rather than purchasing cool applets (iPad, Kindle-Fire), use eInk paper technology with a small screen size of 3.6in X 4.8in. The most frequent problem that I've found with pdfs designed for ebooks, is that anticipate a 8.5in X 11in stock page. On an eBook reader, the user has to scroll around to view a single page, then when done advance to the next page and start this distracting process all over again. There is little chance that a reader will be happy with reading such an eBook on their reader.

If the final eBook is in pdf format rather than ePub or Mobi formats (dedicated ebook formats) then the solution is to define the proper page size, which for eBook readers in 2013 is a paper size of 3.6in X 4.8in. Also, the margins have to eliminated since it wouldn't be practical to use the typical guidelines, say for instance, one-inch margins--the eBook would be next to useless in that case.

3.6in X 4.8in. is the perfect page size for an eBook in pdf format, not only because it fits perfectly on readers eInk screen, but also because most ebooks for full size computer screens are more comfortable read in a small window rather than "full screen".

0

For maximum accessibility, you'd want to export the original to HTML. But that wasn't the question. If you want to take an existing PDF and make it good for screen reading, then cropping of white space is the best you can do. Cropping the width is more important than cropping the height, because when readers are scrolling through text, the height of each page is less important.

Acrobat Pro makes trimming white space easy and will let you trim the margins on ALL the pages in a single step. For screen reading it is also good to downsample images to 150dpi and save for 6 or 7 (rather than the newest Acrobat) for the benefit of readers with out-dated plug-ins an readers.

If you password protect documents, be sure to allow reading out loud.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .