This MWE

\documentclass[11pt]{article}
\usepackage{ifluatex}
\ifluatex
  \IfFileExists{luatex85.sty}{\usepackage{luatex85}}{}
  \ifdefined\HCode
  \usepackage[utf8]{luainputenc}
  \usepackage[T1]{fontenc}
  \else
  \usepackage{fontspec}
  \fi
\else%assume pdflatex, I only use these two 
  \usepackage[utf8]{inputenc}
  \usepackage[T1]{fontenc}
\fi 

\begin{document}        
\ifluatex
  compiled with lualatex
\else
  compiled with pdflatex
\fi 

{\tiny \verb|IllustratingTheUseOfDiscreteDistributions|}

{\tiny IllustratingTheUseOfDiscreteDistributions}    
\end{document}

When compiled with pdflatex or lualatex gives

Mathematica graphics

but when compiled with tex4ht either in lua mode or not, gives this HTML

 make4ht t.tex

Mathematica graphics

How can one tell tex4ht to change the font size of \verb just like with pdflatex?

Using TL 2016


Update. Found the problem. It is this \usepackage[T1]{fontenc} when it is included then make4ht do not change the font size of \verb. This now works

\documentclass[11pt]{article}
\usepackage{ifluatex}
\ifluatex
  \IfFileExists{luatex85.sty}{\usepackage{luatex85}}{}
  \ifdefined\HCode
    \usepackage[utf8]{luainputenc}
  \else
    \usepackage{fontspec}
  \fi
\else%assume pdflatex, I only use these two 
   \usepackage[utf8]{inputenc}
\fi 

\begin{document}        
\ifluatex
  compiled with lualatex
\else
  compiled with pdflatex
\fi 

{\tiny \verb|IllustratingTheUseOfDiscreteDistributions|}

{\tiny IllustratingTheUseOfDiscreteDistributions}    
\end{document}

Now make4ht t.tex gives

Mathematica graphics

  • why do you always use \IfFileExists{luatex85.sty}{\usepackage{luatex85}}{} but not, for example \IfFileExists{ifluatex.sty}{\usepackage{ifluatex}}{} ? It doesn't matter, just looks a bit odd. – David Carlisle Jul 6 '16 at 10:24
  • @DavidCarlisle because luatex85.sty only exist in TL 2016 and not TL2015. Since I still sometimes compile on TL 2015 to test, I needed this so not to get errors. ifluatex.sty package is in TL2015 and TL2016 since not need to check for it. MWE>kpsewhich ifluatex.sty /usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/ifluatex.sty MWE>kpsewhich luatex85.sty MWE> – Nasser Jul 6 '16 at 10:27
up vote 3 down vote accepted

It seems like an error in how tex4ht detects font sizes and converts them to css declarations. It is done by tex4ht command, so I don't really know and don't understand how it works, but the following test seems interesting:

{\ttfamily\tiny IllustratingTheUseOfDiscreteDistributions \itshape ojoj}            

{\ttfamily\footnotesize IllustratingTheUseOfDiscreteDistributions \itshape ojoj}

{\ttfamily\small IllustratingTheUseOfDiscreteDistributions \itshape ojoj}                     

{\ttfamily IllustratingTheUseOfDiscreteDistributions \itshape ojoj}

{\ttfamily\large IllustratingTheUseOfDiscreteDistributions \itshape ojoj}

{\ttfamily\Large IllustratingTheUseOfDiscreteDistributions \itshape ojoj}

With your original base font size (11pt):

enter image description here

With 10pt base font size:

enter image description here

And with 12pt:

enter image description here

As you can see, on each picture, there is at least one font size, which is converted incorrectly, but only at 11pt base font size there is an error with \tiny font size. This is certainly a bug.

As a fix, I would use custom CSS, after inspecting the HTML file, I found that monospaced tiny is converted as <span class="ectt-0800x-x-75"> so I would just use something like:

\Css{.ectt-0800x-x-75{font-size:65\%;}}

in the .cfg file

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.