-
Notifications
You must be signed in to change notification settings - Fork 95
Export to Typst/Fletcher diagram #262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…eaks moving cells.
@varkor Couple questions if you have time for them. At this point I've implemented Typst rendering, but the (AFAIK only) library is very bare bones so I've had to work around some minor issues. Notably, concurrent renders seem to break the library but I've implemented a queue for the rendering, which is quick enough to work as a permanent solution. Onto real issues:
Do you have an idea about the possible cause of these breakages ? Cheers |
Line 550 in 4fee690
This call is returning EDIT: Fixed, see commit below. |
Thanks for the pull request! I must admit that it hadn't occurred to me that Typst has different syntax for mathematics than LaTeX, which makes support for Typst subtler. I suppose it will be necessary to have a toggle in the UI for LaTeX/Typst mode – I'll have to think about how to do that without complicating the UI too much.
Unfortunately, the timing is a little inconvenient, as I'm about to go on a research trip for a few weeks, and don't yet know whether I'll have time to look at this in detail before I get back. However, if I don't manage to look at it during my trip, it will be a priority for me once I return. I'll try to answer any questions you have in the meantime, though. |
Thanks for your time ! Regarding the second point, this was actually all addressed in the latest commit which makes me confident this is close to releasable. Don't worry about the timing though, I can just host the fork somewhere in the meantime. What's left (for me) to do:
|
That's it, I'm calling it releasable ! Let me know what you think. |
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: jingkaimori <jingkaimori@gmail.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Lines 6901 to 6904 in 82aaf18
|
This list is only ever filled up when importing LaTeX macros and when those macros contain shorthands for color definitions (if I read the code correctly). I guess it would make sense to hide this list when in Typst mode, as there is currently no way to import Typst macros (although this wouldn't be too hard to implement since we use the actual typst compiler with a predefined preamble). A note for implementation if going in that direction: in a macro list, we can retrieve variable names via standard matching (e.g. I say in the current state of things, this list can remain hidden in Typst mode. I'm also wondering if it's not worth hiding the Typst export button when in LaTeX mode. This would allow in the future to add buttons for fletcher import and typst macro import without having too much clutter in the bottom bar. Exporting a fletcher diagram from a LaTeX one will also almost always yield incorrect maths syntax (although that can be dealt with using the typst package |
IMO importing external typst content could be implemented in another pr.
I agree with this. And mode toggling button could be moved to bottom bar, so that things related to label rendering appears together. Solved content
Default mode applied to input is differ between KaTeX and typst. In KaTeX, input is considered as if in math mode, but in typst, input is treated as normal text. In this pr, a wrapper is applied automatically when typst is selected as renderer. Therefore changing label to text mode needs unnecessary wrapper. Line 325 in 82aaf18
Line 5610 in 82aaf18
But according to #45 (comment) such wrapper should be applied by user. |
I'm now back from my trip and plan to review this soon. Feel free to ping me in a couple of weeks if I haven't gotten round to it by then. |
I've implemented initial support to export to Typst diagrams. Incompatibilities are reported through the incompatibilities metadata object (that is: shortened arrows, empty arrow body, and k-cells for k > 1)
This still needs some UI adjustments to show the incompatibilities and instructions just like with latex.
I marked this as Draft because I feel like this feature cannot be fully used as-is since I haven't implemented in-browser rendering of the formulas. Looking into how to do that with
typst.ts
.Feel free to leave comments and to try this out. Diagrams should be readily useable with
at a document's start.