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....
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....
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.
LaTeX
template is not a standard one, customized by myself, Shall I send the template and application TeX files to you through mail?
make4ht
version that I should release soon.
Commented
Oct 24, 2019 at 9:41