Re: Preserve the number of equation saving a notebook as html format
- To: mathgroup at smc.vnet.net
- Subject: [mg31580] Re: [mg31363] Preserve the number of equation saving a notebook as html format
- From: Dale Horton <daleh at wolfram.com>
- Date: Wed, 14 Nov 2001 03:41:58 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
At 02:30 AM 10/31/2001, Guillermo Sanchez wrote:
>When I save a notebook with numbered equations as html I lost the
>number of equation. How can I fix this problem?. Thanks
The problem is that the HTML is created cell-by-cell. So any numbering is
lost. To get the correct numbering you need to explicitly assign the
counter for each cell. The following will do the trick.
Let's say the NotebookObject for the target notebook is stored in the
variable nb. (You could use something like nb=EvaluationNotebook[] or
nb=Notebooks[][[i]] to do this.)
In[1]:=
in = NotebookGet[nb];
In[2]:=
n=0;
In[3]:=
out = in/.Cell[cont_, "NumberedEquation", opts___] :>
Cell[cont, "NumberedEquation", opts___,
CounterAssignments->{{"NumberedEquation", n++}}];
In[4]:=
Export["file.html", out];
-Dale