2

For this problem, I am using the following MnWE:

\documentclass[fontsize=18pt, paper=letter]{scrartcl}

\usepackage{lmodern}
\usepackage[T1]{fontenc}

\usepackage{amsmath}

\begin{document}

\title{A test \LaTeX to HTML page}

\maketitle


\section{Section One}

Hello world. Here is some mathematics:
    \begin{equation}
        x + y = 3
    \end{equation}

\end{document}

My build script is:

local filter = require "make4ht-filter"
local process = filter{"cleanspan", "fixligatures", "hruletohr"}
if mode == "draft" then
  Make:htlatex()
else
  Make:htlatex()
  Make:htlatex()
  Make:htlatex()
end
Make:image("png$", "dvipng -bg Transparent -T tight -o ${output}  -pp ${page} ${source}")
Make:match("html$",process)
Make:match("html$", "tidy -m -xml -utf8 -q -i ${filename}")

My style config file is:

\Preamble{xhtml}
\Css{body{font-size:1.5em;}}
\begin{document}
\EndPreamble

Here is the HTML result:

enter image description here

Why is the date gigantic compared to the rest?

1

You enlarged base font size in your document with \Css{body{font-size:1.5em;}}, which is fine, but as other font sizes are based on this base size, sometimes it might go really large. In this case you must find suitable CSS selector and declare smaller font size for it in the .cfg file.

The \maketitle command creates following HTML:

<div class="maketitle">
      <h2 class="titleHead">A test 
      <span class="LATEX">L
      <span class="A">A</span>
      <span class="TEX">T
      <span class="E">E</span>X</span></span>to HTML page</h2>
      <br />
      <div class="date">
        <span class="ec-lmr-17x-x-150">January 13, 2016</span>
      </div>
    </div>

In the CSS file, we can find this declaration:

.ec-lmr-17x-x-150{font-size:255%;}

which means that font size in title is 2.5x larger than the default size. We could redefine ec-lmr-17x-x-150 class to use smaller size, but more elegant is to define smaller font size for the date class, in order to keep the date smaller even if you change font in the document. Something like this .cfg:

\Preamble{xhtml} 
\Css{body{font-size:1.5em;}} 
\Css{div.date, div.author{font-size:0.4em;}}
\begin{document} 
\EndPreamble

enter image description here

  • michal: thank you so much for your wonderful tool, and your helpful attitude! – user89 Jan 13 '16 at 20:34
  • michal: I am wondering, why is it that in the output CSS file, as you noted, we have something like .ec-lmr-17x-x-150{font-size:255%;} happening? Why is the 255% there in the first place? I am wondering because I am having this issue crop up for more stuff (e.g. theorem labels, or text in \emph). For all of them, is my best bet to simply go around correcting the size of stuff as you have shown me in this question? – user89 Jan 15 '16 at 17:57
  • @user89 they are added by tex4ht in dvi to html transformation, it is based on actual fonts used in the document. – michal.h21 Jan 15 '16 at 18:10
  • So then why is it that the font size looks normal in the document (if I output to pdf), but not in the output html? Is it because of \Css{body{font-size:1.5em;}} in my style config? – user89 Jan 15 '16 at 18:13
  • @user89 yes, it sets new base font size from which all other relative sizes are derived – michal.h21 Jan 15 '16 at 18:17

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.