# SVG-output does not style merror #387

Closed
opened this issue Feb 8, 2013 · 8 comments

Projects
None yet
3 participants
Member

### pkra commented Feb 8, 2013

 merror is not styled in SVG-output.  A / 0 [/itex] 
Contributor

### fred-wang commented Feb 11, 2013

 Reading the source, it seems that we only style mtext children of merror elements (there is a FIXME message saying that this should be improved). Actually, we don't even have any toSVG function for merror elements. We can probably do something similar to the HTML-CSS output, i.e make toSVG generate a (or ) with an merror class. Then in jax/output/SVG/config.js, style this merror class with stroke colors etc However, style inheritance in the SVG output may be a bit different..
Member

### dpvc commented Feb 11, 2013

 The merror inherhits the toSVG method from the mbase class. So it does have one, it just hasn't had to override it.
Contributor

### fred-wang commented Feb 11, 2013

 Yes, I meant we don't override the defaut toSVG, so we don't do anything specific for merror, except the special case for mtext.
Member

### dpvc commented Feb 11, 2013

 As I remember, the problem was adding the border and background color, since that required an additional SVG element (as Fred suggests). I'm not sure the desired effect can be handled completely through CSS, as the rectangle used for the border and background would need its size to depend on the contents, and I don't think you can manage that through pure CSS. (SVG doesn't have anything that corresponds to padding, for example). So that's why I had to hard-code the styling for the merror's mtext, but perhaps it could be done in the merror directly instead.
Contributor

### fred-wang commented Feb 12, 2013

 Perhaps the thing to do would be to make the merror.toSVG create a SVG rectangle with border and background and determine the rectangle size from its content. However, we still have the problem that the text color might not be set easily via CSS inheritance only. Moreover, that seems even more complicated if we want to do as suggested by the FIXME comment i.e. make the merror entirely stylisable in the config file.
Member

### dpvc commented Feb 12, 2013

 Yes, doing the rectangle in merror was what I had in mind (and taking it out of mtext). You could get the border color and size, and background color, via CSS, but I don't see how to do padding that way (without using something like getComputedStyle). The text color can be done via CSS for stroke and fill (but see below). The HTML-CSS output jax mirrors the MathML structure in its span structure, and uses class names to allow styling. But this adds a lot of complexity to the DOM, and that turned out to slow down the math processing. So the SVG jax (by default) reduces its tree structure as much as it can. That means it doesn't retain the same MathML nesting structure. But there is a configuration parameter (addMMLclasses) that will cause the SVG output to keep the MathML structure and add classes like the HTML-CSS output, so that you can style it. That should allow you to style the merror class if you want.

Closed

### dpvc pushed a commit to dpvc/MathJax that referenced this issue Mar 16, 2014

 Move styling from mtext to merror, and allow the styles to be specifi… 
…ed in the configuration. Resolves mathjax#387.
 8b4176f 

### dpvc pushed a commit that referenced this issue Mar 18, 2014

 Merge remote-tracking branch 'dpvc/issue387' into develop. Issue #387. 
 6ed8a76 

Member

### dpvc commented Mar 18, 2014

 => Merged.

### dpvc pushed a commit to mathjax/MathJax-test that referenced this issue Apr 21, 2014

 Add test for issue mathjax/MathJax#387. 
 e486bff 
Member

### dpvc commented Apr 21, 2014

 => In Test Suite. MathMLToDisplay/Presentation/GeneralLayout/merror/issue387.html