3

Is this possible to do FixedLayout from LaTeX to HTML/EPUB conversion? If the answer is yes, please advise how to do...

Thanks to all....

2
  • 1
    Please use existing tags instead of inventing new ones. If you think that a new tag is absolutely necessary, please also write a tag wiki for it. Commented Nov 14, 2019 at 2:57
  • @HenriMenke Thanks for your notification, will take care in future...
    – MadyYuvi
    Commented Nov 14, 2019 at 4:50

1 Answer 1

3

In general, I think not much changed in what I said in my previous answer on this matter. But, just for the fun I've tried to add support for the fixed layout to Tex4ebook. I've found that for the basic support, you just need to set few metadata properties in the ePub file. It is also necessary to create separate file for each page. The content of the page should fit here, so you shouldn't put much stuff on the individual pages.

Here is a sample TeX file:

\documentclass{article}
\title{Fixed layout sample}
\author{Michal}
\begin{document}
\maketitle
\tableofcontents

\section{hello}

my first page

\section{world}

my second page

\end{document}

The \section command requires creation of a new HTML file in TeX4ebook, so the sample uses this fact to create individual pages. Four pages for title, table of contents and the two sections will be created in this sample.

A configuration file that sets the necessary metadata may look like this:

\Preamble{xhtml}
\Configure{UniqueIdentifier}{https://kodymirus.cz/fixed-layout-sample}
\Configure{OpfMetadata}{\HCode{<meta property="rendition:layout">pre-paginated</meta>}}
\Configure{OpfMetadata}{\HCode{<meta property="rendition:orientation">landscape</meta>}}
\Configure{OpfMetadata}{\HCode{<meta property="rendition:spread">none</meta>}}
\Configure{AddCss}{fixedlayout.css}
\Configure{@HEAD}{\HCode{<meta name="viewport" content="width=1920, height=1080"/>\Hnewline}}

\begin{document}

\EndPreamble

The UniqueIdentifier and OpfMetadata configurations are used to add the metadata to the ePub file. The necessary values for the fixed layout can be found in the ePub documentation, on in a more human friendly article.

In particular the <meta property="rendition:layout">pre-paginated</meta> requires the fixed layout, <meta property="rendition:orientation">landscape</meta> requires the landscape orientation and <meta property="rendition:spread">none</meta> tells the reader to display only one page at the time.

The \Configure{AddCss}{...} configuration can be used to require a CSS file, which you can provide. You will probably need a complex CSS file with media queries for the fixed layout file. If you don't want to provide a CSS file, you can remove this line.

The \Configure{@HEAD}{\HCode{<meta name="viewport" content="width=1920, height=1080"/>\Hnewline}} configurations sets the page dimensions in each HTML file. Change the values according your liking.

The command

tex4ebook -f epub3 -c config.cfg sample.tex

should produce a fixed layout ePub file. It is valid according to Epubcheck, but I was a bit disappointed when I tried it in various ePub reader apps. Calibre can render it, but it seems to ignore the fixed layout. Moon reader inserts page break between section numbers and titles and ignores fixed layout. Only Google Play Books and Gitden Reader could display it properly.

5
  • Really interesting, will check and get back to you....Thanks a lot for your kind advise....
    – MadyYuvi
    Commented Oct 24, 2019 at 4:49
  • 1
    @MadyYuvi it is really a starting point. It will need lot of configurations to be really usable. Depending on a document type you want to convert.
    – michal.h21
    Commented Oct 24, 2019 at 6:21
  • @michah.h21 Used LaTeX template is not a standard one, customized by myself, Shall I send the template and application TeX files to you through mail?
    – MadyYuvi
    Commented Oct 24, 2019 at 8:24
  • @MadyYuvi sure. I am not sure when I will have a moment to look at this issue though. I am busy with a new make4ht version that I should release soon.
    – michal.h21
    Commented Oct 24, 2019 at 9:41
  • Its fine, no issues, Best wishes and eagerly waiting for the newer version...
    – MadyYuvi
    Commented Oct 24, 2019 at 9:59

You must log in to answer this question.

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