Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'HTMLSave[] line-break problem' topicStudent Support Forum > General > Archives > "HTMLSave[] line-break problem"

Help | Reply To Topic
Author Comment/Response
Thomas Hocker
05/12/00 08:16am

Hi all,
when saving a notebook in html (using HTMLSave[] in Mathematica 4.0 for Macintosh) I experience the ''line-break problem'', i.e., the html file has many more line-breaks than the notebook. After searching wolfram.com I found:

> This code will force HTMLSave[] under Mathematica 4 to use the current
> notebook window width as the basis for the linebreak calculation of
> multiline formulae. It is very close to what you see on screen.
>
> Add this snippet of code to your kernel init.m file.
>
> [begin snippet]
> HTMLSave;
>
> Begin[''System`Convert`HTMLDump`''];
>
> createGIF[channel:(_OutputStream | _String), nbExpr_Notebook, opts___] :=
> Module[
> {cells, nbopts, convexpr},
> cells = nbExpr /. Notebook[cellList_List, ___] -> cellList;
> nbopts = nbExpr /. Notebook[_, optSequence___] -> {optSequence};
> nbopts = DeleteCases[nbopts, WindowSize -> Automatic, -1];
> (* Needed to keep the front end aware of window size *)
> nbopts = nbopts /. Rule[WindowSize, {width_, height_}] :>
> Rule[WindowSize, {width, 384 + Mod[FromDate[Date[]], 384]}];
> convexpr = Notebook[cells, Sequence @@ nbopts];
> Rest @ System`Dump`PutGIF[convexpr, channel,
> Sequence @@ System`Dump`DisplayToGIFOptions[opts]]
> ]
>
> End[]
> [end snippet]
>
> --
> P.J. Hinton
> Mathematica Programming Group paulh@wolfram.com

However, the above fix doesn't seem to work. Here is my ''init.m'' file (saved under ''Mathematica 4.0/Configurations/Kernel''):

[begin snippet]
(** User Mathematica initialization file **)

(** Decide how to display graphics on this machine **)

Begin[''System`Private`'']
(* Hide any symbols which are created *)

Which[
$Remote || $ParentLink =!= Null, <<''PSDirect.m'',
Environment[''DISPLAY''] =!= $Failed, <<''Motif.m'',
$SystemID == ''NeXT'', <<''NeXT.m'',
$SystemID == ''NeXT-Intel'', <<''NeXT.m'',
$SystemID == ''NeXT-HP'', <<''NeXT.m'',
$SystemID == ''NeXT-SPARC'', <<''NeXT.m'',
True, <<''Terminal.m''
]

End[]

HTMLSave;
Begin[''System`Convert`HTMLDump`''];
createGIF[channel:(_OutputStream|_String),nbExpr_Notebook,opts___]:=
Module[{cells,nbopts,convexpr},
cells=nbExpr/.Notebook[cellList_List,___]->cellList;
nbopts=nbExpr/.Notebook[_,optSequence___]->{optSequence};
nbopts=DeleteCases[nbopts,WindowSize->Automatic,-1];
(*Needed to keep the front end aware of window size*)nbopts=
nbopts/.Rule[WindowSize,{width_,height_}]:>
Rule[WindowSize,{width,384+Mod[FromDate[Date[]],384]}];
convexpr=Notebook[cells,Sequence@@nbopts];
Rest@System`Dump`PutGIF[convexpr,channel,
Sequence@@System`Dump`DisplayToGIFOptions[opts]]]
End[]

[end snippet]

I saw no difference after following the above mentioned suggestions. Did I do anything wrong?

Thanks in advance for your help!

Thomas

URL: ,
Help | Reply To Topic