在新版本的 Mathematica 中制作版本 5 旧文档的工作副本
在新版本的 Mathematica 中,我们有 功能齐全的老式 Mathematica 帮助浏览器。但版本 5 的旧文档并未包含在新版本的 Mathematica 中。该旧版文档仅占用 209 МB 磁盘空间,如果能够在新版本的 Mathematica 中访问它将会非常有用。
将 Mathematica 5.2 和 Mathematica 7 或 8 安装在同一台计算机上,如何才能通过老式的帮助浏览器从新版本中访问旧文档?
我尝试将文档文件夹复制到
C:\Program Files\Wolfram Research\Mathematica\5.2\Documentation
旧版
C:\Documents and Settings\All Users\Application Data\Mathematica\Application\LegacyDocumenation
帮助浏览器中,现在旧版帮助浏览器中的“帮助浏览器”显示为插件。但它不能正常工作。
有关调整 Mathematica 5 中帮助浏览器外观的一些有用信息,请参见 此处。但我不知道如何将其应用于新版本的Mathematica。
In new versions of Mathematica we have fully functional old-fashioned Mathematica Help Browser. But the legacy documentation of version 5 is not included in new versions of Mathematica. This legacy documentation takes only 209 МB of disk space and it would be useful to have it accessible from within the new versions of Mathematica.
Having Mathematica 5.2 and Mathematica 7 or 8 installed on the same machine, how can one make the legacy documentation accessible from within a new version through the old-fashioned Help Browser?
I tried to copy the Documentation folder from
C:\Program Files\Wolfram Research\Mathematica\5.2\Documentation
to
C:\Documents and Settings\All Users\Application Data\Mathematica\Application\LegacyDocumenation
and inside of the legacy Help Browser now appear "Help Browser" as an AddOn. But it does not work properly.
Some useful information on tuning the appearance of the Help Browser in Mathematica 5 can be found here. But I do not know how to apply this to new versions of Mathematica.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决方案
顺便说一句,我已经找到了将所有 Mathematica 5.2 文档添加到新版本 Mathematica 中旧版帮助浏览器中的方法。
关键是位于目录(Windows 下)中的“HelpBrowserSetup.tr”文件,
应将其内容替换为:
然后,Mathematica$InstallationDirectory 中的“Documentation”文件夹em> 5.2 应复制到新版本Mathematica 的
$InstallationDirectory
并替换(一个不重要的文件将被替换)。另一种可能性是将其复制到目录(在 Windows 下)(可能 $UserBaseDirectory 也合适)。
现在启动 Mathematica 并评估
旧版帮助浏览器将打开并包含 5.2 版中的所有文档!
编辑
我刚刚找到了更简单的解决方案。人们可以按如下方式修改“HelpBrowserSetup.tr”文件:(
或者简单地将该文件从版本 5.2 安装复制并替换到新版本的文件夹中)。
对于安装了 Mathematica 5.2 的用户来说,
您无需复制文档。您有两种可能性:
1.) 仅将“HelpBrowserSetup.tr”文件从版本 5.2 安装复制到新版本的文件夹。然后评估类似的内容
(其中“C:/Program Files/Wolfram Research/Mathematica/5.2/”是 Mathematica 5.2 的
$InstallationDirectory
)。,所有安装的版本 6 之前的附加组件将不会出现在旧版帮助浏览器中):
然后评估
2.) 只需按如下方式修改“HelpBrowserSetup.tr”文件(但在这种情况下 将帮助浏览器项目添加到帮助菜单
为此,我们只需在 MenuSetup.tr 中的适当位置添加行
MenuItem["Help Browser...", "HelpDialog"],
:The solution
Incidentally I have found the way to add all Mathematica 5.2 documentation to the legacy Help Browser in new versions of Mathematica.
The key is the "HelpBrowserSetup.tr" file located in the directory (under Windows)
One should replace its contents with:
Then, the "Documentation" folder from the
$InstallationDirectory
of Mathematica 5.2 should be copied to the$InstallationDirectory
of new version of Mathematica with replacement (one unimportant file will be replaced). Another possibility is to copy it to directory (under Windows)(probably the
$UserBaseDirectory
is also appropriate).Now start Mathematica and evaluate
The legacy Help Browser will open and will contain all the documentation from the version 5.2!
Edit
I just have found even simpler solution. One may modify the "HelpBrowserSetup.tr" file as follows:
(or simply copy with replacement this file from the version 5.2 installation to the new version's folder).
Addition for those who have Mathematica 5.2 installed
You need not to copy the Documentation. You have two possibilities:
1.) Copy only the "HelpBrowserSetup.tr" file from the version 5.2 installation to new version's folder. Then evaluate something like
(where "C:/Program Files/Wolfram Research/Mathematica/5.2/" is the
$InstallationDirectory
of Mathematica 5.2).2.) Just modify the "HelpBrowserSetup.tr" file as follows (but in this case all installed pre-version 6 Add-Ons will not appear in the legacy Help Browser):
and then evaluate
P.S. Adding Help Browser item to the Help menu
For this we just need to add row
MenuItem["Help Browser...", "HelpDialog"],
in appropriate place in MenuSetup.tr:警告:我最近了解到,为新文档构建索引可能会在 Windows 计算机中产生不良影响。请阅读 Alexey 的评论以了解更多详细信息。据我所知,Mac OS X 中一切正常。一旦确定问题根源,我将提供更新。
在这里,我提出了一个功能,允许任何笔记本成为 Mathematica 8 中文档中心的一部分。您可以首先让 Mathematica 评估以下内容:
如何使用它:
在一个新文档或您评估函数的同一文档中,首先找出这个变量是什么:
在我的例子中,因为我使用的是Mac OS XI,所以得到:
找出你的变量是什么。在此目录中,您应该会看到文件夹
Applications
。在Applications
内创建用于放置 MMA5 文档的文件夹。我将我的文件夹命名为MMA5
,因为它很短,但您可以给它任何您想要的名称,对于 Alexey,我们可以将其称为LegacyDocumentation
。在此文件夹内传输 MMA5 安装目录中名为Documentation
的文件夹的副本。我们快完成了。现在调用函数
AddDocs
。该函数仅采用一个参数:我们希望添加其文档的应用程序的名称。就我而言,由于我将文件夹命名为MMA5
,因此我将按如下方式调用它:接下来您应该看到的是一系列笔记本出现和消失以及一系列正在打印的消息。以下是该消息序列的一部分:
由于 MMA5 的文档相当广泛,因此此过程将需要一段时间。我对这个函数做了一个计时,它说大约需要 40 秒(对我来说似乎更长)。
你完成了。 MMA5 的文档现在应该可以在文档中心找到。
试驾
假设您希望查找有关
DSolve
的一些信息。如果您搜索DSolve
,您会看到以下内容:查找 MMA5 文档我们需要点击“搜索包含 DSolve 的所有页面”中的
DSolve
链接。现在我们得到这样的东西:在上面的屏幕截图中,我用红色标记了允许我们访问的条目Mathematica 5 文档。我无法为文档中的每个文件编写一个很好的摘要,因此我只是让 Mathematica 编写位于笔记本中的
CellTags
。这就是您看到字符串列表的原因。如果您单击第一个红色条目,这就是我们获得的
这样您就得到了遗留文档的工作副本致力于新版本的 Mathematica。我还没有在 MMA7 中测试过这个,但我感觉它会起作用。如果有人尝试这样做,请告诉我。
注意
如果您想将其应用于不同应用程序中的其他文档。您需要注意这一点:
请注意,我在标签中硬编码了“Mathematica 5.2”。如果需要,您甚至可以将其更改为“LegacyDocumentation”。这只是一个标签。另一个重要的一点是
关键字
。我已将keywords
设置为变量tags
。笔记本中的每个单元格都可以选择添加CellTags
。如果您要编写一些文档,则应该使用它们。我就利用这个让文档中心知道如何查找文档。这是我最近才学到的东西,我一定会在一个包中实现。如果您想编写一个完整的应用程序及其文档,我建议您查看我的帖子 将笔记本集成到 MMA 文档中心。在这里您将找到更多信息,让您了解我在此处提供的功能如何工作。
最后,我想补充一点,我也在 Windows 机器中对此进行了测试,并且运行良好,这就是这行代码背后的原因:
StringReplace[FileNameJoin[{appName, str}], "\\ “-> "/"]
编辑:
我更改了该函数,以便它可以在 MMA7 中正确工作。结果
pacletInfo.m
文件需要包含行MathematicaVersion ->; 7+,以便它可以在 MMA7 和 MMA8 中工作。
编辑2:
我在复制和粘贴该函数时犯了一个错误。现在应该修复了。如果您同时拥有 MMA7 和 MMA8,我建议仅在 MMA7 中运行一次。这样,MMA7 和 MMA8 都可以使用该文档。
WARNING: I recently learned that building the index for new documentation can have undesired effects in a windows machine. Please read Alexey's comments for more details. As far as I can tell, everything is working fine in Mac OS X. I'll give an update once I determine what the source of the problem is.
Here I present a function to allow any notebook to become part of the documentation center in Mathematica 8. You can start by letting Mathematica evaluate the following:
How to use it:
In a new document or the same one where you evaluated the functions start by finding out what this variable is:
In my case, since I'm using Mac OS X I get:
Find out what yours is. In this directory you should see the folder
Applications
. InsideApplications
create the folder where you will be placing the MMA5 documentation. I named my folderMMA5
because it is short but you can give it any name you want, in the case of Alexey we can call itLegacyDocumentation
. Inside this folder transfer a copy of the folder namedDocumentation
found in the installation directory for MMA5.We are almost done. Now call the function
AddDocs
. This function takes only one argument: The name of the application whose documentation we wish to add. In my case, since I named the folderMMA5
I will call it as follows:The next thing you should see is a sequence of notebooks appearing and disappearing as well as a sequence of messages being printed. Here is part of that sequence of messages:
Since the documentation of MMA5 is quite extensive this process will take a while. I did a timing on this function and it said it took about 40 seconds (It seemed a lot longer to me).
You are done. The documentation of MMA5 should now be available in the documentation center.
Test Drive
Say you wish to look up some information on
DSolve
. If you search forDSolve
you see the following:To look up for the MMA5 documentation we need to click on the link for
DSolve
located in "Search for all pages containing DSolve". Now we obtain something like this:In the above screenshot I have marked in red the entries that give us access to the Mathematica 5 documentation. I have no way of writing a nice summary for each of the files in the documentation so I just made Mathematica write the
CellTags
located in the notebooks. This is why you see a list of strings.If you click on the first red entry this is what we obtain
So there you have it, a working copy of legacy documentation working on the new version of Mathematica. I have not tested this in MMA7 but I have a feeling it would work. If someone tries this please let me know.
NOTES
If you want to apply this to other documents in a different application. You need to pay attention to this:
Notice that I have hardcoded "Mathematica 5.2" in the label. You may even want to change this to "LegacyDocumentation" if you want. This is just a label. Another important point is
the
keywords
. I have setkeywords
to the variabletags
. Every cell in a notebook has the option to addCellTags
. If you are going to write some documentation you should use them. I have taken advantage of this to let the documentation center know how to search for the documents. This is something I have just recently learned and I will definitely implement in a package.If you ever feel like writing a complete application with its documentation I suggest you take a look at my post integrating notebooks to MMA doc center. Here you will find more information that will let you figure out how the functions I have provided here work.
As a final note I'd like to add that I have also tested this in windows machine and it worked fine, that's the reason behind this line of code:
StringReplace[FileNameJoin[{appName, str}], "\\" -> "/"]
EDIT:
I changed the function so that it can correctly work in MMA7. Turns out that the
pacletInfo.m
file needs to have the lineMathematicaVersion -> 7+
so that it can work in MMA7 and MMA8.EDIT 2:
I made a mistake while copying and pasting the function. It should be fixed now. If you have both MMA7 and MMA8, I suggest running it only once in MMA7. That way the documentation will be available to both MMA7 and MMA8.