bugtex4ht - Bugs: bug #516, Double counters for mdframed

 
 
Show feedback again

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

bug #516: Double counters for mdframed

Submitted by:  Nikolaus Correll <correll>
Submitted on:  Sun Aug 1 19:48:17 2021  
 
Category: NonePriority: 5 - Normal
Severity: 5 - NormalStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Closed

Tue Aug 3 18:09:18 2021, comment #1:

The problem is that we need to put the title earlier than Mdframed does that. There is a bug in TeX4ht config file for Mdframed that causes double title in the HTML file. Try the attached mdframed.4ht file. Another issue is that the counter is updated after TeX4ht puts the title, so you will get incorrect frame number even with the fixed mdframed.4ht file. It needs to be fixed in your TeX file. The updated file is also attached.

(file #427, file #428)

Michal Hoftich <michal_h21>
Project Member
Sun Aug 1 19:48:17 2021, original submission:

Hi,

I'm trying to use the mdframed package with tex4htmtl to create numbered "Example" boxes. The result is as expected with PDFLatex, but the resulting HTML code shows the counter twice as so:

<div class='mdframed' id='mdframed-1'>
<!-- l. 37 --><p class='noindent'><span class='cmbx-10x-x-109'>Example 0.0.0 ”test”</span><a id='x1-2r1'></a>
</p><!-- l. 38 --><p class='noindent'>This is a test.
</p><!-- l. 39 --><p class='noindent'><span class='cmbx-10x-x-109'>Example 0.0.1</span></p>
</div>

Here, the second <span> at the end is undesired and unnecessarily increases the counter ("Example 0.0.1"). The Latex code below reproduces the result:

\documentclass[paper=6.14in:9.21in,pagesize=pdftex,11pt,twoside,openright]{scrbook}

\usepackage[framemethod=TikZ]{mdframed}
\mdfsetup{skipbelow=2pt, backgroundcolor=gray!8, linecolor=black!40}

\usepackage{tex4ebook}

\usepackage{pdfpages}

% EXAMPLES
%% set the counter for your environment
\newcounter{example}
\renewcommand{\theexample}{\thesection.\arabic{example}}

%% define the style
\mdfdefinestyle{example}{%
linecolor=blue,
outerlinewidth=2pt,
bottomline=true,
leftline=false,rightline=false,
skipabove=\baselineskip,
skipbelow=\baselineskip,
frametitle=\mbox{},
}

%% setup the environments
%%% with number
\newmdenv[%
style=example,
settings={\global\refstepcounter{example}},
frametitlefont={\bfseries Example~\theexample\quad},
]{example}

\begin{document}
\begin{example}[frametitle="test"]
This is a test.
\end{example}
\end{document}

Nikolaus Correll <correll>

 

Attached Files
file #427:  mdframed.4ht added by michal_h21 (1kB - application/octet-stream)
file #428:  test.tex added by michal_h21 (946B - text/x-tex)
file #425:  test.html added by correll (1kB - text/html)
file #426:  test.tex added by correll (893B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by michal_h21 (Updated the item)
  • -unavailable- added by correll (Submitted the item)
  • -unavailable- added by correll
  •  

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

     

     

    6 latest changes follow.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon Sep 27 12:32:46 2021michal_h21Open/ClosedOpen=>Closed
    Tue Aug 3 18:09:18 2021michal_h21Attached File-=>Added mdframed.4ht, #427
      Attached File-=>Added test.tex, #428
    Sun Aug 1 19:48:17 2021correllAttached File-=>Added test.html, #425
      Attached File-=>Added test.tex, #426
      Carbon-Copy-=>Added -unavailable-
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup+gray