tex2typst 0.1.3__cp310-cp310-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tex2typst/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ from .tex2typst import *
2
+
3
+ __doc__ = tex2typst.__doc__
4
+ if hasattr(tex2typst, "__all__"):
5
+ __all__ = tex2typst.__all__
tex2typst/__init__.pyi ADDED
@@ -0,0 +1,69 @@
1
+ def tex2typst(
2
+ tex: str,
3
+ *,
4
+ non_strict: bool | None = None,
5
+ prefer_shorthands: bool | None = None,
6
+ keep_spaces: bool | None = None,
7
+ frac_to_slash: bool | None = None,
8
+ infty_to_oo: bool | None = None,
9
+ optimize: bool | None = None,
10
+ custom_tex_macros: dict[str, str] | None = None,
11
+ ) -> str:
12
+ """
13
+ Convert LaTeX/TeX math to Typst format.
14
+
15
+ This function uses a thread-local lazy singleton pattern - the converter is
16
+ initialized only on the first call within each thread, avoiding import-time overhead.
17
+
18
+ Args:
19
+ tex: LaTeX/TeX math string to convert
20
+ non_strict: Allow non-strict parsing (default: library default)
21
+ prefer_shorthands: Prefer shorthand notation (default: library default)
22
+ keep_spaces: Preserve spaces in output (default: library default)
23
+ frac_to_slash: Convert fractions to slash notation (default: library default)
24
+ infty_to_oo: Convert infinity symbol to oo (default: library default)
25
+ optimize: Optimize output (default: library default)
26
+ custom_tex_macros: Custom TeX macro definitions as dict mapping macro names to expansions
27
+
28
+ Returns:
29
+ Converted Typst string
30
+
31
+ Examples:
32
+ >>> import tex2typst
33
+ >>> tex2typst.tex2typst(r"\\frac{1}{2}")
34
+ '1/2'
35
+ >>> tex2typst.tex2typst(r"\\alpha + \\beta")
36
+ 'alpha + beta'
37
+ >>> tex2typst.tex2typst(r"\\frac{1}{2}", frac_to_slash=False)
38
+ 'frac(1, 2)'
39
+ >>> tex2typst.tex2typst(r"\\infty", infty_to_oo=True)
40
+ 'oo'
41
+ >>> tex2typst.tex2typst(r"\\myop", custom_tex_macros={"\\\\myop": "\\\\operatorname{myop}"})
42
+ 'op("myop")'
43
+ """
44
+ ...
45
+
46
+ def typst2tex(typst: str, *, block_math_mode: bool | None = None) -> str:
47
+ """
48
+ Convert Typst math to LaTeX/TeX format.
49
+
50
+ This function uses a thread-local lazy singleton pattern - the converter is
51
+ initialized only on the first call within each thread, avoiding import-time overhead.
52
+
53
+ Args:
54
+ typst: Typst math string to convert
55
+ block_math_mode: Use block math mode (default: library default)
56
+
57
+ Returns:
58
+ Converted LaTeX/TeX string
59
+
60
+ Examples:
61
+ >>> import tex2typst
62
+ >>> tex2typst.typst2tex("1/2")
63
+ '\\\\frac{1}{2}'
64
+ >>> tex2typst.typst2tex("alpha + beta")
65
+ '\\\\alpha + \\\\beta'
66
+ >>> tex2typst.typst2tex("x", block_math_mode=False)
67
+ 'x'
68
+ """
69
+ ...
tex2typst/py.typed ADDED
File without changes
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: tex2typst
3
+ Version: 0.1.3
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
7
+ Author-email: PuQing <me@puqing.work>
8
+ Requires-Python: >=3.8
9
+ Project-URL: Repository, https://github.com/AndPuQing/tex2typst-py
@@ -0,0 +1,8 @@
1
+ tex2typst-0.1.3.dist-info/METADATA,sha256=4sVHyUSzeQrmQPhuSrNvbZuFl57O7NNXFifECFitzYY,363
2
+ tex2typst-0.1.3.dist-info/WHEEL,sha256=yFskrBWPDwq03Xxddaw2JX8WaptRbPN3c5a2yjKgKys,108
3
+ tex2typst.libs/libgcc_s-98a1ef30.so.1,sha256=XOVRhHznCIpbSdhFoozhla-OfRqBtXftKPQ4cSMKjrs,433441
4
+ tex2typst/__init__.py,sha256=hdHISh_3fOzQztFUV-4xjq50nofgn5ns3QLsyXqrZgA,119
5
+ tex2typst/__init__.pyi,sha256=4YUlyzcPwzcZEx2-h12Do7Z37gvlE9cCMCUXfxiGcPQ,2435
6
+ tex2typst/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ tex2typst/tex2typst.cpython-310-x86_64-linux-gnu.so,sha256=KLGII-veYN5nIpUFaVRocDoplyOGSMEv0EzkeScoCpU,1796913
8
+ tex2typst-0.1.3.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.10.2)
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-cp310-musllinux_1_2_x86_64
Binary file