bugtex4ht - Bugs: bug #246, \usepackage{cprotect} generate...

Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #246: \usepackage{cprotect} generate extra strange letters not in text in HTML

Submitted by:  Nasser M. Abbasi <nma123>
Submitted on:  Tue Mar 10 19:57:05 2015  
Category: NonePriority: 5 - Normal
Severity: 3 - MinorStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Closed

Wed Oct 18 20:40:23 2023, comment #2:

I know this is super old, but I've found a fix for the Cprotect package and pushed them to the source. We just need to define the \CPT@hat@hat@E@hat@hat@L command with correct catcodes.

Michal Hoftich <michal_h21>
Project Member
Tue Mar 10 21:47:08 2015, comment #1:

I will repost a workaround from TeX.sx:

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


and full example:

This is a test

so this is another example of problems caused by redefined catcodes of `^` and `_`. incidentally, I've found another one today: http://tex.stackexchange.com/a/232373/2891

Michal Hoftich <michal_h21>
Project Member
Tue Mar 10 19:57:05 2015, original submission:


this MWE

This is a test

compiled with htlatex foo.tex generates HTML with extra characters not in the latex file. The HTML generated is

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<html >
<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">


<div class="fbox"><div class="minipage">This is a test</div> &#x02C6;&#x02C6;E&#x02C6;&#x02C6;L</div>


File list is

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)
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

Screen image is in the above post.

texlive 2014

Nasser M. Abbasi <nma123>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by michal_h21 (Posted a comment)
  • -unavailable- added by nma123 (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    1 latest change follows.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Oct 19 14:29:51 2023michal_h21Open/ClosedOpen=>Closed
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup+gray