-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
SVG output #375
Comments
@jbaayen: I'm developing SVG graphs, and the approach I'm using when including formulas is to overlay the SVG with HTML elements. There are some examples on this page: http://www.intmath.com/exponential-logarithmic-functions/calculating-e.php It suits my purposes. |
@kevinbarabash @mbourne, these sound like steps in the right direction! We're looking at an out-of-browser application though, where SVG is the graphics format. Given an intermediate representation, we may be able to develop the SVG output ourselves. |
I'd just like to add that |
If anyone decides to implement SVG output, it would be nice to do it with |
@pnsaevik: If one were to use |
@gagern Thanks for your comments. It would definitely have to rely on webfonts, just as regular KaTeX. And it would be for the use within browsers, coupled with the KaTeX CSS file. But then, one may argue that CSS is sufficient, and that SVG provides no extra advantage. |
I realize this is probably not currently high on any priority list, but just by way of documenting use-cases: Bokeh just added an SVG output option for plots (a long requested feature). Users can also render KaTeX labels on plots with an extension, but since these are separate DOM elements, they are missing from the SVG export. We use |
@mbourne Are you using foreignObject? how are you referring the position and element in SVG? |
@jpatel3 No, I'm not using foreignObject. For the particular example I linked to above, I'm using a PHP -> SVG library. My text creating function has the following parameters:
where $pt is something like [1, 3] and $str is either plain text (which creates an ordinary SVG element), or if it contains HTML tags or KaTeX, it creates an absolute-positioned div that sits on top of the SVG graph at position [1,3], determined by the pixel count from the left and top of the div containing the SVG element, allowing for the position of origin and any padding, using this.
As the whole thing is being created server-side, any KaTeX sitting on top of the SVG is processed along with the rest of the page on page load. |
Another use case: being able to combine mathematical symbols with text within a |
Additional benefits of outputting to SVG: an SVG can base64-encoded and directly piped into an |
In the Penrose project, we currently use MathJax to render labels for our diagrams. We would love to switch to KaTeX, but we need SVG support to do so. |
Hello, I would like to tird this proposal. I also need SVG output. Right now I'm limited to PNG screen captures of a QWebEnginePage displaying the KaTeX-rendered page. This is not preferable. What's preferable is to preserve the zoomability by keeping things SVG, but I don't know how to grab it! 🥇 |
really need this feature for ouput pdf |
@StarHosea But you can do PDF output of pages containing KaTeX math without SVG. What will SVG give you that HTML doesn't? |
@mbourne We generate PDF in node server by tools like |
@StarHosea, I hacked my way using MathJax to render SVG files in https://github.com/HKGx/rendertex/tree/main/src/services |
@HKGx Thanks a lot , I used import mjApi from 'mathjax-node';
mjApi.start();
const formula = 'k = \frac{2\pi}{\lambda}';
const result = await mjApi.typeset({
math: formula,
format: 'TeX',
svg: true
}); |
How did you hax it, and can you hax it for KaTeX?
…On Fri, Mar 24, 2023 at 7:28 PM StarHosea ***@***.***> wrote:
@HKGx <https://github.com/HKGx> Thanks a lot , I used mathjax-node like
this
import mjApi from 'mathjax-node';mjApi.start();const formula = 'k = \frac{2\pi}{\lambda}';const result = await mjApi.typeset({
math: formula,
format: 'TeX',
svg: true
});
—
Reply to this email directly, view it on GitHub
<#375 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMIF55D5BN5AYYUHVV7OYLW5ZJ6DANCNFSM4BTFENHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Is there any solutions? I used katex with d3js to create an SVG. but when I export it... none of maths shows in exported svg. so I need to render the input as SVG in foreignObject |
SVG output, as offered by MathJax, would be great to have. Applications include formulas in diagrams, for example.
The text was updated successfully, but these errors were encountered: