This is the usage guide for Heine, a compact math notation that transpiles to LaTeX.
Atoms are the basis building block of Heine expressions. They come in many flavors.
Symbols mainly represent letters and operators.
Latin letters stand for themselves.
Example | Output |
---|---|
|
Greek letters are abbreviated by the first two letters of their English name. If a letter has two variants, add an asterisk to choose the other variant.
Example | Output |
---|---|
|
Common blackboard-bold letters can be produced by duplicating the letter.
Example | Output |
---|---|
|
Other symbols each have their own code. Usually it's two or three characters long. A list will be provided in the future.
Example | Output |
---|---|
|
To produce multiple consecutive symbols without any punctuation between them, use a space.
Example | Output |
---|---|
|
Numbers can be entered as-is, including negative numbers and numbers with a decimal point.
Example | Output |
---|---|
|
A convenient shortcut can be used for exponential notation.
Example | Output |
---|---|
|
Would you like to use a LaTeX command for which Heine doesn't have a shorthand? No problem! Just enter it with the usual notation.
Example | Output |
---|---|
|
To produce some regular text, simply surround it in quotes.
Example | Output |
---|---|
|
Commas and semicolons can be used as separators, without requiring any spaces. However, if they're followed by a space, they produce a longer space in the output.
Example | Output |
---|---|
|
Example | Output |
---|---|
|
An expression can be surrounded by various delimiters, which also turns it into a single atom. Note that curly braces have to be preceded by backslashes to distinguish them from a group; they can also be used to create a set comprehension. Unlike LaTeX, delimiters automatically adjust their size.
Example | Output |
---|---|
|
Note that delimiters may not contain interior whitespace.
A fraction or binomial coefficient consists of /
or ncr
, respectively, followed by two atoms without whitespace in front.
Example | Output |
---|---|
|
A square root is produced with sq
followed by one atom. A generic root uses rt
followed by two atoms. Just like with fractions, there must not be whitespace in between.
Example | Output |
---|---|
|
To create a simple matrix, use the word mt
followed by the desired delimiters (or curly braces for no delimiters). Inside the delimiters, insert the contents of the matrix, with &
to separate entries in a row and \\
to separate rows.
Example | Output |
---|---|
|
The notation cs{}
can be used for case branching. Use \\
to separate cases and &
to separate the condition from the result.
Example | Output |
---|---|
|
This feature allows passing arbitrary text to the code which is using Heine as a library, allowing it to add extend the capabilities of Heine. They're disabled by default.
Extensions are invoked by using a backslash followed by any content enclosed in square brackets. The content may contain square brackets too, as long as they're balanced.
In xidoc, this feature is used for executing xidoc commands inside Heine code.
Example | Output |
---|---|
|
When using Heine as a library, extensions can be added by passing a function of type string -> string
to Heine. This function is invoked for every extension usage in Heine code, getting the text including the square brackets as an argument. The return value of the function determines the generated LaTeX code. (Not Heine code! You can compose your function with another invocation of heine
if that is the desired behavior.)
As an example, an extension which replaces the text with its length would be implemented like this:
# Subtracting 2 to account for the square brackets
let latex = heine(input, arg => $(arg.len - 2))
This could then be used like so:
Example | Output |
---|---|
|
Atoms can have various modifiers added to them by using a dot followed by a single character. There can be multiple modifiers on a single atom.
Example | Output |
---|---|
|
A superscript and/or subscript can be added to an atom by using the ^
or _
character respectively. As a special case, an apostrophe can be used to add a superscript prime.
Example | Output |
---|---|
|