Skip to content

Commit b1964e2

Browse files
staredclaude
andcommitted
Add Typst export with color variable definitions
Implements Typst export functionality using the tex2typst library for LaTeX-to-Typst conversion. Defines colors as variables at the top of the document and references them throughout, following best practices: // Color definitions #let termexponential = rgb("#e6194B") #let termimaginary = rgb("#3cb44b") ... // Referenced in equation and text $ #text(fill: termexponential)[$e$]^... $ The tex2typst library (v0.4.1) was chosen after testing because it natively handles \textcolor commands and converts them to proper Typst syntax. The implementation: 1. Preprocesses \htmlClass{term-X}{content} to \textcolor{#hex}{content} 2. Converts LaTeX to Typst using tex2typst 3. Post-processes to replace inline rgb() calls with variable references Adds Typst export button to the UI export menu. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 87ff3a4 commit b1964e2

File tree

4 files changed

+657
-5
lines changed

4 files changed

+657
-5
lines changed

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ <h1 id="equation-title">Interactive Equations</h1>
6464
<button class="export-option" data-format="html">HTML</button>
6565
<button class="export-option" data-format="latex">LaTeX</button>
6666
<button class="export-option" data-format="beamer">Beamer</button>
67+
<button class="export-option" data-format="typst">Typst</button>
6768
</div>
6869
</div>
6970
<button id="copy-btn" class="toolbar-btn" title="Copy to clipboard">Copy</button>

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
"dependencies": {
3838
"codejar": "^4.3.0",
3939
"katex": "^0.16.25",
40-
"prismjs": "^1.30.0"
40+
"prismjs": "^1.30.0",
41+
"tex-to-typst": "^0.0.19",
42+
"tex2typst": "^0.4.1"
4143
}
4244
}

0 commit comments

Comments
 (0)