81

Often my students want to look at my lecture notes on their phones. Obviously no one wants to do that routinely, but it is often convenient if you do not have a paper copy to hand and you just want to look up an isolated fact. I have A4 size pdfs on the web, which one can just about read on a phone, but it is quite awkward. Does anyone have a good set of options that they have tested for generating phone-readable pdfs from LaTeX?

UPDATE: In case anyone is interested, after following silex's suggestions I produced this: http://neil-strickland.staff.shef.ac.uk/courses/MAS201/MAS201_phone.pdf

4
  • 1
    With the geometry package you can set the "paper" size to be anything you want. – Matthew Leingang Oct 24 '12 at 14:52
  • 1
    Hi Neil, Welcome to TeX.sx! From my experience, this will be a combination of fonts and page geometry (I have particular settings for my iPad and those involve both - if you think it helpful I can post those); the fonts will depend a bit on what you're already using and, in particular, if you're using pdf(la)tex or one of xe(la)tex or lua(la)tex. – Andrew Stacey Oct 24 '12 at 15:05
  • 4
    As smartphone and tablets can vary quite a bit in size maybe a reflowable format might be better than pdf. TeX4HT does quite a nice job, maybe that can complement pdf documents? – Alexander Oct 24 '12 at 15:18
  • Although it would not apply to your notes, what you ask is a built-in option for the `novel' document class. I only mention this because I like to review my own writing on a handheld device, with the actual book's TeX-output layout. The trick is simple: Begin with the width and height of the printable area. Add small margins, say 3pt all around. Then calculate the dimensions of reduced paper size. Proof left to student. – user139954 Dec 12 '17 at 20:08
52

A4's are indeed quite large for normal reading. With the geometry package you can either specify the page size manually, or use a6paper which is readable on a phone. It's also a good idea to modify the margins, you don't need page numbers so they can be quite small. Another idea is to change the typeface to one more fit for screens.

Together all there options add up to this:

\documentclass[a6paper]{article}
\usepackage[margin=5mm]{geometry}
\usepackage{tgheros}
\usepackage[T1]{fontenc}
\renewcommand*\familydefault{\sfdefault}
\usepackage{lipsum} % Dummy Text
\begin{document}
\title{Lorem Ipsum}
\author{Dolor S. Amet}
\maketitle
\lipsum
\end{document}

Which looks like this on my phone (87x52mm or 2.06x3.43in):

screen

This is still small, but a lot better than a4. The eyesight of your student is probably good enough to read this with ease from any reasonable distance. Either making the paper even smaller or increasing the font size can increase the readability of your text.

3
37

Further to the answer of Silex, I would like to add that in such cases the microtype package might come in handy. For example, the following result is obtained by simply loading microtype without any options:

enter image description here

2
  • I don't have enough reputation points to comment Silex's answer. Feel free to delete this post and add it as a comment to his answer (if you find it relevant). – nnunes Oct 24 '12 at 15:35
  • 7
    No no, perfectly fine answer in my opinion (+1). – morbusg Oct 24 '12 at 15:35
22

PDF isn't really a good format for reading on mobile devices, since they have varying screen sizes and PDF has completely fixed formatting. The best solution is probably to provide an e-book in EPUB format.

EPUB is designed for reflowable content, meaning that an EPUB reader can optimize text for a particular display device.

You can generate them from LaTeX files (or a huge variety of other files) with pandoc:

$ pandoc -s source.tex -o output.epub

Pandoc is in most Linux repos, or you can get the package (for Windows, Mac or Linux) from the Pandoc website.

Then your students can read it with something like Aldiko (Android) or iBooks (iOS).

3
  • 14
    Technically, pandoc doesn't convert LaTeX files to EPUB. It can understand a very limited subset of LaTeX commands but wouldn't work on anything more complicated. – Andrew Stacey Oct 24 '12 at 22:27
  • what's the differences between an EPUB and a HTML text? – Ooker Dec 12 '17 at 11:14
  • 1
    @Ooker EPUB is basically a wrapper around HTML. The nice thing about an EPUB is that readers for it will generally keep your place for you, while HTML renderers usually don't. It depends on the length how important that is. – Brendan Long Dec 12 '17 at 19:59
16

Just tried it ...

These are the options for the geometry package that I ended up with. In effect I was varying the page size to get the right font size (since most PDF viewers will scale the page to fit the screen this is a cheap way to change font size).

  paperwidth=6cm,
  paperheight=8cm,
  width=5.5cm,
  height=7.5cm,
  left=.25cm,
  includefoot,
  foot=\baselineskip,

I find that on a small screen then I want both indentation and clear separation between paragraphs, thus:

\parskip=.8\baselineskip \advance\parskip by 0pt plus .2\baselineskip\relax

The document I'm testing on is a lualatex document so I can use the fontspec package to choose fonts. I chose a sans serif font from the TeX Gyre Package. Thus:

\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont[Ligatures=TeX]{TeX Gyre Heros}
\setmathfont{TG Pagella Math}

(Oddly, serif maths helps as the distinction between fonts makes it clearer when changing from text to maths and back again.)

A problem I run into is maths running into the margin and thus off the page. Commutative diagrams are ... unsalvageable.

Here's some sample pages.

smartphone pages

13

Uwe Ziegenhagen published a (German) blog post on this topic: LaTeX Dokumente auf dem iPod und iPhone. (You'll be able to get the relevant bits and use the code even if you don't speak German.) He offers three increasingly sophisticated templates, optimized for iPhone screens at the time of publishing (Feb 2010). The third template includes links to get to the previous or next page and looks like this:

1
4

I like writing in Markdown but would like to convert Markdown to PDF. I use Pandoc for that. So I created a Pandoc LaTeX template that uses Uwe Ziegenhagen's template from the above answer in order to be able to create mobile size PDFs.

Here is the template as a gist, and the command used with Pandoc is:

pandoc document.md -o document.tex -s --template=iphone.latex

Then the .tex file can be converted to PDF using, for example, TeXworks.

The output isn't that nice though - if anyone that knows more about LaTeX would like to change the template to make it better I'll be really happy :)

Edit (December 2012): Just a small note on the improved potential for pdf on phones, Acrobat Reader has recently been greatly enhanced for Android playstore, and apparently for iPhone as well. Acrobat Reader for Mobile.

2
  • 2
    If you're already using Markdown and Pandoc, why not convert directly to EPUB instead of PDF? – Brendan Long Oct 30 '12 at 14:49
  • 2
    Because, although I use ePUB, many people still don't know what it is. So I'd like to be able to publish both ePUB and mobile-size PDFs. – yoavram Nov 1 '12 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.