Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to code this equation in LaTeX:

equation

I'd like to know how to code the equation and the description below it with a reference as well.

share|improve this question
2  
It would be useful to know what you have up to now. –  egreg Apr 26 '12 at 18:00
1  
I'm pretty new to latex. My main query is how to put the dash above an alphabet, the big dash for division and the description as written here. –  Rohan Apr 26 '12 at 18:06

4 Answers 4

up vote 9 down vote accepted

Even though your question was thoroughly answered here's my solution, it differs only in not using a table but a list:

\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}

\usepackage{enumitem}

\begin{document}

\[ P_{xi}=\overline{U_{x}}+\sigma_{x}\frac{\sum^{Nu}_{k}D_{kx}\times 
    \left( \frac{S_{ki}-\overline{U_{k}}}{\sigma_{k}}\right)}{\sum^{Nu}_{k}D_{kx}} \]
Where:
\begin{itemize}[label=]
    \item $P_{xi}$: is the predicted rate for user $x$ on item $i$
    \item $S_{ki}$: is the rate of song $i$ given by user $k$
    \item $\overline{U_{x}}$: is the average rate of user $x$
    \item $\overline{U_{k}}$: is the average rate of user $k$
    \item $\sigma_{x}$: is the standard deviation of all the rates of user $x$
\end{itemize}

\end{document}

Which produces the following result: Equation and description

share|improve this answer
1  
You can use \item[$P_{xi}$] to set the label as the symbol - this makes sure the items align –  Henrik Hansen Apr 27 '12 at 7:59

Some more flair in managing the "where" clause, and formatting of the conditions:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{array}% http://ctan.org/pkg/array
\begin{document}

\begin{gather}
  P_{xi}=\overline{U}_x+\sigma_x
         \frac{\sum_k^{Nu}D_{kx}\times\left(\frac{S_{ki}-\overline{U}_k}{\sigma_k}\right)}
              {\sum_k^{Nu}D_{kx}},
\intertext{Where:}
  \begin{tabular}{>{$}r<{$}@{\ :\ }l}
    P_{xi} & is the predicted rate for user~$x$ on item~$i$ \\
    S_{ki} & is the rate of song~$i$ given by user~$k$ \\
    D_{kx} & the correlation between user~$x$ and user~$k$ \\
    \overline{U}_x & the average rate over user~$x$ \\
    \overline{U}_k & the average rate over user~$k$ \\
    \sigma_x & is the standard deviation of all the rates of user~$x$
  \end{tabular}\nonumber
\end{gather}

\end{document}​
share|improve this answer
3  
Another option is to use \shortinertext from the mathtools package as that provides tighter vertical spacing. –  Peter Grill Apr 26 '12 at 18:40
    
I did not know you could set which columns were math mode in tabular. That's really cool. –  EricR May 1 '12 at 20:21
    
@EricR: All thanks to the array package using the > and < "directive". :) –  Werner May 1 '12 at 20:23

You can add the line over the variables using \overline. The text below can be done e.g. using a tabular.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{gather}
    P_{xi} = \overline{U_{x}} + \sigma_{x} \frac
    {\sum_k^{Nu} D_{kx} \times \left( \frac {(S_{ki}-\overline{U_k})}{\sigma_k} \right) }
    {\sum_k^{Nu} D_{kx}},
\end{gather}
Where:\\
\hspace*{3em}
\begin{tabular}{rl}
    $P_{xi}$:& is the predicted rate for user $x$ on item $i$. \\
    $S_{ki}$:& is the rate of song $i$ given by user $k$. \\
    ... & ... \\
\end{tabular}

\end{document}

Result

You can change the space between the columns in the tabular by adding @{\hspace{<your space>}} between the r and l column type specifier.

share|improve this answer
1  
I wouldn't overline also the subscript. –  egreg Apr 26 '12 at 19:27
1  
@egreg: Yes, I agree. I had it different at first myself. I tend to replicate requested things as closely as possible. Bad engineering habit ... –  Martin Scharrer Apr 26 '12 at 19:45

If you want to create a numbered equation as in your example, put the math part in an equation environment and add a \label that can be used to reference the equation later (with \ref{}). The LaTeX code of your equation could look like this:

\begin{equation}
  \label{eq:mylabel}
  P_{xi}=\overline{U}_x+\sigma_x
         \frac{\sum_k^{Nu}D_{kx}\times\left(\frac{S_{ki}-\overline{U}_k}{\sigma_k}\right)}
              {\sum_k^{Nu}D_{kx}},
\end{equation}

enter image description here

Of course, you can tweak it to your liking, e.g. put the sum limits above/below the sum (append \limits to the \sum command) or use bigger sum symbols. You should have a look into one of the many LaTeX books available to familiarize yourself with the system.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.