If I try to typeset the following minimal working example with latex, no errors occur:




However if I try to typset it with either htlatex or make4ht, I get the errors

! Illegal parameter number in definition of \:temp.


You can't use `macro parameter character #' in horizontal mode.
Illegal parameter number in definition of \:temp.


What's the problem and how do I fix it?

Edit: It seems I can simply avoid this issue by using latexml (which seems more robust and up-to-date and produces better output), however I would still like to know what's causing the error here and how to make htlatex and make4ht work.

1 Answer 1


I will take care of this issue in TeX4ht sources. In the meantime, you can use the following configuration file (using trick from David's answer):


The \Configure{TITLE+} command sets contents of the <title> tag, so you can use it every time you have something in your title that fails.

This is the result:

<!DOCTYPE html> 
<html lang='en-US' xml:lang='en-US'> 
<head> <title>#</title> 
<meta charset='utf-8' /> 
<meta content='TeX4ht (https://tug.org/tex4ht/)' name='generator' /> 
<meta content='width=device-width,initial-scale=1' name='viewport' /> 
<link href='sample.css' rel='stylesheet' type='text/css' /> 
<meta content='sample.tex' name='src' /> 
   <div class='maketitle'>

<h2 class='titleHead'>#</h2>
<div class='author'></div><br />
<div class='date'><span class='cmr-12'>March 29, 2022</span></div>
  • So it's a bug after all. If you fix it, I'd be interested to hear what caused this issue. Commented Mar 30, 2022 at 11:13
  • 1
    The bug was caused by the fact that the # character was written to an auxiliary file, which is loaded at the beginning of the document. It causes the compilation error. With the patch, \# is written instead, so it works when aux file is loaded.
    – michal.h21
    Commented Mar 30, 2022 at 11:40

You must log in to answer this question.

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