2

I have a simple *.tex file for this question:

\documentclass[12pt,letterpaper]{article}

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

\usepackage{amsmath}

\begin{document}

\title{A test \LaTeX to HTML page}

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

\end{document}

Now, when I increase font size in the \documentclass command from 12pt to 16pt, I don't see a corresponding increase in font size in the output HTML.

Why is that?

Here is my build file:

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}")
1
  • 1
    the article class doesn't have any font options larger than 12pt, so that's not going to get you where you want to go. you can try inserting \Huge at the beginning (after \begin{document}). that will enlarge the text, but not titles or section headings, in the tex output. i don't know whether it will carry over to the html. Commented Jan 8, 2016 at 22:24

1 Answer 1

3

Your example doesn't work even in pdf mode, standard article class doesn't support 16pt option. You can use scrartcl but it will probably change appearance of your document. Anyway, here is a modified example:

\documentclass[fontsize=16pt, paper=letter]{scrartcl}
\usepackage{lmodern}
\usepackage[T1]{fontenc}

\usepackage{amsmath}

\begin{document}

\title{A test \LaTeX to HTML page}

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

\end{document}

this works in pdf mode, but tex4ht uses fixed CSS template by default, so the changed font size isn't used in the html. You can use custom config file and configure the font size through css:

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

Note that it is better to use em dimensions in css instead of `pt. You can use the config file:

make4ht -c config.cfg filename.tex

the result:

enter image description here

3
  • This worked perfectly! However, I found that the math was not well-sized as in your example. What might the difference in our cases be?
    – bzm3r
    Commented Jan 9, 2016 at 3:21
  • Figured out the difference! I was not using \documentclass[fontsize=16pt, paper=letter]{scrartcl} (I figured I didn't need it because I didn't want pdf only change). However, it is good to have it because it makes the math bigger too.
    – bzm3r
    Commented Jan 9, 2016 at 3:30
  • @user89 yes, math has size depending on the original document size, so resizing is needed. You can also add -D <resolution> as dvipng parameter, if you don't want to modify the document
    – michal.h21
    Commented Jan 9, 2016 at 7:33

You must log in to answer this question.

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