3

I have this equation and it's quite big (basically a FDM one) but it aligns with the text and then continues out on the right side to the nothingness. I've tried stuff like \begin{center} and \hspace*{-2.5cm} but to no avail. I want it to use the whole line not just from the left-margin and out to the right.

How do I do it and do I need to install some special package for it?

I use the \[ instead of the displaymath like this

\[
  Equation arrays here
\]

The code

\[
 \left(
   \begin{array}{cccccc}
      -(2\kappa+\frac{hV\rho}{2}) & (\frac{hV\rho}{2}-\kappa) & 0 & \cdots  & 0 \\
      -\kappa & -(2\kappa+\frac{hV\rho}{2}) & (\frac{hV\rho}{2}-\kappa) & 0 & \cdots \\  
      0 & -\kappa & -(2\kappa+\frac{hV\rho}{2}) & (\frac{hV\rho}{2}-\kappa) & 0 & \cdots \\  
      \vdots  & 0  & \ddots & \vdots  \\
      \vdots & \vdots  & \vdots  & -\kappa & -(2\kappa+\frac{hV\rho}{2}) & (\frac{hV\rho}{2}-\kappa) \\  
      0 & \vdots  & \vdots  & 0 & \kappa - \frac{2h\kappa_{v}}{\kappa}(\frac{hv\rho}{2} - \kappa) & -2\kappa \\  
   \end{array} 
 \right)
 \left(
   \begin{array}{c}
      T_{1} \\
      T_{2} \\
      \vdots \\
      T_{n} \\
   \end{array} 
 \right)
 =  
 \left(
   \begin{array}{c}
      Q(0) + \kappa T_{0} \\
      Q(h) \\
      Q(2h) \\
      \vdots \\
      Q((n-1)h) \\
      2\frac{\kappa_{v}}{\kappa_{v}}T_{out} \\
   \end{array} 
 \right)  
\]
Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
Reed Richards
  • 4,178
  • 8
  • 41
  • 55
  • Do the math symbols in the equation - all the way - display correctly, or does the compiler somewhere stop interpreting math and just print your code? Could you show us your entire source, so we can double-check it for typos? – Tomas Aschan Oct 10 '09 at 10:46
  • Also, [The Not So Short Introduction To Latex 2e](http://tobi.oetiker.ch/lshort/lshort.pdf) might be able to help you... – Tomas Aschan Oct 10 '09 at 10:50
  • All the math displays ok but it continues on into infinity. I've understood that you can't do line-breaks in math mode but somehow I thought it adjust to left not just continue on. – Reed Richards Oct 10 '09 at 16:13

4 Answers4

5

The \[ \] delimiters are intended for single-line equations. In basic LaTeX you can use the eqnarray environment to make a multi-line equations, or you can use the multline environment from the amsmath package. The eqnarray environment lets you use \\ for line breaks but if you want the equation to be numbered, you also need to use the \nonumber command on all lines but one to prevent the numbering of all lines. The multline environment is intended for a single equation so it always produces just one equation number too.

EDIT: This isn't what I would do habitually, but since your equation does seem to fit on a single line, here's the code I've used to get whole-line spanning things:

\newenvironment{widefig}[1][1in]{%
  \begin{list}{}{\setlength{\itemindent}{-#1}%
      \setlength{\leftmargin}{0pt}%
      \setlength{\rightmargin}{0pt}}\item
  }{%
  \end{list}
}

Like the environment name suggests, I wrote it for figures that are too wide to fit inside the margins, so this allows controlling the left margin and permits a figure to be centered on the whole line.

How I modified your example was to wrap it inside a \begin{widefig}[1.5in]-\end{widefig} pair, added

\relpenalty=10000
\binoppenalty=10000

after the \begin{widefig} line to prohibit line breaking inside the formula, and changed the \[\] into \(\) because the widefig environment only works for inline, not display. You might also need to fiddle a bit with the amount of space given on the \begin line to make the equation properly centered.

I don't believe this is very good typesetting style, though, so you'll want to be very careful about using it, and preferably try to fit things inside the margins. For instance, in this case you could also get rid of a few columns in your first matrix; the usual standard is to have only the first, second, and last, but you probably also want the second-to-last row and column, since the changes in the values for the last row and column is a bit surprising. If you did that, it might fit (but I didn't check).

JaakkoK
  • 8,247
  • 2
  • 32
  • 50
1

If you really don't want to break the equation over lines and you don't mind breaking the text width, you could try something like: (untested)

\centerline{$\displaystyle <long equation here>$}
Will Robertson
  • 62,540
  • 32
  • 99
  • 117
  • Huh? \documentclass{article} \usepackage{lipsum} \begin{document} \lipsum[1] \centerline{$\displaystyle a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a$} \lipsum[1] \end{document} – Will Robertson Oct 11 '09 at 22:40
0

could you add a line-break using \\ ? Begin centre only aligns things like figures, it won't affect line equations.

You might like to look at the American Mathematical Society guide to their package s ftp://ftp.ams.org/pub/tex/doc/amsmath/amsldoc.pdf

UberAlex
  • 3,477
  • 4
  • 22
  • 22
0

You could use the eqnarray environment to break equations into multiple lines.

Oben Sonne
  • 9,893
  • 2
  • 40
  • 61