-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Use Unicode in Typst #232
Comments
No, there isn't. In principle, it could be added, but this would require:
On balance I don't think it's worth the effort and extra complexity. |
Thanks for your response! I would like to expand on my initial request to provide more context. Since math rendering in HTML supports so many flags, I thought it would be trivial to include a I do find it a bit odd that even ASCII characters like My understanding is that Typst named symbols are just shortcuts to the underlying Unicode characters. I had the chance to look at the -- src/Text/TeXMath/Writers/Typst.hs#L58
writeExp (ESymbol _t s) =
maybe (esc s) id $ M.lookup s typstSymbolMap to writeExp (ESymbol _t s) = esc s Then, I recompiled pandoc with the patched dependency to obtain the desired effect. It works pretty well except for If my understanding that Typst uses Unicode is correct, then converting symbols to Unicode is much less complex and error prone. Typst symbols are more likely to change than the Unicode characters, so Unicode would be more robust. However, if changes in this direction add unnecessary complexity and, especially, requires too much effort I agree that it's not worth the investment. Although, it would be a missed opportunity. |
Yes, that's definitely odd, and I can change that in the default behavior. (Avoiding symbol names when the code point is in the ASCII range.) The change is certainly possible, but it's not trivial. We'd need some mechanism in pandoc to communicate the option to the typst writer in texmath. I would prefer to avoid a new command line option. And I would prefer to avoid any new complexity; that's where bugs come from. Producing typst that resembles examples from the typst documentation seems like a good goal, and that's what we aim at. |
I agree that Typst documentation tends to favour the use of named symbols, even though it natively supports UTF-8 characters and named symbols are nothing more than sugar for their UTF-8 representation. I believe that this is to cater to users who might find it difficult to input non-ASCII characters, are coming from LaTex and/or might have problems installing UTF-8 fonts. The only mention to UTF-8 input in Typst documentation is in this section of the documentation which is one the things that sold Typst to me.
In any case, Typst documentation is probably outside of the scope of this issue. If you have to make a choice, I agree that you have to pick one option consistently. However, is there anyway I could write a Pandoc filter to avoid calling the conversion to named symbols in the function below? -- src/Text/TeXMath/Writers/Typst.hs#L58
writeExp (ESymbol _t s) =
maybe (esc s) id $ M.lookup s typstSymbolMap I would be happy to live with a Pandoc filter. Certainly better than a patched Pandoc. I'm just not sure how to go about it. Any advice would be super-helpful. |
No, this can't be done with a filter. A filter can only play with the pandoc AST; it can't adjust the output of texmath functions. |
I'd prefer if math converted to Typst used Unicode characters which is supported by Typst.
For instance, the following conversion transforms all elements of the equation into text.
When I would prefer the output that we obtain when converting to plain for instance which is more readable.
Is there any way to force pandoc to use Unicode first?
The text was updated successfully, but these errors were encountered: