1

Tex4ebook seems to ignore the \setsecheadstyle command with the memoir class.

MWE:

\documentclass[ebook,12pt,oneside,openany]{memoir}

\usepackage{lipsum}

\setsecheadstyle{\normalsize\itshape\raggedright}

\title{Book}
\author{Author}
\date{}

\begin{document}

\maketitle

\frontmatter

\tableofcontents \newpage

\mainmatter

\chapter{C1}

\section{S1}

\lipsum[1]

\end{document}

Running normal Latex gives an italic section heading:

Latex output

Running tex4ebook gives the default bold section heading:

Tex4ebook output

Is there any way to fix this?

Thank you.

2

You need to specify the section format using custom CSS rule. First of all, you need to find the element which needs to configure in the HTML file:

<h3 class="sectionHead"><span class="titlemark">1.1   </span> <a 
 id="x1-30001.1"></a>S1</h3>

In this case, we need to configure h3 element with sectionHead class. We can then use the following CSS in the .cfg file:

\Preamble{xhtml}
\Css{h3.sectionHead{font-style:italic;font-weight:normal;}}
\begin{document}

\EndPreamble

The result:

enter image description here

  • Thanks for the solution. I am still confused about when you have to add custom css code to the config file. Are there any guidelines for this or is it trial and error? Thanks again. – user41974 Feb 11 '17 at 3:38
  • @user41974 tex4ht tries to preserve the document structure mainly. The styling is done by some default CSS styles, so if you want to change appearance of something, you usually need to figure out how it is encoded in the HTML file and provide your custom CSS. – michal.h21 Feb 11 '17 at 17:57

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.