-
Notifications
You must be signed in to change notification settings - Fork 83
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
Equation support #84
Comments
Kramdown currently uses tex2mail for the ASCII part.
(e.g., see https://datatracker.ietf.org/doc/draft-ietf-core-senml-versions/ .)
I’ll check the tools you mentioned, right after the IETF!
Grüße, Carsten
… On 2020-11-16, at 11:24, Lars Eggert ***@***.***> wrote:
I wonder if it would be possible to add some sort of support for rendering equations in ASCII and SVG, with asciitex and tex2svg, respectively. They take (more or less) the same input format, and produce reasonable-looking outputs.
For example, this input
K = \sqrt[3]{W_{max} * \dfrac{1 - \beta_{cubic}}{C}}
renders to the following ASCII
________________________
/ 1 - beta
3 / cubic
K = | / W * ---------------
|/ max C
and this SVG
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
tex2mail produces uglier output:
|
asciitex is rather limited (it can't do tilde, cdot, ...). So in many cases you'd essentially have to provide two different inputs for asciitex and tex2svg. tex2svg's output also is super-ugly in the context of an RFC (only slightly less so with STIX fonts). Hmm. I've put up a prototype, subject to change, as 1.3.17,
(this will migrate into markdown equations, but putting this into the codeblocks was easier to prototype right now). |
Thanks, will test! (Will be in a week, vacation coming up.) If asciitex is too limited, is it possible to separately specify different figure variants in the markdown, e.g., one that gets rendered via tex2svg for rendering in HTML and a fallback one that has handcrafted ASCII-art for rendering in text? |
This is pretty much a specific version of the generalized question "what about |
Well, you could do something like
and basically only render the one that matches the desired output. But it's of course ugly. |
kramdown-rfc doesn't know what the desired output is. It only can create an The SMOP (small matter of programming) is recognizing adjacent figures and munching them into an artset. (Downside: I really would like to use
style equations, |
I'd need |
Could you require them to have the same title, anchor or better yet some un-rendered attribute? |
Yes, but the distance from just doing a |
I think this works well enough! FYI, I have forked |
@cabo is there an inherent timeout somewhere when kramdown-rfc2629 processes its input? I added the required software to the CI run for i-d-template, and am trying to make that build the editors' copies of the draft. This works fine locally and takes a few seconds. It fails when running via GitHUb actions, see for example https://github.com/NTAP/rfc8312bis/runs/1511478161?check_suite_focus=true The first thing to note is that for some reason, GitHub actions is much slower - the run fails after ~17 minutes. Processing of each equation takes 1-2 minutes vs. 1-2 seconds locally. That's not great, but the larger issue is that kramdown-rfc2629 at some points seems to give up on processing the equations, leading to a corrupt XML that then fails to process further. Any ideas? |
Only for bibxml fetches.
I am looking at line 62: ERROR: Unable to parse the XML document: /github/workspace/stdin that looks like an svgcheck failure:
I have no idea why this takes so long, and I have no idea whether that fact is related to the svgcheck failures.
it actually works; no idea why this is called "ERROR" when the job of svgcheck was to fix the SVG requirements. |
I'm patching the toolchain to add more diagnostics. Something else: you should pass |
It may be worth pointing out that kramdown-rfc memoizes svg tool invocations, so whether this runs through in milliseconds locally may not be a useful comparison with processing a fresh docker instance. |
Oh. I already get a ton of
Because the font included by tex2svg (here: STIX) has id values that repeat. OBTW, could that font be a problem? (Is it in the docker image?) |
I install |
Removing |
Hmm, these fonts seem to be installed with mathjax: Asana-Math Gyre-Pagella Gyre-Termes Latin-Modern Neo-Euler STIX-Web TeX (The argument --font STIX is translated to STIX-Web.) (On my system it's under |
Can you save the XML? |
Those fonts are installed in my docker image as well. Regarding the XML, not sure how to make @martinthomson's Makefile retain and save that? |
Do you cache the output of |
Everything in svg_tool_process is memoized. There should be nothing in that cache on a CI system, no? |
In principle, the XML should be preserved by making it .SECONDARY and checking in a version to gh-pages. I'm not a registered pilot in that Makefile jungle, though... |
There shouldn't be anything in the cache, no. And I also tried explicitly clearing it, which didn't help. But the text version at https://ntap.github.io/rfc8312bis/pretty-math/draft-eggert-tcpm-rfc8312bis.txt contains quite a few blocks like
instead of the ASCII math from (And shouldn't it say "Artwork not available as ascii-art"?) |
It looks like you got it working. (BTW, I generally mark .xml as .INTERMEDIATE explicitly. They aren't that useful and I generally don't find having them lying around to be useful. But that's not a firmly held position. It's also a moderately easy patch if you want to propose a switch, though I guess there are a few tangles I'd have to clear out with respect to the pre-commit hook.) |
Apart from the debugging support that would help here, the XML is very useful to have around if you have further processes running from that, e.g.,
|
BTW, just pushed 1.3.18 with v3 dl/dt/dd; this should fix some of the artifacts in 8312bis |
... and of course runs into the contact bug. You'll need a workaround for
until that is fixed, e.g.
|
Added some urgency to the contact bug: |
You can get the XML now from the artifacts of the CI runs, e.g., https://github.com/NTAP/rfc8312bis/actions/runs/410326116 |
By the way, it looks like the missing ascii-art equations are all the ones (and only the ones) that use the α and β unicode characters. I don't quite understand why, given that they render fine locally under Ubuntu and Darwin. |
OK, figure it out and https://ntap.github.io/rfc8312bis/pretty-math/draft-eggert-tcpm-rfc8312bis.txt now has the fancy ASCII-art math for all equations. The problem was that whatever image i-d-template is using for doing the CI building of the editor's copy does not have a UTF-8 capable locale by default. That breaks all kind of stuff. @martinthomson might want to fix that. |
martinthomson/i-d-template#254 I know how to do this, but will need a little time to sort it out. |
When you do this, you might want to update kramdown-rfc2629 as well. |
That part is automatic. |
You do this https://github.com/NTAP/rfc8312bis/blob/pretty-math/Makefile#L16-L17 At least that worked for me. |
@martinthomson would you be open to a PR for i-d-template to add svgcheck, tex2svg, asciitex, etc. to the docker image? Or should we install them manually as needed? |
@cabo that workaround doesn't seem to do anything? |
I wonder if it would be possible to add some sort of support for rendering equations in ASCII and SVG, with asciitex and tex2svg, respectively. They take (more or less) the same input format, and produce reasonable-looking outputs.
For example, this input
renders to the following ASCII
and this SVG
The text was updated successfully, but these errors were encountered: