LaTeX tricks

This entry was posted by on Monday, 18 October, 2010 at

Some notes on LaTeX – No self-respecting scientist can do without it!

Getting a multi-line equation to have correct brackets / parentheses.

This forum entry shows nicely how to hack a multiline equation:

x =& \left( here is some equation \right. \\
& \left. here is the rest \right)

Notice the ‘phantom’ \left and \right by using the period (‘.’). LaTeX nags about unbalanced parentheses or missing ‘)’. Nicer still is to slip it into an eqnarray:

& = & \frac{b_{1,0}}{W(1-p^\star)} \left( 4\rho + \frac{4p(1-\rho)}{W} \frac{ 1 - (1-q^\star)^W}{q^\star} + q^\star(1-\rho) + \right. \\
& & \left. (1-\rho)\left( ( 1-(1-q^\star)^{W-(W-2)}) + (1-(1-q^\star)^{W-(W-3)}) \right) \right)

However, you will notice the last \right) is not the same size as the one it corresponds to (all the way at the beginning, just behind the fraction). To fix this, hard-code it:

& = & \frac{b_{1,0}}{W(1-p^\star)} \Bigg( 4\rho + \frac{4p(1-\rho)}{W} \frac{ 1 - (1-q^\star)^W}{q^\star} + q^\star(1-\rho) + \right. \\
& & \left. (1-\rho)\left( ( 1-(1-q^\star)^{W-(W-2)}) + (1-(1-q^\star)^{W-(W-3)}) \right) \Bigg)

Using \big, \bigg, \Big, or \Bigg followed by the ) you can manually scale the brackets or parentheses. This does introduce some complaints from the compiler, though, as it still nags about unbalanced stuff although the output looks as intended now.

Leave a Reply