JezK
Edit File: Inserting-Math.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- This manual is for GNU Texinfo (version 6.8, 8 June 2021), a documentation system that can produce both online information and a printed manual from a single source using semantic markup. Copyright (C) 1988, 1990-1993, 1995-1999, 2001-2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". --> <title>Inserting Math (GNU Texinfo 6.8)</title> <meta name="description" content="Inserting Math (GNU Texinfo 6.8)"> <meta name="keywords" content="Inserting Math (GNU Texinfo 6.8)"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="texi2any"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link href="index.html" rel="start" title="Top"> <link href="Command-and-Variable-Index.html" rel="index" title="Command and Variable Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="Insertions.html" rel="up" title="Insertions"> <link href="Glyphs-for-Text.html" rel="next" title="Glyphs for Text"> <link href="Inserting-Subscripts-and-Superscripts.html" rel="prev" title="Inserting Subscripts and Superscripts"> <style type="text/css"> <!-- a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em} a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} span:hover a.copiable-anchor {visibility: visible} ul.no-bullet {list-style: none} --> </style> </head> <body lang="en"> <div class="section" id="Inserting-Math"> <div class="header"> <p> Next: <a href="Glyphs-for-Text.html" accesskey="n" rel="next">Glyphs for Text</a>, Previous: <a href="Inserting-Subscripts-and-Superscripts.html" accesskey="p" rel="prev"><code>@sub</code> and <code>@sup</code>: Inserting Subscripts and Superscripts</a>, Up: <a href="Insertions.html" accesskey="u" rel="up">Special Insertions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Command-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> </div> <hr> <span id="g_t_0040math-and-_0040displaymath_003a-Formatting-Mathematics"></span><h3 class="section">11.7 <code>@math</code> and <code>@displaymath</code>: Formatting Mathematics</h3> <span id="math"></span><span id="index-math"></span> <span id="index-Mathematical-expressions_002c-inserting"></span> <span id="index-Formulas_002c-mathematical"></span> <p>You can write a short mathematical expression with the <code>@math</code> command. Write the mathematical expression between braces, like this: </p> <div class="example"> <pre class="example">@math{\sin 2\pi \equiv \cos 3\pi} </pre></div> <p>which looks like this: </p><div class="display"> <pre class="display"><em class='math'>\sin 2\pi \equiv \cos 3\pi</em> </pre></div> <p>The <code>@math</code> command has no special effect on the Info output or (by default) the HTML output, merely outputting the contents verbatim. </p> <p>For the TeX output, <code>@math</code> switches into math mode. This allows you to use all the plain TeX math control sequences for symbols, functions, and so on, starting with ‘<samp>\</samp>’. It’s best to use ‘<samp>\</samp>’ instead of ‘<samp>@</samp>’ for any such mathematical commands; otherwise, <code>texi2any</code> will complain. </p> <span id="index-Math-output-for-HTML"></span> <p>By default, the HTML output is only enclosed by <code><em></code>. <code>texi2any</code> provides three options for displaying properly formatted mathematics for HTML. You can select these with the <code>HTML_MATH</code> variable (see <a href="HTML-Customization-Variables.html">HTML Customization Variables</a>). With <code>HTML_MATH</code> set to ‘<samp>l2h</samp>’, <code>texi2any</code> attempts to use the <code>latex2html</code> program to produce image files for mathematical material. With the ‘<samp>t4h</samp>’ setting, <code>texi2any</code> attempts to use the <code>tex4ht</code> program. With the ‘<samp>mathjax</samp>’ setting, <code>texi2any</code> inserts references in the output files to MathJax scripts to format the material. The MathJax option requires JavaScript to be enabled in the browser to work. See also <a href="MathJax-Customization-Variables.html">MathJax Customization Variables</a> and <a href="latex2html-Customization-Variables.html"><code>latex2html</code> Customization Variables</a>. </p> <span id="index-Displayed-equations"></span> <span id="index-Equations_002c-displayed"></span> <span id="index-displaymath"></span> <p>For displayed equations, you can use the <code>@displaymath</code> command. Example: </p> <div class="example"> <pre class="example">@displaymath f(x) = {1\over\sigma\sqrt{2\pi}} e^{-{1\over2}\left({x-\mu\over\sigma}\right)^2} @end displaymath </pre></div> <p>which produces: </p> <div class="displaymath"><em>f(x) = {1\over\sigma\sqrt{2\pi}} e^{-{1\over2}\left({x-\mu\over\sigma}\right)^2} </em></div> <p>Although <code>@sub</code> and <code>@sup</code> may work inside math mode in some contexts, it is better to use TeX’s ‘<samp>_</samp>’ and ‘<samp>^</samp>’ characters to denote subscripts and superscripts within mathematical expressions. In general, the contents of <code>@math</code> or <code>@displaymath</code> should be plain TeX only, with no interspersed Texinfo commands. </p> <span id="index-_005cmathopsup"></span> <p>Due to the conflict with Texinfo’s <code>@sup</code> command, you can access the plain TeX command <code>\sup</code> as <code>\mathopsup</code> instead, in the unlikely occurrence that you want to do this (but only when processing with TeX, not with any of the <code>HTML_MATH</code> options). </p> </div> <hr> <div class="header"> <p> Next: <a href="Glyphs-for-Text.html">Glyphs for Text</a>, Previous: <a href="Inserting-Subscripts-and-Superscripts.html"><code>@sub</code> and <code>@sup</code>: Inserting Subscripts and Superscripts</a>, Up: <a href="Insertions.html">Special Insertions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Command-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> </div> </body> </html>