youfoundjk_TeXcore/docs/features/equations.md

95 lines
3.9 KiB
Markdown
Raw Permalink Normal View History

# Equation & Sub-Equation Numbering
2026-01-21 19:08:11 +00:00
The core engine of TeXcore provides automatic equation numbering using LaTeX `\tag{}` commands, allowing you to generate academic-grade numbering schemes inside Obsidian. This feature is heavily integrated with the plugin's [Autocomplete System](search.md) and [Quick Hover Previews](quick-preview.md) to keep references synchronized in both Live Preview and Reading View.
2026-01-21 19:08:11 +00:00
---
2026-01-21 19:08:11 +00:00
## Defining Equation Identifiers
Unlike Obsidian's standard markdown block references which append identifiers at the end of elements, TeXcore indexes equations using LaTeX comments inside the display math block. Add a `% id: eq-name` comment line immediately before the closing `$$` delimiter. The prefix `eq-` is required, followed by alphanumeric characters or hyphens.
2026-01-21 19:08:11 +00:00
```latex
$$
E = mc^2
% id: eq-einstein (1)
2026-01-21 19:08:11 +00:00
$$
```
1. This comment is invisible in the final rendered note but is parsed by TeXcore's background indexing system to build the active note cache.
2026-01-21 19:08:11 +00:00
---
2026-01-21 19:08:11 +00:00
## Lazy Numbering Mechanism
2026-01-21 19:08:11 +00:00
To keep your document layout clean, TeXcore uses **lazy numbering** by default. An equation is only assigned a right-aligned number tag if it is actively referenced somewhere in the vault. If the equation is not referenced, no tag is injected, keeping margins clear. You can disable this behavior to force-number all equations in the [Settings Reference](configuration/settings.md#number-only-referenced-equations).
2026-01-21 19:08:11 +00:00
=== "1. Editor Code"
Write the math block and reference it inline using Obsidian double brackets:
```latex
$$
E = mc^2
% id: eq-einstein
$$
As shown in [[#^eq-einstein]], mass is equivalent to energy.
```
2026-01-21 19:08:11 +00:00
=== "2. Generated Output"
The compiler automatically appends the `\tag{}` macro and renders the link with the assigned index:
$$
E = mc^2 \tag{1}
$$
As shown in [(1)](#), mass is equivalent to energy.
2026-01-21 19:08:11 +00:00
---
2026-01-21 19:08:11 +00:00
## Numbering Customization
2026-01-21 19:08:11 +00:00
Configure the layout of your math indices globally via the [Settings Panel](configuration/settings.md#equation-numbering-referencing). Numbering formats support a variety of typographic styles, prefixes, and suffixes.
2026-01-21 19:08:11 +00:00
### Number Styles Matrix
2026-01-21 19:08:11 +00:00
| Style Name | Description | Output Example |
| :--- | :--- | :--- |
| `arabic` | Standard Hindu-Arabic numerals. | `(1)`, `(2)`, `(3)` |
| `alph` | Lowercase Latin alphabetical indexing. | `(a)`, `(b)`, `(c)` |
| `Alph` | Uppercase Latin alphabetical indexing. | `(A)`, `(B)`, `(C)` |
| `roman` | Lowercase Roman numerals. | `(i)`, `(ii)`, `(iii)` |
| `Roman` | Uppercase Roman numerals. | `(I)`, `(II)`, `(III)` |
2026-01-21 19:08:11 +00:00
!!! info "Prefixes & Suffixes"
Prepending prefixes (e.g., `Eq.`) or appending suffixes (e.g., `.`) will modify the output. For example, a prefix of `Eq.` with style `arabic` renders as `(Eq.1)`. A suffix of `.` renders as `(1.)`. See [Reference Link Customization](configuration/settings.md#reference-link-prefix) for additional details.
2026-01-21 19:08:11 +00:00
---
2026-01-21 19:08:11 +00:00
## Sub-Equation System
2026-01-21 19:08:11 +00:00
Multi-line equations (such as systems of equations using LaTeX `align` or split blocks) can be individually referenced using sub-indices. Reference rows sequentially by appending the row number to the parent ID:
2026-01-21 19:08:11 +00:00
```latex
$$
\begin{aligned}
2026-01-21 19:08:11 +00:00
a &= b + c \\
d &= e + f
\end{aligned}
2026-01-21 19:08:11 +00:00
% id: eq-system
$$
Referencing row 1: [[#^eq-system-1]]
Referencing row 2: [[#^eq-system-2]]
2026-01-21 19:08:11 +00:00
```
The plugin automatically parses the structure and appends sub-tags such as `\tag{1.1}` to the first equation line and `\tag{1.2}` to the second.
2026-01-21 19:08:11 +00:00
---
2026-01-21 19:08:11 +00:00
## Inserting References
2026-01-21 19:08:11 +00:00
To reference an equation quickly, type your trigger (default is `\eqref`) to activate the autocomplete dialog. Use your keyboard arrow keys to scroll, and press ++enter++ to insert the formatted wiki-link.
2026-01-21 19:08:11 +00:00
!!! tip "Jump-to-Equation Shortcut"
Holding the ++ctrl++ key (or ++cmd++ on macOS) while pressing ++enter++ on a suggestion in the autocomplete list will instantly jump your cursor to the equation definition instead of inserting the link.