<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Insert a piece of LaTeX into a HTML file</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body>

<table width="100%" summary="page for HTML.latex"><tr><td>HTML.latex</td><td style="text-align: right;">R Documentation</td></tr></table>

<h2>Insert a piece of LaTeX into a HTML file</h2>

<h3>Description</h3>

<p>This makes use of <code>AsciiMathML</code> javascript functions. Standard LaTeX input will be turned into MathML and displayed through any brower extension that can handle MathML (such as MathPlayer)
</p>


<h3>Usage</h3>

<pre>
as.latex(x, label=NULL,
inline=ifelse(is.null(label), TRUE, FALSE), count=ifelse(is.null(label), FALSE, TRUE))
## S3 method for class 'latex'
HTML(x, file = HTMLGetFile(), ...)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
<p> String containing mathematics in a LaTeX notation </p>
</td></tr>
<tr valign="top"><td><code>file</code></td>
<td>
<p> HTML target output file</p>
</td></tr>
<tr valign="top"><td><code>label</code></td>
<td>
<p> String - Label to be displayed before the equation</p>
</td></tr>
<tr valign="top"><td><code>inline</code></td>
<td>
<p> Boolean - Place of the equation within the output flux - see details</p>
</td></tr>
<tr valign="top"><td><code>count</code></td>
<td>
<p> Boolean - Should the equation be numbered or not? </p>
</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
<p> ... </p>
</td></tr>
</table>


<h3>Details</h3>

<p>Mathematical notations will be translated in MathML by the <code>AsciiMathML</code> javascript program of Peter Jipsen. Note that his functions allow translating equations with a notation simpler than LaTeX (see his page on <code>AsciiMathML</code> for details). Pieces of LaTeX could be put <em>inline</em> (within text) or on a single line : same opposition that the one between $...$ and $$...$$. In order to work, a reference to the javascipt file has to be present within the HTML file <b>and</b> the HTML body tag has also to include <code>onload="translate()"</code>. All the necessary stuff is included in <code>HTMLInitFile</code>.
</p>


<h3>Value</h3>

<p>no value returned.
</p>


<h3>Author(s)</h3>

<p> Eric Lecoutre </p>


<h3>References</h3>

<p> AsciiMathML: <a href="http://www1.chapman.edu/~jipsen/mathml/asciimath.xml">http://www1.chapman.edu/~jipsen/mathml/asciimath.xml</a> </p>


<h3>See Also</h3>

 <p><code>HTMLInitFile</code>,<code>HTML</code> </p>


<h3>Examples</h3>

<pre>
## Not run: 
	 fic = HTMLInitFile()
	 HTML.title("sample page",1,file=fic)  
	 HTML("First paragraph",file=fic)
	 cat("Some text and then an equation:",file=fic,append=TRUE)
	 HTML(as.latex("\int_{-\infty}^{1}f(x)dx") ,file=fic)
	 cat(". Nice isn't it?",file=fic,append=TRUE)
	 HTML(as.latex("\int_{-\infty}^{1}f(x)dx",inline=FALSE) ,file=fic)   
	 HTML(as.latex("\int_{-\infty}^{1}f(x)dx",inline=FALSE,count=TRUE) ,file=fic)   
	 HTML(as.latex("\int_{-\infty}^{1}f(x)dx",inline=FALSE,label="My equation") ,file=fic)      
	 cat("file:", fic, "is created")
	 browseURL(fic)
## End(Not run)		   
</pre>


</body></html>
