3
\begin{align}

    y_{t} = {\alpha + \beta_ {1}x_{1t} + \sum_{j=1}^3 (\delta_{j}Q_{jt}+ \varepsilon_{t})}
    \text{where Q_{jt} = 1} \hspace{5}\text{if in quarter} \hspace{5} j, 0 \hspace{5} \text{otherwise}
\end{align}

I am trying to get to this result

3
  • 1
    Welcome to TeX.se. But you haven't actually asked a question. Instead of posting a fragment of code as you have, please put the fragment into a complete compilable document beginning with \documentclass{...} and ending with \end{document}. Do you get an error? What exactly is the problem?
    – Alan Munn
    Commented Nov 25, 2020 at 17:37
  • 1
    as well as a test file it helps if you show the error that you get. But here I guess your error is \hspace{5} the argument needs to be a length. eg \hspace{5pt} Commented Nov 25, 2020 at 17:53
  • It seems that problem is empty line after begin{align. Removing it will solve your main problem.
    – Zarko
    Commented Nov 25, 2020 at 19:39

2 Answers 2

5

The following code does what you want:

\documentclass{article}

\usepackage{amsmath} %maths

\begin{document}
\begin{align}
    y_{t} = \alpha + \beta_{1} x_{1t} + \sum_{j=1}^3 \delta_{j}Q_{jt} + \varepsilon_{t}, \; \text{where $Q_{jt} = 1$ if in quarter $j$, $0$ otherwise} 
\end{align}
\end{document} 
4
  • 1
    Welcome to TeX.SE! Please extend your code fragment to an MWE (Minimal WOrking Example), which OP (and we, others) can test and which will solve OP main problem (see my comment below question).
    – Zarko
    Commented Nov 25, 2020 at 19:41
  • Thanks for the suggestion. I just edited my answer.
    – Marca85
    Commented Nov 25, 2020 at 19:48
  • 2
    +1 now! Happy TeXing!
    – Zarko
    Commented Nov 25, 2020 at 19:49
  • 2
    +1 but allow me a small comment: when an obviously unexperienced user asks for help, besides giving correct code as answer try to explain what s/he did wrong. In this way the OP will learn what was wrong with the code and will (hopefully) avoid analogous errors in the future.
    – campa
    Commented Nov 25, 2020 at 20:36
3

Some suggestions:

  • Don't use an align environment for a single-line equation; instead, use an equation environment.

  • Don't allow all-blank lines in display-math environments.

  • Streamline your code by replacing

    \text{where Q_{jt} = 1} \hspace{5}\text{if in quarter} \hspace{5} j, 0 \hspace{5} \text{otherwise}
    

    with

    \text{where $Q_{jt} = 1$ if in quarter $j$, $0$ otherwise}
    
  • Further streamline your code by omitting the redundant outer pair of curly braces in

    {\alpha + \beta_ {1}x_{1t} + \sum_{j=1}^3 (\delta_{j}Q_{jt}+ \varepsilon_{t})}
    

    and absolutely get rid of the round parentheses in (\delta_{j}Q_{jt}+ \varepsilon_{t}). For sure, the \varepsilon_t term does not belong in the parenthetic expression.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for "\text" macro

\begin{document}
\begin{equation}
  y_{t} = \alpha + \beta_{1}x_{1t} + \sum_{j=1}^3 \delta_{j}Q_{jt}+ \varepsilon_{t}
  \quad\text{where $Q_{jt} = 1$ if in quarter $j$, $0$ otherwise}
\end{equation}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .