\[ ... \]
Scripta User Guide
Mathematical text
Inline LaTeX
Inline mathematical text is written in the normal way, enclosed by dollar signs: $ … $. For currency in regular text, use \$.
 subscripts

＄a_1, \ldots, a_n＄
⇒ \(a_1, \ldots, a_n\).  superscripts

＄x^2 + y^2 = z^2 ＄
= \(x^2 + y^2 = z^2\)  Greek symbols

＄\alpha, \beta, ... \Omega＄
⇒ \(\alpha, \beta, ... \Omega \)  Special symbols

＄\int_0^1 x^n dx＄ ⇒ \(\int_0^1 x^n dx\),
＄\lim_{x \to 0} \frac{ \sin(x)}{x}＄ ⇒ \(\lim_{x \to 0} \frac{ \sin(x)}{x}\)
＄A \cap ( B \cup C)＄ ⇒ \(A \cap ( B \cup C)\)
Etc. See this list.  Grouping

＄10^{23} ＄
⇒ \(10^{23}\)
Displayed LaTeX
For displayed formulas you may use double dollar signs, but it is better to use a pair of braces:
 Matrices

\[ A = \left[ \begin{array} 11 & 2 \\ 3 & 4 \\ \end{array} \right] \] The matrix is rendered from the text
\[ A = \left[ \begin{array} 11 & 2 \\ 3 & 4 \\ \end{array} \right] \]
 Partial differential equations

\[  \frac{\hbar^2}{2m} \frac{\partial^2 \psi}{\partial x^2} + V\psi = i\hbar \frac{\partial \psi}{\partial t} \]
The source text is
\[ \frac{\hbar^2}{2m} \frac{\partial^2 \psi}{\partial x^2} + V\psi = i\hbar \frac{\partial \psi}{\partial t} \]
Environments
Environments in AsciidocLaTeX work much like LaTeX environments, but have a different syntax and are more general. There are the typical mathematical environments (theorem, definition, equation, etc.), but also environments for chemical formulas and reactions as well as code listings. Here is a typical use for mathematics:
[env.theorem]  A line is the shortest path between two points. 
It renders as
You may label an environment for cross referencing, as in this example:
[env.definition#defpoint]  A point is that which has no breadth 
It renders as
The text after the hash mark is the label, or identifier.
To make the cross reference, enclose the label in double pointy brackets with no space:
"The professor harrumphed haughtily: I refer you to <<defpoint>>."
renders as
"The professor, harrumphed haughtily: I refer you to Definition 1."
Note that the the text "Definition 1" is a link.
Environments can contain LaTeX, as in the next example:
Special environments
There are a number of special environments
whose content is processed differently from
env.theorem
, env.definition
, etc.
It is generally better to use env.equation
for
displayed equations: if you want them to be
numbered for later reference, just add
an identifier. Here is an example without
an identifier:
\[ x^2 + y^2 = z^2 \] 
[env.equation]  x^2 + y^2 = z^2 
And here is an equation with an identifier:
\[ x^d + y^d = z^d \]  (1) 
[env.equation#fermat]  x^d + y^d = z^d 
Note that putting an identifier (#fermat
) "turns on" the automatic
numbering.
One often needs to write aligned sets of equations, like these:
\[\begin{split} (a + b)^2 &= a^2 + 2ab + b^2 \\ (a + b)^3 &= a^3 + 3a^2b + 3ab^2 + b^3 \end{split}\]  (2) 
Here is the source code:
[env.equationalign#binomials]  (a + b)^2 &= a^2 + 2ab + b^2 \\ (a + b)^3 &= a^3 + 3a^2b + 3ab^2 + b^3 
Macros
You can use your own macros in a Scripta document. There are two ways to do this. The first is to add macros to the section you are working on like this:
[env.texmacro]  \def\QQ{\mathbb{Q}} \def\ZZ{\mathbb{Z}} \newcommand{\set}[1]{ \{\,#1\, \} } \newcommand{\sett}[2]{ \{\,#1\, \mid\, #2\, \} } 
Then, if you write using the source code
\[ \QQ = \sett{ a/b }{ a, b \in \ZZ, b \ne 0} \]
the rendered text will be \[ \QQ = \sett{ a/b }{ a, b \in \ZZ, b \ne 0} \]
The env.texmacros
hack is quick and dirty, but has the disadvantage
that the macros only work in the section in which they live.
A better solution is to put all of your macro definitions in
a special document, the texmacros
document. To set up the
texmacros
document, proceed as follows:

Select the document title at the top of the table of contents

Click on the "add associated document" tool .

In the form that comes up, enter "Tex Macros" for the type and "texmacros" for the type. Paste your tex macros in the window that appears below these two items.

Click update.
You can edit texmacros any time. The macros you put in it are available to all sections of the document.
Documents not found.