Re: Documentation Center (v6): do-it-yourself Mathematica Book

*To*: mathgroup at smc.vnet.net*Subject*: [mg79809] Re: Documentation Center (v6): do-it-yourself Mathematica Book*From*: David Reiss <dbreiss at gmail.com>*Date*: Sun, 5 Aug 2007 04:52:46 -0400 (EDT)*References*: <f91jf0$6da$1@smc.vnet.net>

This is good! I made a few small changes to your code so that it does not only work on Windows. The following version makes it OS independent --David fn = FileNames["*Overview.nb", ToFileName[{$InstallationDirectory, "Documentation", "English", "System", "Tutorials"}]]; (*Find "Overview.nb" files in the tutorials-directory*) nameList = With[{case = StringReplace[#, DirectoryName[#] -> ""]}, {StringReplace[case, "Overview.nb" -> ""], "paclet:tutorial/" <> StringReplace[case, ".nb" -> ""], #}] & /@ fn; (*create a list of strings needed for future code*) Scan[(nameList[[#, 1]] = "New: " <> nameList[[#, 1]]) &, {3, 6, 7, 8, 18, 28, 29, 40, 41, 46, 48}]; (*mark the chapter not present in v5.2 with "New: "*) 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*) structure = Table[nameList[[i]], {k, 3}, {i, orderOfChapters[[k]]}]; (*needed for the code further down-represents the structure of the \ Matehmatica book*) mainChapters = {"A practical introduction to Mathematica", "Principles of Mathematica", "Advanced Mathematics in Mathematica"}; (*The three main headings*) d[x_] := Cell[ BoxData[TagBox[ ButtonBox[ PaneSelectorBox[{False -> x[[1]], True -> StyleBox[x[[1]], "HyperlinkActive"]}, Dynamic[CurrentValue["MouseOver"]], BaselinePosition -> Baseline, FrameMargins -> 0, ImageSize -> Automatic], BaseStyle -> "Link", ButtonData -> x[[2]], ButtonNote -> x[[2]]], Annotation[#, x[[2]], "Hyperlink"] &]], "Subsection"]; (*Cell representing a hyperlink to the "...Overview.nb" files*) nb = NotebookPut[]; SetOptions[nb, StyleDefinitions -> ToFileName["Book", "Textbook.nb"]]; NotebookWrite[ nb, {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[nb, Cell[mainChapters[[k]], "Section"]]; Do[NotebookWrite[nb, d[i]]; With[{nb1 = NotebookOpen[i[[3]]]}, NotebookFind[nb1, "TOCChapter", All, CellStyle]; NotebookWrite[nb, NotebookRead[nb1]]; NotebookClose[nb1]], {i, structure[[k]]}], {k, 3}]; SelectionMove[nb, All, Notebook]; FrontEndExecute[ FrontEndToken["SelectionCloseAllGroups"]]; FrontEndExecute[ FrontEndToken["OpenCloseGroup"]]; (*Creates the Mathematica Book.The With[...] block in the middle \ opens an "Overview.nb" file,extracts the embedded hyperlinks,and \ prints those into the Mathematica Book as well.*) On Aug 4, 6:12 am, thomas <thomas.mue... at gmail.com> wrote: > Many users on this discussion group have complained about the absence > of "The Mathematica Book" in the new Documentation Center; mainly > because of a missing linear introductory text of Mathematica which was > present in the old Help system. <snip>