Friday, January 11, 2008

Using MiKTeX and LEd

Well, I got MiKTeX (an implementation of LaTeX) installed and LEd as an integrated editor/viewer. It was actually relatively painless. I only had one installation glitch which may have been caused by the fact that I installed LEd before MiKTeX.

I was unable to see my formatted text in the built-in DVI viewer in LEd. I checked the configuration options and fixed the problem by changing the "TeX Distribution" option from MiKTeX 2.4 to MiKTeX 2.6 (even though I'm actually using 2.7). In any case, that was the only problem I had.

Actually understanding how to code formulas in TeX is a different story. I haven't really found a really good tutorial yet, but David Wilkins's Getting Started with LaTeX has some good documentation, including examples.

Here's my first try at creating a somewhat complex formula from class:
I don't like the way the i=1 and n appear next to the sigma instead of above and below it, but I think that's intentional in order to make the formula as compact vertically as possible.

Here's the LaTeX code that's used to create the formula:
\[ covariance (x,y) = \frac {\sum_{i=1}^{n} (x_i-\bar{x})(y_i-\bar{y})}{n-1} \]


Anna Foeglein said...

You can make the "i=1" and "n" appear below and above the Sigma, respectively, by putting it in a \displaystyle{...} container, if it's just a single occurrence that you want changed.

Ben Voigt said...

The vertical space saving is triggered automatically inside fractions, it's usually desirable to keep sums and fractions apart when possible.

Try this:
\[ covariance (x,y) = \frac{1}{n-1} \sum_{i=1}^{n} (x_i-\bar{x})(y_i-\bar{y}) \]