5

I would like to include the equations as the same as belows:

enter image description here

However, my code got me something very ugly:

\begin{equation}
Forecast Equation: \hat{y}_{t+1|t} = l_t
\end{equation}
\begin{equation}
Smoothing Equation: l_t = \alpha y_t + (1-\alpha) l_{t-1},
\end{equation}

enter image description here

Does anyone can help me with this?

I would like to only give a number to an equation if I will refer to it later, then how to delete the number after the equation if I do not need it now?

The final question, how to align my equation to right, rather than centralise them?

Werner
  • 603,163
Jeannie
  • 323
  • Also, you might try \mathcal l, instead of just "L". This may result in a fancy script "L" as you posted. – Charles Aug 27 '16 at 16:39

1 Answers1

6

One way to achieve this with variable spacing between the labels and the equations is to use an alignat environment:

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{alignat}{2}
   \text{Forecast Equation:}& \qquad & \hat{y}_{t+1 \vert t} &= l_t \nonumber \\
  \text{Smoothing Equation:}&        &                   l_t &= \alpha y_t + (1-\alpha) l_{t-1},
\end{alignat}

\end{document}

\nonumber would allow you to remove the numbering as needed (see How do I turn off equation auto numbering). Or, if the entire equation set should be unnumbered, use alignat*.

alignat will put the labels and the equations right next to one another. However, I inserted a \qquad to give a space of 2em between them. You can adjust this to suit your needs using \hspace{<len>}, where you specify <len>.

Werner
  • 603,163
  • Thanks! It works well! So I do not need \begin{equation} for all my equations if I would like to align them to right? – Jeannie Aug 24 '16 at 21:43
  • @Jeannie -- in fact, it is very bad to put one equation right after another. you should instead use one of the multi-line structures provided by amsmath. see the documentation (texdoc amsmath). – barbara beeton Aug 24 '16 at 21:50
  • @barbarabeeton Thanks. Do you mean that I can keep with equation for one-line equation, and use other structure like alignat for multi-line equation? – Jeannie Aug 24 '16 at 22:07
  • 4
    @Jeannie: That's correct. – Werner Aug 24 '16 at 22:12