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

\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}
------------

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:

reference:
http://tex.stackexchange.com/questions/232395/why-tex4ht-generate-funny-looking-extra-characters-when-using-usepackagecprote

this 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 HTML with extra characters not in the latex file. The HTML generated 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 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)
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
***********

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