Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/angle-to-chevron.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tex-to-typst": patch
---

Replace deprecated `angle.l`/`angle.r` output with `chevron.l`/`chevron.r` for `\langle`, `\rangle`, and `\left\langle`/`\right\rangle`.
8 changes: 4 additions & 4 deletions src/macros.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const typstMacros: Record<string, string | ((state: IState, node: LatexNo
if (left === 'lbrack') return '[';
if (left === 'vert' || left === 'lvert') return '|';
if (left === 'Vert' || left === 'lVert') return 'bar.v.double';
if (left === 'langle') return 'angle.l';
if (left === 'langle') return 'chevron.l';
if (left === 'lfloor') return 'floor.l';
if (left === 'lceil') return 'ceil.l';
throw new Error(`Undefined left bracket: ${left}`);
Expand All @@ -146,7 +146,7 @@ export const typstMacros: Record<string, string | ((state: IState, node: LatexNo
if (right === 'rbrack') return ']';
if (right === 'vert' || right === 'rvert') return '|';
if (right === 'Vert' || right === 'rVert') return 'bar.v.double';
if (right === 'rangle') return 'angle.r';
if (right === 'rangle') return 'chevron.r';
if (right === 'rfloor') return 'floor.r';
if (right === 'rceil') return 'ceil.r';
throw new Error(`Undefined right bracket: ${right}`);
Expand Down Expand Up @@ -247,8 +247,8 @@ export const typstMacros: Record<string, string | ((state: IState, node: LatexNo
prod: 'product',
lfloor: 'floor.l',
rfloor: 'floor.r',
langle: 'angle.l',
rangle: 'angle.r',
langle: 'chevron.l',
rangle: 'chevron.r',
implies: 'arrow.r.double.long',
notin: 'not in',
' ': '" "',
Expand Down
8 changes: 7 additions & 1 deletion tests/math.yml
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,19 @@ cases:
typst: 'diff_(bracket.l i) f_(j bracket.r)'
- title: angle
tex: '\langle A \rangle'
typst: 'angle.l A angle.r'
typst: 'chevron.l A chevron.r'
- title: left right angle
tex: '\left\langle A \right\rangle'
typst: 'chevron.l A chevron.r'
- title: horizontal space
tex: '\hspace{1cm}'
typst: '#h(1cm)'
- title: text with spaces
tex: '\text{ Hello !!}'
typst: '" Hello !!"'
- title: text
tex: '\text{text}'
typst: '"text"'
- title: mathsf
tex: '\mathsf{k}'
typst: 'sans(k)'
Expand Down
Loading