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 am new to LaTeX. So, I am stuck with something which should be simple. I need to align this equation so that the last term which goes to the next line begins after the equal to sign, but I can't figure out how to do this? Here is my code:

\begin{center}
\begin{align*}
  log(Y_{it}) = c_i  + year_t + \beta_{1}rcs(MaxT_{it})} + \beta_{2}MinT_{it} +\beta_{3} log(SR_{it}) +\beta_{4}Rain_{it}  + 
                  \beta_{5}Share Irrigated_{it}
\end{align*}
\end{center}
share|improve this question
3  
You forgot the alignment character & while aligning. –  Ruben Nov 20 '13 at 17:54
    
Rubin I don't undertstand could you be specific. Where should the & character be placed? Can you give a example? –  Ridhima Nov 20 '13 at 17:57
1  
the align environment can be understood as a table with 2 columns. Do you know how to handle tables in LaTeX? BTW: Welcome to TeX.SX! –  Ruben Nov 20 '13 at 17:59
    
Yes I do so you have to insert & between consecutive values that go in the 2 columns. So where can I insert & here to get my desired result? I did play around but didn't ahve any luck –  Ridhima Nov 20 '13 at 18:01
3  
Can't you search over here for align and see how it works? Or even better, read the amsmath documentation? –  karlkoeller Nov 20 '13 at 18:01

3 Answers 3

As @karlkoeller stated in his comment, probabilly it would be sufficent to read the AMS documentation. However, if you need help to figure out how the align environment works (which I understand, reading your comments, is the main point), you won't get rejected. And as far as this has not been asked yet:

The align environment (as matrices and tables) aligns content using & to indicate the point at which the lines should be aligned, and \\ declares a line break. In general it is used like

\begin{align*}
  r & = (x+p)(x+q)\\
    & = x^2 + (p+q)x + pq
\end{align*}

(Note: There is no need to use the center environment because align and friends acess display math mode.)

Now, in your specific case you only need to split your equation over several lines instead of aligning it to several equal signs. For this have a look at How to break a long equation? or @PrzemysławScherwents answer, which is summarizing the last mentioned post.

share|improve this answer

Some additional changes are needed to make this equation readable. Because I don't know the nature of elements, \mathrm is only a suggestion. Maybe some of summands should be changed \mathit. Probably rcs is also not r times c times s, hence it should be changed in the suggested way. Note also, that center is meaningless here.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{center}
\begin{align*}
 % log(Y_{it}) = c_i  + year_t + \beta_{1}rcs(MaxT_{it})} + \beta_{2}MinT_{it} +\beta_{3} log(SR_{it}) +\beta_{4}Rain_{it}  + 
\log(Y_{it}) &  =  c_i  + \mathrm{year}_t + \beta_{1}rcs(\mathrm{Max}T_{\mathrm{it}})+ \beta_{2}\mathrm{MinT}_{\mathrm{it}} +\beta_{3} \log(SR_{\mathrm{it}}) +\beta_{4}\mathrm{Rain}_{\mathrm{it}}  + {}\\
       &    \quad {}+       \beta_{5}\mathrm{Share Irrigated}_{\mathrm{it}}
\end{align*}
\end{center}

\end{document}

enter image description here

share|improve this answer
6  
center doesn't really do anything in this case, does it? Displayed math is centered by default anyway. –  Torbjørn T. Nov 20 '13 at 18:57
    
is there a reason that one T is roman and one italic? –  barbara beeton Nov 20 '13 at 19:03
    
@barbarabeeton These are only suggestions, that something should be changed. –  Przemysław Scherwentke Nov 20 '13 at 19:09
    
@TorbjørnT. I forgot adding this remark. Thank you. –  Przemysław Scherwentke Nov 20 '13 at 19:11
1  
I wouldn't put the subscript it stuff in \mathrm at all. –  Mico Nov 20 '13 at 19:17

I recommend you use text-italic rather than math-italic mode for variable names.

The overall equation seems to be a bit too long to fit comfortably on one line. I suggest you insert a line break after \beta_{3} \log(\textit{SR}_{it}).

Note also that nothing (at least nothing good) is achieved by encasing an align* environment in a center environment; hence, just leave off the center-related instructions. Separately, if you type \log rather than simply log, the "operator name" is set in an upright roman font, which is customary style in many math (and statistics, econometrics, etc) settings. (Incidentally, I can't tell what the function/meaning of rcs might be so I've given it a text-italics font for now. I've also assigned a coefficient to the year variable...)

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\log(Y_{it}) 
&= c_i  + \gamma\textit{year}_t 
  + \beta_{1}\textit{rcs}(\textit{MaxT}_{it})
  + \beta_{2}\textit{MinT}_{it} 
  +\beta_{3} \log(\textit{SR}_{it}) \\
&\quad+\beta_{4}\textit{Rain}_{it}  + 
  \beta_{5}\textit{ShareIrrigated}_{it}
\end{align*}
\end{document}
share|improve this answer
    
Thank you all for the responses and help. I have lots to learn and thanks for pointing me to the resources. –  Ridhima Nov 21 '13 at 7:17
    
@Ridhima - good to know you found these answers helpful. Please feel free to upvote and/or accept answers you found particularly useful. –  Mico Nov 21 '13 at 7:37

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.