2

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}
Ruben
  • 13,448
Ridhima
  • 51

3 Answers3

2

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

Mico
  • 506,678
2

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.

Mico
  • 506,678
Ruben
  • 13,448
1

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}
Mico
  • 506,678
  • 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 07: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 07:37