<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <META name="GENERATOR" content="hevea 1.10"> <META name="Author" content="Luc Maranget"> <LINK rel="stylesheet" type="text/css" href="manual.css"> <TITLE>Mathematical Formulae</TITLE> </HEAD> <BODY > <A HREF="manual028.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A> <A HREF="manual022.html"><IMG SRC="contents_motif.gif" ALT="Up"></A> <A HREF="manual030.html"><IMG SRC="next_motif.gif" ALT="Next"></A> <HR> <H2 CLASS="section"><A NAME="htoc82">B.7</A>  Mathematical Formulae</H2><UL> <LI><A HREF="manual029.html#toc64">Math Mode Environment</A> </LI><LI><A HREF="manual029.html#toc65">Common Structures</A> </LI><LI><A HREF="manual029.html#toc66">Square Root</A> </LI><LI><A HREF="manual029.html#toc67">Unicode and mathematical symbols</A> </LI><LI><A HREF="manual029.html#toc68">Putting one thing above/below/inside</A> </LI><LI><A HREF="manual029.html#toc69">Math accents</A> </LI><LI><A HREF="manual029.html#toc70">Spacing</A> </LI><LI><A HREF="manual029.html#toc71">Changing Style</A> </LI></UL> <H3 CLASS="subsection"><A NAME="toc64"></A><A NAME="htoc83">B.7.1</A>  Math Mode Environment</H3><P> The three ways to use math mode (<CODE>$</CODE>…<CODE>$</CODE>, <CODE>\(</CODE>…<CODE>\)</CODE> and <CODE>\begin{math}</CODE>…<CODE>\end{math}</CODE>) are supported. The three ways to use display math mode (<CODE>$$</CODE>…<CODE>$$</CODE>, <CODE>\[</CODE>…<CODE>\]</CODE> and <CODE>\begin{displaymath}</CODE>… <CODE>\end{displaymath}</CODE>) are also supported. Furthermore, <CODE>\ensuremath</CODE> behaves as expected.</P><P>The <CODE>equation</CODE>, <CODE>eqnarray</CODE>, <CODE>eqnarray*</CODE> environments are supported. Equation labeling and numbering is performed in the first two environments, using the <CODE>equation</CODE> counter. Additionally, numbering can be suppressed in one row of an <CODE>eqnarray</CODE>, using the <CODE>\nonumber</CODE> command.</P><P>Math mode is not as powerful in H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A as in L<sup>A</sup>T<sub>E</sub>X. The limitations of math mode can often be surpassed by using math display mode. As a matter of fact, math mode is for in-text formulas. From the HTML point of view, this means that math mode does not close the current flow of text and that formulas in math mode must be rendered using text-level elements only. By contrast, displayed formulas can be rendered using block-level elements. This means that H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A have much more possibilities in display context than inside normal flow of text. In particular, stacking text elements one above the over is possible only in display context. For instance compare how H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A renders <CODE>$\frac{1}{\sum_{i=1}^{\infty} i$</CODE> as: 1/∑<SUB><I>i</I>=1</SUB><SUP>∞</SUP> <I>i</I>, and <CODE>$$\frac{1}{\sum_{i=1}^{\infty} i$$</CODE> as: </P><TABLE CLASS="display dcenter"><TR VALIGN="middle"><TD CLASS="dcell"><TABLE CLASS="display"><TR><TD CLASS="dcell" ALIGN="center">1</TD></TR> <TR><TD CLASS="hbar"></TD></TR> <TR><TD CLASS="dcell" ALIGN="center"><TABLE CLASS="display"><TR VALIGN="middle"><TD CLASS="dcell"><TABLE CLASS="display"><TR><TD CLASS="dcell" ALIGN="center">∞</TD></TR> <TR><TD CLASS="dcell" ALIGN="center"><FONT SIZE=6>∑</FONT></TD></TR> <TR><TD CLASS="dcell" ALIGN="center"><I>i</I>=1</TD></TR> </TABLE></TD><TD CLASS="dcell"> <I>i</I></TD></TR> </TABLE></TD></TR> </TABLE></TD></TR> </TABLE><H3 CLASS="subsection"><A NAME="toc65"></A><A NAME="htoc84">B.7.2</A>  Common Structures</H3><P>H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A admits, subscript (<CODE>_</CODE>), superscripts (<CODE>^</CODE>) and fractions (<CODE>\frac{</CODE><I>numer</I><CODE>}{</CODE><I>denom</I><CODE>}</CODE>). The best effect is obtained in display mode, where HTML <CODE>TABLE</CODE> element is extensively used. By contrast, when not in display mode, H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A uses only <CODE>SUB</CODE> and <CODE>SUP</CODE> text-level elements to render superscrits and subscript, and the result may not be very satisfying.</P><P>However, simple subscripts and superscripts, such as <CODE>x_i</CODE> or <CODE>x^2</CODE>, are always rendered using the <CODE>SUB</CODE> and <CODE>SUP</CODE> text-level elements and their appearance should be correct even in in-text formulas.</P><P>When occurring outside math mode, characters <CODE>_</CODE> and <CODE>^</CODE> act as ordinary characters and get echoed to the output. However, a warning is issued.</P><P>An attempt is made to render all ellipsis constructs (<CODE>\ldots</CODE>, <CODE>\cdots</CODE>, <CODE>\vdots</CODE> and <CODE>\ddots</CODE>). The effect may be strange for the latter two.</P><H3 CLASS="subsection"><A NAME="toc66"></A><A NAME="htoc85">B.7.3</A>  Square Root</H3><P> <A NAME="@default159"></A><A NAME="@default160"></A> The n<SUP>th</SUP> root command <CODE>\sqrt</CODE> is supported only for n=3,4, thanks to the existence of Unicode characters for the same. For the others, we shift to fractional exponents, in which case, the <CODE>\sqrt</CODE> command is defined as follows: </P><PRE CLASS="verbatim">\newcommand{\sqrt}[3][2]{\left(#2\right)^{1/#1}} </PRE><P> Then, the source fragment: <CODE>$$\sqrt[5]{\frac{1}{n!}} + \sqrt[3]{\pi} + \sqrt{\pi}$$</CODE> gets rendered as follows: </P><TABLE CLASS="display dcenter"><TR VALIGN="middle"><TD CLASS="dcell"><TABLE CLASS="display"><TR VALIGN="middle"><TD CLASS="dcell">⎛<BR> ⎜<BR> ⎜<BR> ⎝</TD><TD CLASS="dcell"><TABLE CLASS="display"><TR><TD CLASS="dcell" ALIGN="center">1</TD></TR> <TR><TD CLASS="hbar"></TD></TR> <TR><TD CLASS="dcell" ALIGN="center"><I>n</I>!</TD></TR> </TABLE></TD><TD CLASS="dcell">⎞<BR> ⎟<BR> ⎟<BR> ⎠</TD><TD CLASS="dcell"><TABLE CLASS="display"><TR><TD CLASS="dcell" ALIGN="left"><TABLE CLASS="display"><TR><TD CLASS="dcell" ALIGN="center">1</TD></TR> <TR><TD CLASS="hbar"></TD></TR> <TR><TD CLASS="dcell" ALIGN="center">5</TD></TR> </TABLE></TD></TR> <TR><TD CLASS="dcell" ALIGN="left"><BR> <BR> <BR> </TD></TR> <TR><TD CLASS="dcell" ALIGN="left"> </TD></TR> </TABLE></TD></TR> </TABLE></TD><TD CLASS="dcell"> + </TD><TD CLASS="dcell"><FONT SIZE=5>∛</FONT></TD><TD CLASS="dcell"><TABLE border=0 cellspacing=1 cellpadding=0><TR><TD CLASS="hbar"></TD></TR> <TR><TD ALIGN=center NOWRAP>π</TD></TR> </TABLE></TD><TD CLASS="dcell"> + </TD><TD CLASS="dcell"><FONT SIZE=5>√</FONT></TD><TD CLASS="dcell"><TABLE border=0 cellspacing=1 cellpadding=0><TR><TD CLASS="hbar"></TD></TR> <TR><TD ALIGN=center NOWRAP>π</TD></TR> </TABLE></TD></TR> </TABLE><H3 CLASS="subsection"><A NAME="toc67"></A><A NAME="htoc86">B.7.4</A>  Unicode and mathematical symbols</H3><P><A NAME="@default161"></A></P><P>The support for unicode symbols offered by modern browsers allows to translate almost all math symbols correctly.</P><P>Log-like functions and variable sized-symbols are recognized and their subscripts and superscripts are put where they should in display mode. Subscript and superscript placement can be changed using the <CODE>\limits</CODE> and <CODE>\nolimits</CODE> commands. Big delimiters are also handled.</P><H3 CLASS="subsection"><A NAME="toc68"></A><A NAME="htoc87">B.7.5</A>  Putting one thing above/below/inside</H3><P><A NAME="@default162"></A><A NAME="@default163"></A><A NAME="@default164"></A> The commands <CODE>\stackrel</CODE>, <CODE>\underline</CODE> and <CODE>\overline</CODE> are recognized. They produce sensible output in display mode. In text mode, these macros call the <CODE>\textstackrel</CODE>, <CODE>\textunderline</CODE> and <CODE>\textoverline</CODE> macros. These macros perform the following default actions </P><DL CLASS="description"><DT CLASS="dt-description"> <TT><B>\textstackrel</B></TT></DT><DD CLASS="dd-description"> Performs ordinary superscripting. </DD><DT CLASS="dt-description"><TT><B>\textunderline</B></TT></DT><DD CLASS="dd-description"> Underlines its argument, using the <CODE>U</CODE> text-level element. </DD><DT CLASS="dt-description"><TT><B>\textoverline</B></TT></DT><DD CLASS="dd-description"> Overlines using style-sheets (used <TT><SPAN></TT> with a top border). </DD></DL><P><A NAME="@default165"></A> The command <CODE>\boxed</CODE> works well both in display and normal math mode. Input of the form <CODE>\boxed{\frac{\pi}{2}}</CODE> produces <SPAN CLASS="textboxed">π/2</SPAN> in normal math, and </P><TABLE CLASS="display dcenter"><TR VALIGN="middle"><TD CLASS="dcell"><TABLE CLASS="boxed"><TR><TD><TABLE CLASS="display"><TR><TD CLASS="dcell" ALIGN="center">π</TD></TR> <TR><TD CLASS="hbar"></TD></TR> <TR><TD CLASS="dcell" ALIGN="center">2</TD></TR> </TABLE></TD></TR> </TABLE></TD></TR> </TABLE><P> in display-math mode. The commands <CODE>\bigl,\bigr</CODE> etc. <A NAME="@default166"></A>are also rendered well. Some examples can be found <A HREF="../examples/random-math.html">here</A>.</P><H3 CLASS="subsection"><A NAME="toc69"></A><A NAME="htoc88">B.7.6</A>  Math accents</H3><P><A NAME="@default167"></A> Math accents that have coresponding text accents (<CODE>\hat</CODE>, <CODE>\tilde</CODE>, etc.) are handled<A NAME="mathaccents"></A> by default. They in fact act as the corresponding text-mode accents (Section <A HREF="manual025.html#accents">B.3.4</A>). As a consequence, they work properly only on ascii letters. This may be quite cumbersome, but at least some warnings draw user’s attention on the problem. If accents are critical to your document and that H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A issues a lot of warnings, a solution is to redefine the math accent command. A suggested replacement is using limit superscripts. That way accents are positionned above symbols in display mode and after symbols in text mode. </P><PRE CLASS="verbatim">\renewcommand{\hat}[1]{\mathop{#1}\limits^{\textasciicircum}\nolimits} Displayed: $$ \hat{\mu} = \hat{\Delta}. $$ In text: $\hat{\mu} = \hat{\delta}$ </PRE><P>An you get, displayed: </P><TABLE CLASS="display dcenter"><TR VALIGN="middle"><TD CLASS="dcell"><TABLE CLASS="display"><TR><TD CLASS="dcell" ALIGN="center">^</TD></TR> <TR><TD CLASS="dcell" ALIGN="center">µ</TD></TR> <TR><TD CLASS="dcell" ALIGN="center"> </TD></TR> </TABLE></TD><TD CLASS="dcell"> = </TD><TD CLASS="dcell"><TABLE CLASS="display"><TR><TD CLASS="dcell" ALIGN="center">^</TD></TR> <TR><TD CLASS="dcell" ALIGN="center">Δ</TD></TR> <TR><TD CLASS="dcell" ALIGN="center"> </TD></TR> </TABLE></TD><TD CLASS="dcell">. </TD></TR> </TABLE><P> In text: µ<SUP>^</SUP> = δ<SUP>^</SUP>.</P><P>Whereas, with the default of <CODE>\hat</CODE> being <CODE>\^</CODE>, you get “µ = δ”, with the following warnings: </P><PRE CLASS="verbatim">./tmp.tex:4652: Warning: Application of '\^' on '\mu' failed ./tmp.tex:4652: Warning: Application of '\^' on '\delta' failed </PRE><P>The <CODE>\vec</CODE> command is rendered differently in display and non-display mode. In display mode, the arrow appears in normal position, while in non-display the arrow appears as an ordinary superscript. </P><TABLE CLASS="display dcenter"><TR VALIGN="middle"><TD CLASS="dcell"><TT>\vec{u}</TT> in text mode: <I>u</I><SUP>→</SUP>,   <TT>\vec{u}</TT> in display mode: </TD><TD CLASS="dcell"><TABLE CLASS="display"><TR><TD CLASS="dcell" ALIGN="center">→</TD></TR> <TR><TD CLASS="dcell" ALIGN="center"><I>u</I></TD></TR> <TR><TD CLASS="dcell" ALIGN="center"> </TD></TR> </TABLE></TD></TR> </TABLE><P>Most “extensible accents” (<CODE>\widetilde</CODE>, <CODE>\widehat</CODE>, etc.) are not even defined. There are a few exceptions: line “accents”: </P><TABLE CLASS="display dcenter"><TR VALIGN="middle"><TD CLASS="dcell"> </TD><TD CLASS="dcell"><TABLE CELLSPACING=6 CELLPADDING=0><TR><TD ALIGN=center NOWRAP><TABLE CLASS="display"><TR VALIGN="middle"><TD CLASS="dcell">    </TD><TD CLASS="dcell"><TABLE border=0 cellspacing=1 cellpadding=0><TR><TD ALIGN=center NOWRAP><I>abc</I></TD></TR> <TR><TD CLASS="hbar"></TD></TR> </TABLE></TD><TD CLASS="dcell">  <TT>\underline</TT></TD></TR> </TABLE></TD><TD ALIGN=center NOWRAP><TABLE CLASS="display"><TR VALIGN="middle"><TD CLASS="dcell">    </TD><TD CLASS="dcell"><TABLE border=0 cellspacing=1 cellpadding=0><TR><TD CLASS="hbar"></TD></TR> <TR><TD ALIGN=center NOWRAP><I>abc</I></TD></TR> </TABLE></TD><TD CLASS="dcell">  <TT>\overline</TT></TD></TR> </TABLE></TD></TR> </TABLE></TD></TR> </TABLE><P> Brace “accents”: </P><TABLE CLASS="display dcenter"><TR VALIGN="middle"><TD CLASS="dcell"> </TD><TD CLASS="dcell"><TABLE CELLSPACING=6 CELLPADDING=0><TR><TD ALIGN=center NOWRAP><TABLE CLASS="display"><TR VALIGN="middle"><TD CLASS="dcell">    </TD><TD CLASS="dcell"><TABLE CLASS="display" STYLE="width:100%;"><TR><TD CLASS="dcell" ALIGN="center" COLSPAN="5"> </TD></TR> <TR><TD CLASS="dcell" ALIGN="center" COLSPAN="5">1 × 2 × ⋯ × <I>n</I></TD></TR> <TR><TD CLASS="dcell" ALIGN="center" STYLE="width:5%;">◥</TD><TD CLASS="dcell" ALIGN="center" STYLE="width:40%;"><HR CLASS="hbar"></TD><TD CLASS="dcell" ALIGN="center" STYLE="width:10%;">▼</TD><TD CLASS="dcell" ALIGN="center" STYLE="width:40%;"><HR CLASS="hbar"></TD><TD CLASS="dcell" ALIGN="center" STYLE="width:5%;">◤</TD></TR> </TABLE></TD><TD CLASS="dcell">  <TT>\underbrace</TT></TD></TR> </TABLE></TD><TD ALIGN=center NOWRAP><TABLE CLASS="display"><TR VALIGN="middle"><TD CLASS="dcell">    </TD><TD CLASS="dcell"><TABLE CLASS="display" STYLE="width:100%;"><TR><TD CLASS="dcell" ALIGN="center" STYLE="width:5%;">◢</TD><TD CLASS="dcell" ALIGN="center" STYLE="width:40%;"><HR CLASS="hbar"></TD><TD CLASS="dcell" ALIGN="center" STYLE="width:10%;">▲</TD><TD CLASS="dcell" ALIGN="center" STYLE="width:40%;"><HR CLASS="hbar"></TD><TD CLASS="dcell" ALIGN="center" STYLE="width:5%;">◣</TD></TR> <TR><TD CLASS="dcell" ALIGN="center" COLSPAN="5">1 × 2 × ⋯ × <I>n</I></TD></TR> <TR><TD CLASS="dcell" ALIGN="center" COLSPAN="5"> </TD></TR> </TABLE></TD><TD CLASS="dcell">  <TT>\overbrace</TT></TD></TR> </TABLE></TD></TR> </TABLE></TD></TR> </TABLE><P> And arrow “accents”: </P><TABLE CLASS="display dcenter"><TR VALIGN="middle"><TD CLASS="dcell"><TABLE CELLSPACING=6 CELLPADDING=0><TR><TD ALIGN=center NOWRAP><TABLE CLASS="display"><TR VALIGN="middle"><TD CLASS="dcell">    </TD><TD CLASS="dcell"><TABLE CLASS="display" STYLE="width:100%;"><TR><TD CLASS="dcell" ALIGN="center" STYLE="width:10%;">◂</TD><TD CLASS="dcell" ALIGN="center" STYLE="width:90%;"><HR CLASS="hbar"></TD></TR> <TR><TD CLASS="dcell" ALIGN="center" COLSPAN="2">1 × 2 × ⋯ × <I>n</I></TD></TR> <TR><TD CLASS="dcell" ALIGN="center" COLSPAN="2"> </TD></TR> </TABLE></TD><TD CLASS="dcell">  <TT>\overleftarrow</TT></TD></TR> </TABLE></TD><TD ALIGN=center NOWRAP><TABLE CLASS="display"><TR VALIGN="middle"><TD CLASS="dcell">    </TD><TD CLASS="dcell"><TABLE CLASS="display" STYLE="width:100%;"><TR><TD CLASS="dcell" ALIGN="center" STYLE="width:90%;"><HR CLASS="hbar"></TD><TD CLASS="dcell" ALIGN="center" STYLE="width:10%;">▸</TD></TR> <TR><TD CLASS="dcell" ALIGN="center" COLSPAN="2">1 × 2 × ⋯ × <I>n</I></TD></TR> <TR><TD CLASS="dcell" ALIGN="center" COLSPAN="2"> </TD></TR> </TABLE></TD><TD CLASS="dcell">  <TT>\overrightarrow</TT></TD></TR> </TABLE></TD></TR> </TABLE></TD></TR> </TABLE><H3 CLASS="subsection"><A NAME="toc70"></A><A NAME="htoc89">B.7.7</A>  Spacing</H3><P><A NAME="spacemathref"></A> <A NAME="@default168"></A> By contrast with L<sup>A</sup>T<sub>E</sub>X, space in the input matters in math mode. One or more spaces are translated to one space. Furthermore, spaces after commands (such as <CODE>\alpha</CODE>) are echoed except for invisible commands (such as <CODE>\tt</CODE>). This allows users to control space in their formulas, output being near to what can be expected.</P><P>Explicit spacing commands (<CODE>\,</CODE>, <CODE>\!</CODE>, <CODE>\:</CODE> and <CODE>\;</CODE>) are recognized, the first two commands do nothing, while the others two output one space.</P><H3 CLASS="subsection"><A NAME="toc71"></A><A NAME="htoc90">B.7.8</A>  Changing Style</H3><P>Letters are italicized inside math mode and this cannot be changed. The appearance of other symbols can be changed using L<sup>A</sup>T<sub>E</sub>X 2є style changing commands (<CODE>\mathbf</CODE>, etc.). The commands <CODE>\boldmath</CODE> and <CODE>\unboldmath</CODE> are not recognized. Whether symbols belonging to the symbol font are affected by style changes or not is browser dependent.</P><P>The <CODE>\cal</CODE> declaration and the <CODE>\mathcal</CODE> command (that yield calligraphic letters in L<sup>A</sup>T<sub>E</sub>X) exist. They yield red letters by default.</P><P>Observe that this does not corresponds directly to how L<sup>A</sup>T<sub>E</sub>X manage style in math mode and that, in fact, style cannot really change in math mode.</P><P>Math style changing declarations <CODE>\displaystyle</CODE> and <CODE>\textstyle</CODE> do nothing when H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A is already in the requested mode, otherwise they issue a warning. This is so because H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A implements displayed maths as tables, which require to be both opened and closed and introduce line breaks in the output. As a consequence, warnings on <CODE>\displaystyle</CODE> are to be taken seriously.</P><P>The commands <CODE>\scriptstyle</CODE> and <CODE>\scriptscriptstyle</CODE> perform type size changes.</P><HR> <A HREF="manual028.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A> <A HREF="manual022.html"><IMG SRC="contents_motif.gif" ALT="Up"></A> <A HREF="manual030.html"><IMG SRC="next_motif.gif" ALT="Next"></A> </BODY> </HTML>