1

I have started using jqMath for equations on my website and I need to be able to wrap these equations when their outer div has a fixed width.

<div id='math'>$$ x={-b±√{b^2-4ac}}/{2a} \text'A little bit of text that goes along with this.' $$</div>

CSS:

#math {
    width: 100px;
}

At the moment jqMath will just continue the text and equations in a long line, I need to make sure that the 'math' div will be a certain width and there will be no scrolling within it.

Any help would be greatly appreciated.

VividD
  • 10,456
  • 6
  • 64
  • 111
Jordy
  • 17
  • 1
  • 5
  • 1
    For avoiding scrolling you can use `overflow:hidden;` there in your #math css, but I dont think, that width:100px is enough to display your equation with text. – Yograj Gupta Nov 28 '12 at 09:04
  • That does avoid scrolling, but its not line wrapping any of the text within, the biggest problem being everything in '\text', I don't mind if the equation does not quite fit. – Jordy Nov 28 '12 at 09:11

1 Answers1

1

If you want to wrap text, then you can try like this..

<div id="math">
    $$x={-b±√{b^2-4ac}}/{2a}$$ 
    <br />
    $$\text' A little bit of text that goes along with this.'$$
</div>

or simply do this

<div id="math">
    $$x={-b±√{b^2-4ac}}/{2a}$$ 
    <br />
    A little bit of text that goes along with this.
</div>
Yograj Gupta
  • 9,811
  • 3
  • 29
  • 48
  • I like the second suggestion. MathML isn't as mature as HTML in browsers yet, and line breaking inside math is just hard. The moral is to just put true mathematics inside MathML/jqMath, and leave everything else in HTML if possible. – Dave Barton Nov 29 '12 at 06:17
  • So this is a little annoying but probably the easiest solution right now, so I've just wrapped my math in '$$' tags and left the text and HTML, thanks. – Jordy Nov 29 '12 at 20:11