tags:

views:

23

answers:

1

I would like to type some math equation within texts. However, because the equation is too long, it extends into the margin on the right side of the page. Please see the image below: alt text

My Latex code is:

The minimal cost is 1358.3333 calories, which is achieved by the
vector $[x_1, x_2, x_3, x_4, x_5, x_6]=[4.1667, 0.0000, 0.0000,
0.0000, 8.3333, 29.1667]$, where the total fat is $4.17\%$,
saturated fat and cholesterol both $0$, sodium $37.5\%$, total
carbohydrate, calcium and iron all $100\%$ meaning their constraints
active, dietary fiber $341.67\%$, vitamin A $5154.17\%$, vitamin C
$1600\%$.

Anyone has some idea about how to make the extending part of the equation to start at the next line?

Thanks and regards!

+2  A: 

latex isn't clever enough to find suitable places in equations to break lines, and so does not attempt this. you need to break the line manually, or split it yourself. one obvious possibility is

$[x_1, x_2, x_3, x_4, x_5, x_6]$ 
$=[4.1667,   0.0000,  0.0000,  0.0000,    8.3333,   29.1667]$

(line break inserted for clarity, not needed)

it might look better to give the equation it's own line, ie wrap in \begin{equation}

second