1

I'm a freshman in latex and currently is stacked by the long equation. I have the following questions:

  1. Is there a way to number the equations automatically rather than input the equation command every time?

  2. I spent a lot of time in searching for the mistakes of my codes, any hints or advice will be appreciated.

  3. How to write down a sentence after the equation and in the middle of space? For example, what should I do to type comments underneath each equation?

The codes are following:

\begin{equation}
 \begin{split}
   c_t  &=k_e^t+1\frac{1}{q}+k_s^(t+1)+(1-\tau_k^t)(r_ehk_e+r_sk_s)+(1-\tau_l)wl \\
     &\quad +(1-\lambda_e(h))k_e/q+(1-\lambda_s)k_s+T(\lambda)-A_s(k_s',k_s)-A_e(k_e'/q,k_e/q;\eta)
 \end{split}
\end{equation}

Thank you so much for your attention!

Sincerely, EK

  • Your (now very much simplified) code compiles with syntax-related error messages. What specifically are you trying to fix. Are you maybe contemplating changing k_s^(t+1) to either k_s^{(t+1)} or k_s^{t+1}? – Mico Mar 31 '18 at 0:08
1

If you have multiple equations with no self-evident common alignment point, just use the gather environment and use \\ to introduce line breaks.

How to find errors efficiently very much depends on types of errors that may occur. Syntax errors usually generate an error or a warning message. Errors of content may actually be easier to spot. E.g., in equation (6), I think ,\quad is missing ahead of 0<\delta_s<1. And, in the first line of equation (7), I think it should be k_s^{(t+1)} rather than k_s^(t+1). Also in the first line of equation (7), the term 1\frac{1}{q} looks really odd; however, I'm in no position to judge what may be correct. If 1\frac{1}{q} is correct, then so should be \frac{1}{q}.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'gather' and 'split' environments

\begin{document}
\begin{gather}
\beta\theta\frac{1}{c_t}=\Lambda_t\\
\frac{\beta(1-\theta)}{l_t-1}=\Lambda_t\tau_l^t w_t(\lambda)\\
2\phi_s k_s^t+1-2(k_s^t)^2-k_s^t=0\\
2e^\eta\phi_tk_e^t+1-2\kappa_e k_e^t-k_e^tq=0\\
r_e^t=\frac{1}{q(1-\tau_k^t)} bh^\omega-1\\
k_e^t+1=(1-\delta_s)k_s^t+i_s^t,\quad  0<\delta_s<1\\
\begin{split}
c_t &= k_e^t+1\frac{1}{q}+k_s^{(t+1)}+(1-\tau_k^t)(r_ehk_e+r_sk_s)+(1-\tau_l)wl \\
    &\quad+ (1-\lambda_e(h))k_e/q+(1-\lambda_s)k_s+T(\lambda)\\
    &\quad- A_s(k_s',k_s)-A_e(k_e'/q,k_e/q;\eta)
\end{split}
\end{gather}
\end{document}
  • What should I input" and s'=S(\lambda)" as a condition for the long equation? – E.K Mar 31 '18 at 0:09
  • @E.K - The answer probably depends on what kind of condition is in play. Writing ,\quad s'=S(\lambda) at the end of the long equation (right before \end{split}) might work, as could writing s'=S(\lambda) right after \end{gather}. I'm not exactly confident, though, about this recommendation, in no small part because I don't see an S(\lambda) term in that equation. I do see the term T(\lambda), but I have no idea how S(\lambda) and T(\lambda) might be related. – Mico Mar 31 '18 at 0:20
  • Which commands should I use if I want to number the equations in the next subsection? – E.K Mar 31 '18 at 14:43
  • @E.K - I'm afraid I don't understand your follow-up question. In particular, I don't see any connection between the existing equation(s) and subsection-level headers. Please clarify. If it is, de facto, a new query, you should post a new question. – Mico Mar 31 '18 at 19:21
0

Try the align environment to span multiple equations and number each one of them, you can align them using the ampersand symbol as in a tabular enviroment.

The align environment can be used when you load the amsmath package, http://ctan.org/pkg/amsmath.

A very simple example

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

\begin{document} \begin{align} x&=y\ \intertext{therefore} 2x&=2y \end{align} \end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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