LaTeX options for kindle?

Here's a plan:

Create a kindle-friendly preamble (or a document class)

  • Redefine your page geometry to match your screen ratio (geometry package)
  • Remove most of the margins (also with geometry)
  • Remove or resize headers and footers (perhaps with fancyhdr)
  • Enlarge text until it is readable to you (depends on which TeX friend you are using)
  • Choose appropriate (legible) fonts (depends on which TeX friend you are using)
  • Redefine you section titles to smaller spacing (titlesec package)
  • Reduce other spacing as well (various lenghts like \abovecaptionskip)

Don't use absolute sizes in your documents:

  • Rescale your figures to fit factor\textwidth
  • Mathematics should automatically break at the end of the line (breqn package might help)

If you didn't create a document class:

  • Extract your document content (textbody) to a content-file
  • \include{content-file} after the \begin{document}

If you created a document class, you will just have to change your class before compiling.

Possible result

Kindle pdf result

The figure is the result of the following code:

\documentclass[10pt]{article}

\usepackage{fontspec}      % font selection
\setmainfont{Cambria}
\usepackage{breqn}         % automatic equation breaking
\usepackage{microtype}     % microtypography, reduces hyphenation
\usepackage{polyglossia}   % language selection
\setmainlanguage{english}

\usepackage{graphicx}      % graphics support

\usepackage[font=small,labelformat=simple,]{caption}   % customizing captions

\usepackage{titlesec}      % customizing section titles
\titleformat{\section}{\itshape\large}{}{0em}{}
\titlespacing{\section}{0pt}{8pt}{4pt}
\titleformat{\subsection}{\itshape}{}{0em}{}
\titlespacing{\subsection}{0pt}{4pt}{2pt}
\titleformat{\subsubsection}[runin]{\bf\scshape}{}{0em}{}
\titlespacing{\subsubsection}{0pt}{5pt}{5pt}

\usepackage[papersize={3.6in,4.8in},hmargin=0.1in,vmargin={0.1in,0.1in}]{geometry}  % page geometry

\usepackage{fancyhdr}   % headers and footers
\pagestyle{fancy}
\fancyhead{}            % clear page header
\fancyfoot{}            % clear page footer

\setlength{\abovecaptionskip}{2pt} % space above captions 
\setlength{\belowcaptionskip}{0pt} % space below captions
\setlength{\textfloatsep}{2pt}     % space between last top float or first bottom float and the text
\setlength{\floatsep}{2pt}         % space left between floats
\setlength{\intextsep}{2pt}        % space left on top and bottom of an in-text float

\begin{document}

In another moment down went Alice after it, never once considering how in the world she was to get out again.

\section{Wonderful section title}

Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look 
\begin{figure}[htb]
\includegraphics[width=\textwidth]{alice}
\caption{Quite wide picture, resized to fit}
\end{figure}
about her and to wonder what was going to happen next.

\subsection{Tufte-style subsection}

then she looked at the sides of the well

\subsubsection{Saving space running in} and noticed that they were filled with cupboards and book\-shel\-ves. 

\begin{dmath}[label={sna74}]
\frac{1}{6} \left(\sigma(k,h,0) +\frac{3(h-1)}{h}\right)
+\frac{1}{6} \left(\sigma(h,k,0) +\frac{3(k-1)}{k}\right)
=\frac{1}{6} \left(\frac{h}{k} +\frac{k}{h} +\frac{1}{hk}\right)
+\frac{1}{2} -\frac{1}{2h} -\frac{1}{2k},
\end{dmath}

\end{document}

Different font sizes can be easily selected using fontspec.


While ipavlic's answer works more than fine, what is below does not require fontspec and breqn and is somewhat more minimalistic. Based on this thread, with a few tweaks that improve it's working with formulas (in my opinion). Very long formulas still partly disappear, and it does not work with tables. Figures are fine though, as long as they are included using relative width as in ipavlic's answer.

\documentclass[12pt]{article}  
\usepackage[papersize={108mm,144mm},margin=2mm]{geometry}  
\sloppy 
\pagestyle{empty} 
\usepackage[scaled]{helvet}
\renewcommand{\familydefault}{\sfdefault}

I created some files for my Sony ebook reader. My final solution was to actually create ebooks from these papers. While it is possible from PDF - equations typically didn't survive this process.

The solution with best results for me was to create the document as HTML (can be done with latex2html) with the equations and figures as PNG files. This converts nicely.

As converter from HTML to ebook I used calibre.

Both utilities have a command line interface and could be put in your makefile.

Thinking about the kindle - maybe it is also possible to upload the HTML directly. Also I'm not sure - maybe it also supports MathML - which might lead to even nicer looking equations.

Tags:

Pdf

Kindle

Ebook