3

MWE

\documentclass[]{article}
\usepackage{cprotect}
\begin{document}
\cprotect\fbox
{
\begin{minipage}[t]{\textwidth}
 This is a test 
\end{minipage}
}
\end{document}

compiled with htlatex foo.tex generates this html

Mathematica graphics

The HTML is

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
  "http://www.w3.org/TR/html4/loose.dtd">  
<html > 
<head><title></title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)"> 
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)"> 
<!-- html --> 
<meta name="src" content="foo.tex"> 
<meta name="date" content="2015-03-10 14:04:00"> 
<link rel="stylesheet" type="text/css" href="foo.css"> 
</head><body 
>
   <div class="fbox"><div class="minipage">This is a test</div> &#x02C6;&#x02C6;E&#x02C6;&#x02C6;L</div>

</body></html> 

file list

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
  tex4ht.sty    
cprotect.sty    2011/01/27 v1.0e (Bruno Le Floch)
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
  suffix.sty    2006/07/15 1.5a Variant command support
 ***********

texlive 2014 on Linux. I will also post this to tex4ht mailing list. This looks like a bug. Just posting here for reference or if anyone has an easy workaround. (there is no tag for the cprotect package)

)

4

From cprotext documentation:

Will break if ^ does not have its usual catcode at the beginning and at the end of the \cprotected command. Also, will break if ^^E or ^^L change catcodes. This choice of symbols can be changed by setting the options gobbling-escape = hletter i, and gobbling-letter = hletter i. The defaults are gobbling-escape = E and gobbling-letter = L.

it is well known issue that ^ character has changed catcode with tex4ht, so we have to set it temporarily to the normal value. we may create environment, which will have correct catcodes inside, so you can place problematic code here

\newenvironment{normalcatcodes}{\catcode`\^=7\catcode`\_=8}{}

and full example:

\documentclass[]{article}
\usepackage{cprotect}
\newenvironment{normalcatcodes}{\catcode`\^=7\catcode`\_=8}{}
\begin{document}
\begin{normalcatcodes}
\cprotect\fbox
{
\begin{minipage}[t]{\textwidth}
 This is a test 
\end{minipage}
}
\end{normalcatcodes}
\end{document}

the result is correct now:

enter image description here

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.