# equation numbering and width: fit-content/max-content/min-content #428

Closed
opened this issue Apr 3, 2013 · 9 comments

Projects
None yet
4 participants
Member

### pkra commented Apr 3, 2013

 Via the user group we got [this example http://jsfiddle.net/8Wnxk/36/]. Can we do something about it?
Contributor

### fred-wang commented Apr 3, 2013

 The problem is more general and not specific to Firefox. Basically, the CSS layout algorithm used in browsers relies on min/max intrinsic widths. Some widths are modified by MathJax when it typesets the equations. Since there is no communication with the browser layout rendering, the final rendering may be wrong. This issue prevents MathJax's line breaking algorithm to work correctly in this example: 
$x + x + x + x + x + x + x$

Member

### dpvc commented Apr 4, 2013

 Under certain circumstances (mostly when there is an equation tag), MathJax will make its displayed equations inside a 
with width:100% and will center the equation using absolute positioning within that DIV. This works as long as the container for the 
has an actual width, but if it is "shrinkable" as it is with the Mozilla CSS attributes in the jsFiddle example, and in the 
in Fred's example, the container has no fixed width, and so width:100% can end up being 0 (or the width of whatever other content is in the container). Because of the positioning, the equation's width is essentially 0, and so doesn't cause the container to require any width. One solution would be to set min-width for the 
that has width:100% so that it will have at least the width of the equation and label. I think that would clear up the problem of having the container shrink too much. Fred's line-breaking issue is more complicated, since MathJax tries to find out the width of the containing element in order to know where to do its line breaking. For something like a 
with no other content, that doesn't work well, and the line breaking can get the wrong width to break at. I'm not sure what the best solution is there. Personally, I think displayed equations are inappropriate in such situations (though you could use \displaystyle to get the display layout without the centering and other formatting), but that won't stop people from doing it anyway.

### aleth commented Apr 5, 2013

 Only commenting to subscribe to this thread, as this issue also affects the Instantbird Mathjax add-on (for certain message styles).
Member

### dpvc commented Apr 5, 2013

 FYI, you can use the "Watch thread" menu item at the bottom to subscribe to the thread. No need to actually post.

### dpvc pushed a commit to dpvc/MathJax that referenced this issue Apr 29, 2013

 Add min-width to displayed equations with labels so that they cause t… 
…heir containers to have non-zero width (like when they are in a table cell). Resolves issue mathjax#428.
 d6b6aa8 
Member

### dpvc commented Apr 29, 2013

 The issue428 branch of my fork of MathJax includes a fix for this. It uses min-width to force the width of the math to be its minimum width when the equation is tagged or numbered.
Contributor

### fred-wang commented Apr 29, 2013

 => Ready for release, in testsuite The test will be LaTeXToMathML/issue428.html

### dpvc pushed a commit to dpvc/MathJax that referenced this issue Apr 29, 2013

 Merge branch 'issue428' into develop 
Resolves issue mathjax#428.
 4f28b81 
Member

### dpvc commented Apr 29, 2013

 => Merged
Contributor

### fred-wang commented Apr 30, 2013

 I get a processing error with the following code:    but only when it is merged in the develop branch. HTMLCSS.Em is called with min = stack.bbox.w undefined. Perhaps it's related to issue #364, where the bbox setup is modified.

### dpvc pushed a commit to dpvc/MathJax that referenced this issue Apr 30, 2013

 Fix undefined variable (due to a name change; missed one). Resolves i… 
…ssue mathjax#428.
 23edb8c 
Member

### dpvc commented Apr 30, 2013

 OK, thanks. There was a variable scope issue reported by the packer when I went to make the packed version, and I had to change the name of a variable. Missed one instance. Fixed in the develop branch.

Open