1

When I compile to PDF this latex file

\documentclass[11pt]{article}

\begin{document}
\title{\footnotesize my title}
\author{me}
\maketitle

This is a test
\end{document}

The fontsize of the title changes correctly to \footnotesize. But when tex4ht ignores the fontsize change request and always shows the title in very large font. Compiled using make4ht bug.tex

Mathematica graphics

I simply wanted to make the title font smaller.

Why does tex4ht ignore font size command in the title? Is this a known issue? Is there a workaround? I tried all other sizes, \small etc.. non of them work in tex4ht like in pdf.

which tex4ht
/usr/local/texlive/2016/bin/x86_64-linux/tex4ht
2
  • The generated .css file has h2.titleHead{text-align:center;}. As you should know, changing the appearance of the title should be a job of \maketitle, not of formatting instructions in the argument to \title. It seems that tex4ht enforces this.
    – egreg
    May 18 '17 at 6:55
  • it is so completely wrong to have a size command in the argument to \title why would you expect it to be supported by default? May 18 '17 at 6:57
1

As David and Egreg said, it is not really a good idea to put formatting commands to \title. It's contents are used at two places, at place where \maketitle was used in the document, and in the <title> element.

<title> should contain only text, so it could be harmful if any formatting elements were included here. tex4ht tries to clean it, but some rubbish can end here when you use anything but text in your \title, resulting in invalid HTML. You can use \Configure{TITLE+}{alternative title} in such cases.

You have issue with other \title use, in the \maketitle. In this place, font processing is disables with \NoFonts ...EndNoFonts`. You either should use some CSS to style it according to your wishes:

 \Css{h2.titleHead{font-size:0.85em;}}

which is preferred way, or you can use alternative configuration for maketitle, which doesn't suppress the font processing:

\Preamble{xhtml}
\Configure{maketitle}{\ifvmode\IgnorePar\fi \EndP\HCode{<div class="maketitle">}}
{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}}
{\IgnorePar\HCode{<div class="title">}\IgnorePar}
{\HCode{</div>}\IgnoreIndent}

\begin{document}
\EndPreamble

This is the result:

enter image description here

As I said, I would use the CSS styling.

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.