Appetizers and Lessons for Mathematics and Reason (www.whyslopes.com) ||Définition d'une variable || Algèbre || Arithmetique || Logique ||La raison basée sur les règles et modelés|| Online Volumes 1,  Elements of Reason. 1A. Pattern Based Reason  1B. Math Curriculum Notes 2. Three Skills for Algebra 3. Why Slopes & More Math  (Optional Book Orders) More Site Areas  1. Help Your Child or Teen Learn  2. Solving Linear Equations 3. Fractions Ratios Rates Proportions & Units 4. Euclidean Geometry 5. Analytic Geometry/Functions  6. Number Theory.  7. More Calculus More Site Areas  8. Complex Numbers  9. Qc Maths  Education   10. Secondary IV(?) maths 11. Real  Analysis  12. LaTeX2HotEqn: 13. Electric Circuits Etc   14.  Français 15. Algebra, Odds & Ends, Etc More Site Areas  16. Math Education Essays 17. Telling & Working with Time 18. Maps, Plans & Drawings 19. Quantitative Skills for  home, shopping and work  20. Statistics Useful, or Not. Try the Twiddla Whiteboard to work online with others. [Site Entrance & Hub][Site Exit]

## A Webpage Development Toolby Alan Selby, Ph. D.  (email)

The  HotEqn applet developed in 1996 by VCLab displays equations online given their LaTeX codification and the dimensions in pixels of the applet display area. See the HotEqn applet homepage for usable LaTeX commands - a list that is essentially complete.

The LaTeX2HotEqN applet below automates the usage of HotEqn (or dHotEqn). It generates the html code needed to use dHotEqn applet given the LaTeX code for mathematical expressions embedded in the html code for a webpage.

 Testing and Debugging  Testing I: On a windows 98 machine with the Java 1.4 run-time environment, LaTeX2HotEqn works perfectly in browsers Opera 6 and Internet Explorer 6, but in Netscape 6.2 there is a danger of the browser freezing - restart program if it does.  On a windows 98 PC, the dHotEqn output from LaTeX2HotEqn  also works with Netscape 3.1 and Java 1.02 run-time environment. The dHotEqn output from applet LaTeX2HotEqn is more robust that the applet. The version of LateX2HotEqn creates instances of dHotEqn in the HTML and large HTML files it creates. Testing II:  The first online version of LaTeX2HotEqn is now in whyslopes.com/webmathOld/index.html. It uses HotEqn instead of dHotEqn to display mathematics.  On my windows 98 machine,  with java run-time environment 1.4, it runs on Opera 6 and Internet Explorer 6. In Netscape 6.2, the view HTML buttons load the output correctly in a browser window, but may you may need to hit the Browser stop button 30 seconds after loading begins. With Java run-time environment 1.3, Netscape 6.0 froze. Testing III:  The LaTeX2HotEqn applet employs a HotEqn jar file to load some code. Early versions of Microsoft java VM (run-time environment) had difficulties reading jar files, so you may need to visit Sun to install  the latest run-time environment. Following an agreement with Sun, Microsoft will not distribute updates to its Java environments after  January 2004. Net Result: Webpages with HotEqn and dHotEqn  presently  run in more browsers than LaTeX2HotEqn.

With the LaTeX2HotEqN applet, you may place in html files,  LaTeX  code for mathematics that is delimited by the tag pairs

• $$and$$ for inline formulas, and
• $and$ for displayed formulas
Running the LaTeX2HotEqn applet on the hybrid LaTeX & html input will replace the LaTeX code  by html code that will or should display the associated formulas via properly sized instances of the dHotEqn applet. The resulting html file displays  rapidly in webpages except  for a one-time download of dHotEqn.zip (or HotEqn.jar) for each site visit. To provide math fonts on  your server, download the VCLAB HotEqnFonts.zip and unzip them in place in your webpage directory or codebase directory respectively to create a subdirectory Fonts . For more information, see HotEqn - Developers Edge at VCLab.  See notes below as well.

To see LaTeX2HotEqn and HotEqn in use, follow the instructions for examples 1 and 2 below. Input files can be located on  the world wide web for the instance of LaTeX2HotEqn below.

 Buttons to display applet buffers  in a browser window (if javascript is active) follow. Use the textarea above or the buttons below to save  LaTeX2HotEqn output as html files for your webserver. Hit the stop loading button in Netscaper 6.0 if latter appear to continue loading after the display is complete. The view buttons may show an empty applet  buffer if there has been no conversion of the imput data or file. Paste data into input into text area or give the URL of the source file. The LaTeX command for a fraction \frac a b needs to be written as \frac {a}{b} See HotEqn wishlist below Example 1:  Cut and  paste the following into the text area:  In a right triangle with a hypotenuse of length A and a side of length B opposite an angle $$\theta$$, The function $$\sin(\theta)=\frac{B}{A}=\frac{\mbox{opp}}{\mbox{hyp}}$$.  The derivative of  $$y = \sin(x)$$ is$\frac{dy}{dx} = \cos(x).$

The sum $$S$$ of the numbers 1 to 10 is $S= \sum_{j=1}^{10} j = 1+2+3+4+5+6+7+8+9+10 = 55$   In general, the sum $$S(n) = \sum_{j=1}^n j = \frac{n(n+1)}{2}$$. The latter result can be justified using mathematical induction.

The product $$P$$ of the numbers $$1$$ to $$n$$ is $n!=\Pi_{k=1}^{n} k = 1\cdot 2\cdot 3 \cdot 4 \cdots n.$

While $$n$$ gives n typeset in mathfont in LaTeX (good for offline printing), including $$n$$ in place of n in a source file for the above applet may lead to too many instances of HotEqn in a webpage.
Input files are best prepared using a text or code editor. Otherwise stray pieces of html (spaces etc) may land inbetween LaTeX mathematics delimiters.  After pasting. hit buttons: (i) Import Text Area, (ii) To HTML and (iii) View HTML  in that order. Example 2: Substitute the URL http://whyslopes.com/webmath/linear.html in the text field beneath the text area and besides the of the import URL button in the applet. Then Hit the buttons (i) Import URL and after the text area fills, hit (ii) to HTML and finally after the textarea content changes, hit (iii) View HTML and then wait 20 seconds.  The buttons View Source will show you the hybrid LaTeX & html input file.

TeX was a mathematics typesetting language produced by Donald Knuth in the first instance for his own use. It escaped. From TeX, Leslie Lamport derived another markup language LaTeX. Today, many journals, texts and monographs in matheamtics and science are typeset with TeX or one of its variants. To learn more about the origins and evolution of TeX and LaTeX, visit the TeX User Group (TUG). To learn more about mathematics on the web, see the TUG website Interesting URL page.  See too The Math Forum page Math Typesetting for the Internet.

### How it Works

• The LaTeX2HotEqn applet locates the LaTeX commands for inline and displayed formulas from the delimiters - make sure they occur in properly matched pairs.
• The LaTeX2HotEqn applet when run from its home page www,whyslopes.com/webmath  can also read any file located on the world wide web. An applet is normally restricted to communicating with the webserver that delivered them.  A whyslopes CGI program reads the file for LaTeX2HotEqn above and then delivers it.  If you have webserver running on your PC with a default webpage, see if the above applet can access URL http://127.0.0.1/. If it can, input files on your PC webserver can be read too. Some experimentation with internet security options (at your own risk) may be required for this.

• If import or code generation operations result in a file too large to fit in the text area, the file may be stored in an applet text buffer. Try the view buttons to see the source or generated code.

The above applet could be easily improved (tomorrow) by allowing delimiter  $$and$$ (or \begin(displaymath) and \end{displaymath} to surround displayed math,  and  $and$\$ (or \begin(math) and \end{math} to surround displayed math, An extension of LaTeX2HotEqn to come in January 2003 may translate LaTeX markup for \part{ }, \chapter{}, ... \paragraph{...} into sectioning commands <h1>  to </h6> and LaTeX markup for itemized and enumerated lists in to html commands for the same.

Remark: For each formula, the LaTeX2HotEqn applet invokes an instance of the HotEqn cousin, the Java component cHotEqn to obtain the width and height of the display area needed by HotEqn or dHotEqn to display the formula without cropping it.

### Creating webpages with dHotEqn and HotEqn applets

1. the local copy of dHotEqn.zip (or this HotEqn.jar) to your webpage directory or codebase directory)

2. HotEqnFonts.zip from the VCLAB  (unzip them in place in your webpage directory or codebase directory respectively. That should create a subdirectory Fonts in your webpage directory or the codebase directory. The fonts are needed for some, not all, webpages

For more information, see HotEqn - Developers Edge at VCLab. Note LaTeX2HotEqn in this webpage runs with the larger  HotEqn.jar  obtain from  unzipping HotEqn.jar.zip  The smaller one  HotEqn.jar is compatible with more browsers and it lacks one component (cHotEqn) needed by LaTeX2HotEqn.

Remember at the present time, LaTeX2HotEqn runs in fewer browsers than its output files. Your website visitors to the output files, your webpages, will not care..

Security Note: If you test output from your local machine, not a webserver, you may get a file security violation if the applet tries to access fonts. Recent Java implementations does not like applets to access your hard-disk, even when run from that hard-disk.

### LaTeX From HTML

After importing the file, you can also hit the [to LaTeX] and [View LaTeX] buttons to keep the LaTeX coding for the formulas and replace some or all of the html in the source file by LaTeX codes.  The replacement works well for \chapters, \sections, \subsections, ... and for list commands <ul> and <ol>. The replacement is approximate for tables.  The html codes for borders are ignored

### Single Source File

The foregoing suggests with care that a single source file might be be used for LaTeX and html generation. LaTeX has codes for drawing vertical and horizontal lines between table columns and rows where as html provides methods for drawing borders around individual cells. So the treatment of tables in LaTeX and html is incompatible.

Extensible markup language xml is fine as assembly language for online software. However, producers of webpages will continue to need a high level language. A mixture of present day html and LaTeX and further markup codes might suffice for this. See generalizations and plug-ins below.

### HotEqn Wish List

HotEqn may crash a few browsers if you mis-spell LaTeX commands or ... .  Greater usage of HotEqn by people may lead to bug removal.

1. Add space before and after equal signs.
2. Provide an option to define macros and communicate those macros between instances of HotEqn or its cousin in a webpage or across webpages
3. ....

With usage, this HotEqn wishlist will grow.  The LaTeX2HotEqn applet is only a shell around HotEqn and its cousins.

## Plug-in Exercises

An variant of the LaTeX2HotEqn applet above (not today) could be coded with a parameter pointing to an input file for the purpose of reading and processing the input file and then of opening a new browser window for display purposes or alternatively, replacing the webpage containing the applet with the a page displaying its output. The latter may be done in a manner invisible to the websurfer.

If an applet X produces an onscreen display (graphics) from a markup language, and the applet X (or slight variant) is able to report the minimum size for needed to fully display its input,  then a java application or applet Y may replace instances of the markup language in an input file by html-code for properly sized instance of the applet X for graphic display.

Java Wish: The development of applets would be simpler if applets or embedded objects not giving their dimensions,  could report to a browser the minimum or preferred dimensions for their display. Then an applet capable of displaying a markup language could report its preferred size after calculating the height and width needed for any one display.

### Drawing Pictures

Recall

• LaTeX itself include markup language for its Picture environment
• PiCTeX provides an extension of TeX or LaTeX for drawing graphs with embedded text and formulas.
Any applet X capable of displaying 2 D and 3D markup languages drawing commands

say line, circle and geometric shape drawing and filling/painting commands with further commands or buttons to define initial perspective and or new viewpoints in the embedded applet or a popup applet frame.

could be embedded between pairs of delimiters in a hybrid html source file and an applet like LaTeX2HotEqn could be used to replace instances of the drawing command by instances of the display applet X, properly sized.

The hand-coding of drawing commands is awkward. But technical drawing and graphic displays might be generated by an object-oriented  paint program (editor) which allows the user to select, drag and drop components into place, and through pop-up menus display properties list for to change and add properties - numerical, Boolean or visual etc. Such a  paint program with a command to export drawing commands would be useful for embedding drawing commands in an html file. Ideally,  the paint program would have a cousin which could be used for display purposes inside a webpage.