|
JavaServer Pages 技术和 LaTeX 帮助的联机科学教育与研究
Building dynamic Web sites with mathematical content
JavaServer Pages technology and LaTeX help online science education and research
Michael Juntao Yuanjuntao@astro.as.utexas.edu)
博士研究生,德州大学奥斯汀分校
2002 年 2 月
Mathematical formulae, with their subscripts, superscripts, and special symbols, are devilishly difficult to translate into HTML. Most scientists and mathematicians use the flexible LaTeX text processor to create aesthetically pleasing formulae -- but how can you convert this output to a Web-friendly form? In this article, Michael Yuan shows how JSP pages and custom tags can get LaTeX-formatted formulae onto the Web in a fashion that is easy for the author and doesn't require any special client-side software. As he iterates through increasingly efficient methods, you'll see how server-side Java technology can harness the power of disparate third-party tools to solve seemingly intractable problems. Share your thoughts on this article with the author and other readers in the discussion forum by clicking Discuss at the top or bottom of the article.
The Internet and the Web were originally designed by scientists to exchange scientific and mathematical research information. Ironically, after more than 30 years of Internet and 10 years of Web development, there is still no easy way to publish mathematics-intensive content on the Web. Web mathematical communication standards, such as the W3C's MathML recommendation, have been developed; but to use them, both the author and the reader of mathematical content need special software, like the techexplorer mathematical browser plug-in from IBM for Netscape Navigator and Internet Explorer. (See Resources for links to TechExplorer and MathML.) Users are reluctant to install special client-side software because of the technical difficulties, costs, and security risks involved. Thus, the adoption of those standards is limited to small research cycles, and the vast majority of Internet users cannot use them. Today, the most convenient way to share mathematical information on the Web is still to convert all nontext formulae into snapshot images and then insert those images into standard HTML pages.
Most modern GUI-based mathematical authorizing tools have options to save documents as "Web pages"; these tools generate formulae images and static HTML pages for you. This is convenient if you just want to publish static content, such as your thesis, on the Web. But the days for static Web sites are long gone as user participation has become integral in most sites. Advanced mathematical Web sites should publish content dynamically from back-end databases and allow users to submit their own content to share with other users (examples include interactive exam systems and research collaboration systems).
This article will show you one solution to the problem. The sample code provides a means by which marked-up text representing a mathematical formula can quickly and easily be transformed into a Web-ready graphic file displaying that formula. Along the way, you'll see one approach to a more general conundrum: we'll use JSP pages and custom tags to link several disparate and unconnected tools into a single program. When you're working on tricky dynamic Web applications, remember that you don't have to start from scratch; the solution may be available in a different form, waiting for you to harness it.
将含有下标、上标和特殊符号的数学公式转换成 HTML 非常困难。大多数科学家和数学家使用灵活的 LaTeX 文本处理器来创建外表美观的公式 — 但是如何将这个输出转换成 Web 友好的格式呢?在本文中,Michael Yuan 说明了如何使用 JSP 页面和定制标记将 LaTeX 格式的公式放到 Web 上,这种方法对于编写者来说很简便并且不需要任何特定的客户机端软件。正如他在各种日益有效的方法中反复说明的,您会发现服务器方 Java 技术如何利用不同的第三方工具来解决看似很难处理的问题。通过单击本文顶部或底部的讨论在论坛中将您对本文的想法与作者和其他读者一起分享。
因特网和 Web 最初是由科学家设计用来交换科学和数学研究信息的。出乎意料的是,经过因特网 30 多年的发展以及 Web 10 年的发展,仍然没有一种简便的方法将数学密集型内容发布到 Web 上。已经开发了 Web 数学通信标准,例如 W3C 的 MathML 建议;但是为了使用它们,数学内容的作者和读者都需要特定软件,比如用于 Netscape Navigator 和 Internet Explorer 的 IBM techexplorer 数学浏览器插件。(请参阅参考资料以获取到 TechExplorer 和 MathML 的链接。)由于技术困难、成本和安全性危险因素,用户不太愿安装特定客户机端软件。因此,使那些标准的采用被限制在狭窄的研究领域,并且广大因特网用户无法使用它们。当前在 Web 上共享数学信息最方便的方法仍是将所有非文本公式转换成快照图像,然后将那些图像插入标准 HTML 页面。
最新的基于 GUI 的数学权威性工具具有将文档保存为“Web 页面”的选项;这些工具为您生成公式图像和静态 HTML 页面。如果您只是想在 Web 上发布静态内容,例如论文,则这种方法是很方便的。但是,静态网站的时代已经早就过去了,因为在大多数网站中用户的参与已经变得不可缺少。高级数学网站应该从后台数据库中动态地发布内容并允许用户提交他们自己的内容以与其他用户分享(示例包括交互式考试系统和研究协作系统)。
本文将向您展示该问题的一种解决方案。样本代码提供了一种方法,它可以快速简便地将表示数学公式的标记文本转换成显示该公式的可用于 Web 的图形文件。在此过程中,您会看到解决更多一般性难题的方法:我们将使用 JSP 页面和定制标记将几个完全不同的且互不相连的工具链接在单个程序中。当您使用多变的动态 Web 应用程序时,请记住不必从头做起;解决方案也可以其它形式提供,这由您控制。
中文:http://www-900.ibm.com/developerWorks/cn/java/j-jspmath/index.shtml
原文:http://www-900.ibm.com/developerWorks/cn/java/j-jspmath/index_eng.shtml
|
|