0

I have followed the code from this answer, https://tex.stackexchange.com/a/211540/237717. The equations below are to be aligned at '=' signs but the alignment is not properly done. I need some help with my code. Thanks in advance!

\begin{align*}

$< f,g >${\mathcal{H}_K} &= \Sigma{i=1}^n \Sigma_{j=1}^n \alpha_i \alpha_j < K(x, x_i), K(x,x_j)>_{\mathcal{H}_K} \

                                          &amp;=  \Sigma_{i} \Sigma_{j} \alpha_i \alpha_j K(x_i, x_j) \\ 

                                          &amp;= \alpha^T K \alpha

\end{align*}

Current output:

enter image description here

siegfried
  • 103
  • 1
    Unrelated don't use <> here use \langle\rangle they have the proper spacing. <> are relation symbols and thus give the wrong spacing here – daleif Apr 08 '21 at 06:11

1 Answers1

2

Don't use $ $ and blank line in align* environment.

(Edited by @daleif's comment)

\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\langle f,g \rangle_{\mathcal{H}_K} &=  \Sigma_{i=1}^n \Sigma_{j=1}^n \alpha_i \alpha_j  \langle K(x, x_i), K(x,x_j)\rangle_{\mathcal{H}_K} \\
&=  \Sigma_{i} \Sigma_{j} \alpha_i \alpha_j K(x_i, x_j) \\ 
&= \alpha^T K \alpha
\end{align*}
\end{document}

Output:

enter image description here

  • Hi Thanks so much for the answer! It has happened before that if I do not leave a line after the line \begin{align*}, the output is not shown at all. Your code works perfect but I am still curious why the output could be completely missing in align and split environments, unless I break an empty line – siegfried Apr 08 '21 at 06:06
  • 1
    You are not allowed to use the blank line in math environments. A blank line creates an error and the output is not displayed. – Bahman Mirzakhani Apr 08 '21 at 06:15