[Date Index]
[Thread Index]
[Author Index]
Re: Re: Version 6 "Mathematica Book" - updated
*To*: mathgroup at smc.vnet.net
*Subject*: [mg80125] Re: [mg79983] Re: [mg79937] Version 6 "Mathematica Book" - updated
*From*: Murray Eisenberg <murray at math.umass.edu>
*Date*: Mon, 13 Aug 2007 04:32:47 -0400 (EDT)
*Organization*: Mathematics & Statistics, Univ. of Mass./Amherst
*References*: <200708090918.FAA21022@smc.vnet.net> <200708100544.BAA10635@smc.vnet.net>
*Reply-to*: murray at math.umass.edu
We can really appreciate the efforts of all, the latest being Fred, to
construct a virtual table of contents for the the non-existent "The
Mathematica Book 5th Edition".
This message compares Fred's contribution with thomas' earlier contribution.
Fred's code is much shorter because of the different method he used, but
the part that does all the actual writing is one huge Do expression that
begs to be modularized. In Fred's code, several of the global names
seem better ("overviews" instead of "fn", "mmabook" instead of "nb").
The two codes give somewhat different results. It's easy to hack
thomas' code to fix up the couple of things in the results that I
disliked there, especially the several "New" section titles. It would
be nice, though, if we could somehow use, overall Fred's method, which
seems simpler (but with modularizing that big Do loop).
COMPREHENSIVENESS:
* thomas includes parts Getting Started, Reference Guide, Further
Tutorials, and Packages that Fred does not.
ORGANIZATION:
* In the Principles of Mathematica part, for the sections on "System
Administration for Network Licenses" and "System Administration for
Single User Licenses" both codes seem to get it a bit wrong. Thomas'
code gets the hierarchy better than does Fred's code. However, thomas'
code results in an unnecessary leading text cell being included directly
in the Virtual Book notebook.
* In the Advanced Mathematics in Mathematica part, Fred's code seems to
get the hierarchy wrong in the section "Differential Equation Solving
with DSolve".
NAMING:
* thomas' code includes the unnecessary "New: " at the start of certain
section titles. OK, I can live with that. However, Fred's code gives
better titles, I think, for three of these:
thomas: New: DSolve
Fred: Differential Equation Solving with DSolve
thomas: New: NDSolve
Fred: Advanced Numerical Differential Equation Solving in Mathematica
thomas: New: NIntegrate
Fred: Advanced Numerical Integration in Mathematica
Aside from the "New:", the differences here seem to be a result of the
underlying methods used for determining section titles.
BEAUTY:
* thomas' alignment of left margins of subsection headings is better
nicer than Fred's
* thomas includes the nice "spikey" with the title, Fred doesn't
* thomas uses a pleasant blue color for all the actual hyperlinks, i.e.,
all sections, subsections,..., below the subtitle-style parts
* both codes fail properly to italicize "Mathematica" when it is the
last word in a heading.
* both codes fail to italicize "Mathematica" in the title and in the
explanatory text of the cell that follows. (Easily fixed after the fact
or in the code -- use a StyleBox in the code that does that.)
* Even though the paragraph at the top, beginning "A collection of links
to the tutorials...", is not itself a hyperlink, it looks better to my
eye in the results of Fred's code, where it appears blue because he uses
the Author style for that cell.
Fred Simons wrote:
> I was very surprised and amused that almost exactly at the time when I
> wanted to post on this topic to mathgroup, the message of thomas entered
> my mailbox. He did a lot more than I did, but with the same improvements
> of the original version of the book as in my work. So my first idea was
> not to post my version. But there are some differences in the way we
> arrive at these improvements which I think are worth mentioning. Roughly
> speaking, the technique discussed so far is to find in the tutorials
> the complete cells with the links, often in a TOCChapter cell, then copy
> these cells and after some modifications paste them into the Mathematica
> book.
>
> My approach uses the new function Documentation`HelpLookup. For example,
>
> Documentation`HelpLookup["paclet:tutorial/AlgebraicCalculationsOverview"]
>
> opens the documentation on Algebraic Calculations.
>
> Also new in Mathematica 6 is the function Button. The first argument is
> the text on the button, the second argument the action to be done.
> Further, there are a lot of options for the appearance of the button.
> For example:
>
> Button["Algebraic Calculations",
> Documentation`HelpLookup[ "paclet:tutorial/AlgebraicCalculationsOverview"]]
>
> Button["Algebraic Calculations",
> Documentation`HelpLookup[ "paclet:tutorial/AlgebraicCalculationsOverview"],
> BaseStyle -> "Section", Appearance -> None]
>
> Hence the Mathematica book will consist of cells such as the following
> one. Clicking on the text opens the tutorial.
>
> CellPrint[
> ExpressionCell[
> Button["Algebraic Calculations",
> Documentation`HelpLookup[
> "paclet:tutorial/AlgebraicCalculationsOverview"],
> BaseStyle -> {"Section", ShowStringCharacters -> False},
> Appearance -> None], "Section"]]
>
> It would have been very nice if the Mathematica function NotebookWrite
> would be able to write ExpressionCells and TextCells. But as far as I
> can see, this not (yet?) implemented. So before writing such a cell to a
> notebook, we are forced to convert the cell contents to boxes.
>
> My implementation for the Mathematica book simply runs through all
> overview tutorials and looks for cells with second argument TOCxxx. The
> first argument of such a cell contains both the text to be displayed on
> the button (no reason for beautifying ugly) and the corresponding
> paclet. For whom is still interested, here is the code.
>
> overviews = FileNames["*Overview.nb",
> ToFileName[{$InstallationDirectory, "Documentation", "English",
> "System", "Tutorials"}]];
> (*Find "Overview.nb" files in the tutorials-directory*)
>
> orderOfChapters = {{36, 3, 8, 31, 4, 47, 1, 39, 32, 14, 20, 16, 18,
> 17, 11, 43}, {10, 13, 35, 48, 22, 45, 9, 27, 38, 42, 44, 23, 12,
> 26, 15, 40, 41}, {30, 25, 2, 21, 5, 7, 37, 19, 33, 34, 28, 29, 6,
> 46, 24}};
> (*The file list is alphabetical-this is the order in which the \
> chapters should appear*)
>
> mainChapters = {"A practical introduction to Mathematica",
> "Principles of Mathematica",
> "Advanced Mathematics in Mathematica"};
> (*The three main headings*)
>
> mmabook =
> CreateDocument[{},
> StyleDefinitions -> ToFileName["Book", "Textbook.nb"]];
> NotebookWrite[
> mmabook, {Cell["The Virtual Mathematica Book (v6)", "Title"],
> Cell["A collection of links to the tutorials present in the \
> Mathematica 6.0 Documentation Center, arranged in the order of \
> chapters in \"The Mathematica Book\".", "Author"]}];
>
> Do[
> NotebookWrite[mmabook,
> Cell[mainChapters[[i]], "Subtitle",
> CellMargins -> {{Inherited, Inherited}, {15, 30}},
> ShowGroupOpener -> True]];
> Do[
> nb = NotebookOpen[file, Visible -> False];
> While[(SelectionMove[nb, Next, Cell];
> z = NotebookRead[nb]) =!= {},
> Which[z[[2]] === "TOCDocumentTitle",
> If[ MatchQ[z[[1]], TextData[_List]],
> z[[1]] = With[{zz = (z[[1]] /. StyleBox[x_, ___] :> x)[[1]]},
> Fold[#1 <> "" <> #2 &, zz[[1]], Rest[zz]]]];
> With[{pac =
> "paclet:tutorial/" <>
> StringReplace[
> file, {DirectoryName[file] -> "", ".nb" -> ""}]},
> NotebookWrite[mmabook,
> Cell[BoxData[
> ToBoxes[Button[z[[1]], Documentation`HelpLookup[pac],
> BaseStyle -> {"Subsection",
> ShowStringCharacters -> False}, Appearance -> None]]],
> "Section", ShowGroupOpener -> True]]],
> StringMatchQ[z[[2]], "TOC*"],
> type =
> Pick[{"Subsection", "Subsubsection",
> "Subsubsubsection"}, {"Chapter", "Section", "Subsection"},
> StringDrop[z[[2]], 3]];
> If[type == {}, z[[1]] = "", type = type[[1]]];
> zz =
> Cases[z[[1]],
> ButtonBox[x_, ___, ButtonData -> y_, ___] :> {x, y},
> Infinity];
> If[Length[zz] > 1 && Equal @@ zz[[All, 2]],
> zz = {{Fold[ #1 <> "" <> #2 &, First[zz[[All, 1]]],
> Rest[zz[[All, 1]]]], zz[[1, 2]]}}];
> If[zz != {},
> With[{pac = zz[[1, 2]]},
> NotebookWrite[mmabook,
> Cell[BoxData[
> ToBoxes[Button[zz[[1, 1]], Documentation`HelpLookup[pac],
> BaseStyle -> {type, ShowStringCharacters -> False},
> Appearance -> None]]], type,
> ShowGroupOpener -> True]]]]]];
>
> NotebookClose[nb],
> {file, overviews[[orderOfChapters[[i]]]]}],
> {i, 1, Length[mainChapters]}];
>
> SelectionMove[mmabook, All, Notebook]; FrontEndExecute[
> FrontEndToken["SelectionCloseAllGroups"]]; FrontEndExecute[
> FrontEndToken["OpenCloseGroup"]];
> SelectionMove[mmabook, Before, Notebook];
>
> Fred Simons
> Eindhoven University of Technology
>
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
Prev by Date:
**Re: Version 6 "Mathematica Book" - updated and expanded**
Next by Date:
**Re: Re: Mathematica v5 versus v6**
Previous by thread:
**Re: Version 6 "Mathematica Book" - updated and expanded**
Next by thread:
**Re: Version 6 "Mathematica Book" - updated and expanded**
| |