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....

  • 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. – Henri Menke Nov 14 '19 at 2:57
  • @HenriMenke Thanks for your notification, will take care in future... – MadyYuvi Nov 14 '19 at 4:50

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:

\title{Fixed layout sample}


my first page


my second page


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:

\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{@HEAD}{\HCode{<meta name="viewport" content="width=1920, height=1080"/>\Hnewline}}



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.

| improve this answer | |
  • Really interesting, will check and get back to you....Thanks a lot for your kind advise.... – MadyYuvi Oct 24 '19 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 Oct 24 '19 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 Oct 24 '19 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 Oct 24 '19 at 9:41
  • Its fine, no issues, Best wishes and eagerly waiting for the newer version... – MadyYuvi Oct 24 '19 at 9:59

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.