2

I'd like to add superscript on summation symbol, but I get an error message:

Please, use `\mathaccent` for accents in math mode. 
I can't use ^ symbol to add superscript.

Here is the code:

\begin{equation}
    y & = \beta_{0}+\sumˆ{2}_{j=1}\beta_{j}X_{j}+\sum\sum_{i<j}\beta_{ij}X_{i}X{j}+\sum_{j=1}\beta_{jj}X_{j}\textsuperscript{2}
    \label{equation1}
\end{equation}
2
  • 2
    Welcome to TeX.SX! It's not at all clear where the superscript is meant to go. Besides, \textsuperscript is not valid in math mode. And the & is out of place.
    – egreg
    Mar 12, 2019 at 0:03
  • You might look at the \sideset command from amsmath. If you have a tex installation based on TeX Live, tyou shoyuld be able to look at this documentation locally via texdoc amsldoc at a command prompt. Mar 12, 2019 at 0:15

1 Answer 1

3

You have a wrong ^ character that is not a ascii character but possibly something with similar appearance and this is what causes the whole problem.

Your code with the correct character is something like:

\documentclass{article}

\begin{document}
\begin{equation}
 y = \beta_{0}+\sum_{j=1}^{2} \beta_{j}X_{j}+\sum\sum_{i<j}\beta_{ij}X_{i}X{j}+\sum_{j=1}^2\beta_{jj}X_{j}^2
    \label{equation1}
\end{equation}
\end{document}

And gives:

enter image description here

PS1: Not sure about the last power and the last upper limit of the sum, but you will see it works if you just delete your bad character and replace with the original keyboard's ^.

PS2: For readability never start a sum by its upper limit, but use first its lower limit instead.

2
  • 1
    Thank you, koleygr. It worked.
    – Luciana
    Mar 13, 2019 at 1:03
  • Weclome.. Happy TeXing!
    – koleygr
    Mar 13, 2019 at 1:53

You must log in to answer this question.

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