Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > PDF

Notices

Reply
 
Thread Tools Search this Thread
Old 12-05-2016, 09:54 AM   #1
pluma
Enthusiast
pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.
 
Posts: 48
Karma: 854254
Join Date: Nov 2016
Device: none
LATEX>PDF>EPUB and KICKASS TOC

Hallo alle,

I would like to have a pdf in the device library listed with title and whatever additional info is possible rather than its filename. Is this possible?

My second question is bit more trickier, is it possible to make an ereader optimized TOC for pdf and how to do this in latex?

And my third question is that I would like to have a the PDF dimensions according to my device which I got from another of my posts:

https://www.mobileread.com/forums/sho...d.php?t=281284

Approx:

"118 x 157mm"

"Going by the screen resolution (1404x1872) and ppi (300), the screen should be 4.68" or 118.872mm by 6.24" or 158.496mm."

How to do this in latex?

Lastly, what some general guidelines to follow when using latex for ereader pdf? If you have some snippets plz share!!

thansk

Last edited by pluma; 12-10-2016 at 08:50 AM. Reason: change title.
pluma is offline   Reply With Quote
Old 12-05-2016, 06:09 PM   #2
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 2,977
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
Here's what the latex preamble looks like for my PDFs:

Code:
\documentclass[11pt,a5paper,openany,oneside]{book}
\usepackage[a5paper]{geometry}
\usepackage[pdftex,pdftitle={The Title Goes Here},pdfauthor={Last_name, First_name}]{hyperref}
\usepackage[pdftex]{color,graphicx}
\usepackage{mathpazo}

\textwidth 128mm
\topmargin -15mm
\textheight 175mm
\evensidemargin -15mm
\oddsidemargin -15mm
Here's the script I use to convert the latex to HTML (using latex2html):

Code:
#!/bin/sh
# Pass in the name of the top-level TeX file, or "main.tex"
# will be assumed.

if test $# -eq 0
  then
    SOURCE=main.tex
  else
    SOURCE="$1"
fi

latex2html -nonavigation -nobottom_navigation -noaddress -noinfo -math -math_parsing -accent_images 'large' "$SOURCE"

cd `basename "$SOURCE" .tex`
fontresize.sh
The fontresize.sh script looks like this:

Code:
#!/bin/sh
for i in *.html
do
        sed -e 's/+2/+0/' < $i > j.j
        mv j.j $i
done
After that is done, I import the HTML files to the Sigil program to create the EPUB. This step is a bit tedious, so maybe there's a better way to do it (perhaps with calibre?).
rkomar is offline   Reply With Quote
Advert
Old 12-06-2016, 04:14 PM   #3
ratinox
Fanatic
ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.
 
Posts: 515
Karma: 5016672
Join Date: Oct 2016
Device: Forma, iPad Air 4
The TeX Users Group published a formal(ish) workflow for converting LaTeX documents to ePub. It's similar to rkomar's workflow: convert TeX/LaTeX to XML via TeX4ht and then convert that to ePub.

I've had good results converting HTML to ePub with Calibre's ebook-convert:
Code:
ebook-convert in.foo out.epub --remove-paragraph-spacing --max-toc-links=999 \
  --flow-size=9999 --output-profile=tablet --title="Foo"
Season to taste. I use the tablet output profile because I have large-ish readers (Kindle DX, Aura One).
ratinox is online now   Reply With Quote
Old 12-07-2016, 12:57 PM   #4
dickloraine
Guru
dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.
 
Posts: 631
Karma: 7544080
Join Date: Apr 2013
Location: Berlin
Device: PRS 350, Kobo Aura
You need to look at the geometry package. It allows you to set arbitrary page sizes.
For conversion another software worth a look is pandoc. It can convert latex to pdf and to epub. It should convert most formats to pdf through using latex in the background too.
dickloraine is offline   Reply With Quote
Old 12-10-2016, 08:47 AM   #5
pluma
Enthusiast
pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.
 
Posts: 48
Karma: 854254
Join Date: Nov 2016
Device: none
KICKASS TOC??

hallo,

thanks for all the replies.

I found out that "PALATINO" font in latex is called "TeX Gyre Pagella". Important detail to know in order to have it working.

Where I am having troubles now is with the navigable TOC for pdf. None of the \chapters are being shown in the TOC, in other words my TOC only has this:

Code:
Contents

How is people using the \chapter to create a proper Ereader compatible TOC?

Also I am confused about \section, it trips up with an error about needing \item.

When making pdf TOC should I use \chapter and \section?

Lastly there's something called 'bookmarks' which require some other syntax in latex. Are bookmarks useful in a Ereader device??

danke.

Last edited by pluma; 12-10-2016 at 08:48 AM. Reason: incorrect tags
pluma is offline   Reply With Quote
Advert
Old 12-10-2016, 10:52 PM   #6
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by pluma View Post
Where I am having troubles now is with the navigable TOC for pdf. None of the \chapters are being shown in the TOC, in other words my TOC only has this:

Code:
Contents
Did you compile your document twice?

Sometimes when complicated things are being done (Bookmarks, Cross-references, TOCs, Indexes, [...]) you have to compile the document multiple times. The first compile sets up the temporary files, then the second/third time reimplements that info into the final PDF.

Quote:
Originally Posted by pluma View Post
Also I am confused about \section, it trips up with an error about needing \item.
That is not normal. You are going to have to show the LaTeX code itself. You probably forgot to close a bracket somewhere along the line, or forgot to \end a list.

Quote:
Originally Posted by pluma View Post
I found out that "PALATINO" font in latex is called "TeX Gyre Pagella". Important detail to know in order to have it working.
A lot of the fonts in LaTeX packages are clones of more popular paid fonts, but released under a GPL license (or other Open Source licenses).

It is helpful when you need to use an (almost) dropin replacement:

Helvetica ~= TeX Gyre Heros = \usepackage{helvet}
Times New Roman ~= TeX Gyre Termes = \usepackage{mathptmx}
Palatino ~= TeX Gyre Pagella = \usepackage{mathpazo}
[...]

To the normal human (and for most projects), they are equivalent, but some extremely minor things might be different:
  • More accented characters
  • Maths support
  • Teeny weeny kerning differences
    • Maybe throughout an entire 500+ page book, a handful of words become hyphenated differently, and a few words might be pulled to a later/earlier line.
  • Slightly different shapes
  • [...]

If you wanted to use specific fonts directly in LaTeX, you would have to use the fontspec package:

Code:
\usepackage{fontspec}
\setmainfont{Times New Roman}
Quote:
Originally Posted by pluma View Post
When making pdf TOC should I use \chapter and \section?
Yes, it is just like using <h1> through <h6> in your HTML documents:

<h1> ~= \part{}
<h2> ~= \chapter{}
<h3> ~= \section{}
<h4> ~= \subsection{}
<h5> ~= \subsubsection{}
<h6> ~= \paragraph{}

Quote:
Originally Posted by pluma View Post
Lastly there's something called 'bookmarks' which require some other syntax in latex.
Yep, typically people implement PDF Bookmarks by using the bookmark or hyperref package.

If you included hyperref in your preamble and used all of the \part + \chapter + \section correctly, it should just work.

Quote:
Originally Posted by pluma View Post
Are bookmarks useful in a Ereader device??
If the PDF Reader supports PDF Bookmarks, then sure... if they don't, then it won't help.

PDFs are pretty crappy to read on dedicated ereaders. It is typically very slow to turn pages, clunky, doesn't allow you to change fonts + font sizes, you have to pinch/zoom, searching/highlighting is crap, etc. etc.

On the tablet/smartphone end, the PDF Reader selection is better, but personally, I wouldn't read PDFs on my phone (although many others do). If I had the choice, I would always go with EPUB/MOBI instead.

If you are creating a "Mobile-Friendly" version of the PDF, me + RbnJrg figured out that a paper size of 5.5"x8.5" with small margins + 12pt font is still very readable on very small devices (smartphone) to very large (PC monitor). The amount of text you can shove per page can be roughly equivalent to your typical 7"x10" book.

Here is a comparison between a 5.5"x8.5" (tiny margins, "Mobile-Friendly") + 6"x9" + 7"x10":

Click image for larger version

Name:	5.5x8.5.Example.png
Views:	461
Size:	178.7 KB
ID:	153488 Click image for larger version

Name:	6x9.Example.png
Views:	467
Size:	143.8 KB
ID:	153489 Click image for larger version

Name:	7x10.Example.png
Views:	471
Size:	186.2 KB
ID:	153490

Or here is a comparison of a two-page spread of the 5.5"x8.5" + 7"x10":

Click image for larger version

Name:	5.5x8.5.TwoPage.Example.png
Views:	459
Size:	202.8 KB
ID:	153491 Click image for larger version

Name:	7x10.TwoPage.Example.png
Views:	492
Size:	169.6 KB
ID:	153492

Of course you can tweak any of the variables... but I still think it would be an inferior experience compared to a proper EPUB.

Side Note: Jellby used LaTeX to create a "Mobile-Friendly" 9cm x 12cm "Alice's Adventures in Wonderland":

https://www.mobileread.com/forums/showthread.php?t=21584

You can download that PDF and check it out. Absolutely fantastic work he did on that one. :P

Last edited by Tex2002ans; 12-10-2016 at 11:55 PM.
Tex2002ans is offline   Reply With Quote
Old 12-20-2016, 03:25 PM   #7
pluma
Enthusiast
pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.pluma ought to be getting tired of karma fortunes by now.
 
Posts: 48
Karma: 854254
Join Date: Nov 2016
Device: none
danke alle,

I got it working, I would like to point out the solution between latex options and ereaders.

Because /documentclass{book} doesn't allow custom documen sizes when using 'extarticle' or some other /chapter will be DISABLED.

I realized after changing all /chapter to /section and magically my TOC was rendered.

peace
pluma is offline   Reply With Quote
Old 12-20-2016, 04:20 PM   #8
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 2,977
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
Yes, chapters don't work in articles. Do you absolutely need to have a custom geometry? Your given dimensions are pretty close to A6 paper size. You could try using the "a6paper" geometry and see if it fits your needs. That way, you could use the "book" documentclass and keep the chapters.
rkomar is offline   Reply With Quote
Old 12-20-2016, 08:08 PM   #9
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by pluma View Post
Because /documentclass{book} doesn't allow custom documen sizes when using 'extarticle' or some other /chapter will be DISABLED.

I realized after changing all /chapter to /section and magically my TOC was rendered.
Definitely sounds like there is an underlying problem that rkomar caught. extarticle is really for extending the article class. This class is good if you are typing up a school/scientific paper.

What you want is to work from book class as a base.

If you are working on creating a book, these are the three popular LaTeX classes that are used:
  • book
    • This just gives you all the basic functionality for making a book (Parts/Chapters, TOCs, Title Page, Appendices, Indexes, etc. etc.).
    • If you want to do more advanced things you will have to read up and learn how to tweak individual components and/or include more packages. For example, enumitem might help you easily create more complicated lists.
  • KOMA-Script
    • This introduces a lot of easily configurable tweaks (use whatever font sizes, look of footnotes/headers/footers, [...]) + bundles more typical bookmaking functionality (side notes, [...]).
    • Documentation: https://www.ctan.org/pkg/koma-script?lang=en
    • Note: The German documentation is supposedly exceptional. I don't read German though, so I have to settle on the English documentation/discussion. I haven't had any problems figuring things out, and have used this in most of my book projects.
  • memoir

You could read more detailed comparisons here:

https://tex.stackexchange.com/questi...ipt-and-memoir

Last edited by Tex2002ans; 12-20-2016 at 08:13 PM.
Tex2002ans is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
LaTeX, vector graphics, PDF, and EPUB Frotz Writers' Corner 7 02-24-2013 05:59 PM
EPUB, MOBI, PDF... LaTeX! Katsunami Workshop 8 02-07-2012 02:28 PM
Créer des epub à partir d'une syntaxe wiki (chaîne d'édition vers PDF (LaTeX), xHTML farvardin Software 1 04-03-2011 12:49 PM
505 TOC from PDF to EPUB/LRF wayamauro Sony Reader 18 09-27-2009 04:21 AM
Chaîne complète d'édition : HTML, LaTeX, PDF, EPUB à venir. Randy11 Software 2 04-05-2009 11:42 AM


All times are GMT -4. The time now is 01:29 PM.


MobileRead.com is a privately owned, operated and funded community.