Skip to content

Commit

Permalink
upgrade to tex2typst v0.2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
qwinsi committed Dec 8, 2024
1 parent 4008069 commit 8dcf572
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 60 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@qwinsi/clipboard-js": "^0.1.0",
"@qwinsi/vue-components": "^0.0.2",
"katex": "^0.16.11",
"tex2typst": "^0.2.11",
"tex2typst": "^0.2.12",
"vue": "^3.4.29"
},
"devDependencies": {
Expand Down
37 changes: 0 additions & 37 deletions public/impl-in-typst.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,44 +111,7 @@ <h2 id="latex-and-tex">The <code>\LaTeX</code> and <code>\TeX</code> macro</h2>
</li>
</ul>

<h2 id="floor-and-ceil">The <code>\lfloor</code>, <code>\rfloor</code>, <code>\lceil</code>, and <code>\rceil</code> macros</h2>

<p>
In Typst, there are <code>floor</code> and <code>ceil</code> functions to make the floor and ceiling symbols, respectively.
</p>
<ul>
<li>LaTeX: <code>\lfloor x \rfloor</code></li>
<li>Typst: <code>floor(x)</code></li>
<li>LaTeX: <code>\lceil x \rceil</code></li>
<li>Typst: <code>ceil(x)</code></li>
</ul>

<p>
However, you cannot use a separated left or right version of the symbols. e.g. There is no <code>lfloor</code> function in Typst.
If you really need them, you may define them directly using their Unicode characters as the following:
</p>



<ul>
<li>
Implementation in Typst
<pre><code>
#let lfloor = $⌊$;
#let rfloor = $⌋$;
#let lceil = $⌈$;
#let rceil = $⌉$;
</code></pre>
</li>
<li>
Usage example:
<pre><code>
$
y = lfloor x rceil
$
</code></pre>
</li>
</ul>

<h2 id="custom-operators">Using the <code>op</code> function to define custom operators</h2>
<p>
Expand Down
16 changes: 0 additions & 16 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,12 @@ const output = computed(() => {
if(tex.includes('\\TeX')) {
macros_to_define.push('#TeX');
}
if(typst.includes('lfloor')) {
macros_to_define.push('unpaired lfloor');
}
if(typst.includes('rfloor')) {
macros_to_define.push('unpaired rfloor');
}
if(typst.includes('lceil')) {
macros_to_define.push('unpaired lceil');
}
if(typst.includes('rceil')) {
macros_to_define.push('unpaired rceil');
}
let messages = [];
if(macros_to_define.length > 0) {
const map = new Map([
['scr', 'mathscr'],
['#LaTeX', 'latex-and-tex'],
['#TeX', 'latex-and-tex'],
['unpaired lfloor', 'floor-and-ceil'],
['unpaired rfloor', 'floor-and-ceil'],
['unpaired lceil', 'floor-and-ceil'],
['unpaired rceil', 'floor-and-ceil'],
]);
for(const macro of macros_to_define) {
const a_link = `<a href="impl-in-typst.html#${map.get(macro)}" target="_blank">${macro}</a>`;
Expand Down
4 changes: 2 additions & 2 deletions test/converter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const TYPST_EXAMPLE_FORMULAS = [
nabla dot.op bold(B) & = 0 \
nabla times bold(E) & = - frac(diff bold(B), diff t) \
nabla times bold(B) & = - mu_0 (bold(J) + epsilon frac(diff bold(E), diff t))`,
'upright(C H_3 C H_2 B r) + upright(O H)^- arrow.long upright(C H_3 C H_2 O H) + upright(B r)^-',
'upright(C H_3 C H_2 B r) + upright(O H)^- arrow.r.long upright(C H_3 C H_2 O H) + upright(B r)^-',
String.raw`yen 2000 > \$ 3000`,
'sum_(k = 1)^n frac(1, k) = ln n + gamma + O(frac(1, n))',
'e^(i x) = cos x + i sin x',
'integral.triple_Omega op("div")(arrow(F)) dif V = integral.surf_(diff Omega) arrow(F) dot.op dif arrow(S)',
'integral.double_Sigma op("curl")(arrow(F)) dot.op dif arrow(S) = integral.cont_(diff Sigma) arrow(F) times dif arrow(l)',
'pi(x) tilde frac(x, log x)',
'pi(x) tilde.op frac(x, log x)',
'i_D = mu_n C_"ox" frac(W, L) [(v_"GS" - V_t) v_"DS" - frac(1, 2) v_"DS"^2 ]',
String.raw`C & = N(d_1) S_t - N(d_2) K e^(-r t) \
d_1 & = frac(ln frac(S_t, K) +(r + frac(sigma^2, 2)) t, sigma sqrt(t)) \
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2720,10 +2720,10 @@ terser@^5.15.1:
commander "^2.20.0"
source-map-support "~0.5.20"

tex2typst@^0.2.11:
version "0.2.11"
resolved "https://registry.yarnpkg.com/tex2typst/-/tex2typst-0.2.11.tgz#df9570ec12b3a1e5da28954b3e13d748327bcc48"
integrity sha512-3LCrdnK8IXYdO1ekET+bi5c5OXxXsAis9e5Qyb9J2WXw3J3cmrPGH2vrTru8nQARtEfv3tDW8sKirnn1JFh0Pg==
tex2typst@^0.2.12:
version "0.2.12"
resolved "https://registry.yarnpkg.com/tex2typst/-/tex2typst-0.2.12.tgz#d81b8bf9e09e3d0de60b96f598aef9d5113c06e5"
integrity sha512-VReLZq95jS9gKrQDYCAlY16UdVYSMgQRy/YHxMQIwHcIvLfiqBQYdDmDWEKGJ/CCijyrcvtSBWUjY9s6z1gpqQ==

text-table@^0.2.0:
version "0.2.0"
Expand Down

0 comments on commit 8dcf572

Please sign in to comment.