Mathematical equations directly in Canvas

Here is an example of $T_{n}$

T_nTn

A more complex example: 

E = mc^2E=mc2

If you put in the LaTeX  expression as an in-line equation, such as $E = mc^2$,  into the advanced editor, you get:

 $E = mc^2$$E=mc2$

However, trying to enter in Advanced editing mode:

(t+zxiyx+iytz)=(αβγδ)(t+zxiyx+iytz)(αγβδ).

leads to:

\begin{equation}
\pmatrix{t^{\prime} + z^{\prime} & x^{\prime} - iy^{\prime} \cr x^{\prime} + iy^{\prime} & t^{\prime} - z^{\prime}} =
\pmatrix{\alpha & \beta \cr \gamma & \delta}
\pmatrix{t + z & x - iy \cr x + iy & t - z}
\pmatrix{\alpha^{*} & \gamma^{*} \cr \beta^{*} & \delta^{*} } 
\end{equation}(t+zxiyx+iytz)=(αβγδ)(t+zxiyx+iytz)(αγβδ)

Leaving out the \begin and \end equation leads to:

\pmatrix{t^{\prime} + z^{\prime} & x^{\prime} - iy^{\prime} \cr x^{\prime} + iy^{\prime} & t^{\prime} - z^{\prime}} =
\pmatrix{\alpha & \beta \cr \gamma & \delta}
\pmatrix{t + z & x - iy \cr x + iy & t - z}
\pmatrix{\alpha^{*} & \gamma^{*} \cr \beta^{*} & \delta^{*} }(t+zxiyx+iytz)=(αβγδ)(t+zxiyx+iytz)(αγβδ)

However, one can see that the equation was rendered correctly in the editor - but does not get inserted properly (even when leaving out the trailing period):

equations-rendered-in-editor-20160713-1.png

 Another version of matrices:

\begin{pmatrix}u' \cr v'\end{pmatrix} = \begin{pmatrix}e^{\eta} & 0 \cr 0 & e^{-\eta}\end{pmatrix}
  \begin{pmatrix}u \cr v\end{pmatrix}
(uv)=(eη00eη)(uv)

In this case using the LaTeX:

\begin{pmatrix}u' \cr v'\end{pmatrix} = \begin{pmatrix}e^{\eta} & 0 \cr 0 & e^{-\eta}\end{pmatrix}
  \begin{pmatrix}u \cr v\end{pmatrix}

Hence perhaps I should try:

\begin{pmatrix}t^{\prime} + z^{\prime} & x^{\prime} - iy^{\prime} \cr x^{\prime} + iy^{\prime} & t^{\prime} - z^{\prime}\end{pmatrix} =
\begin{pmatrix}\alpha & \beta \cr \gamma & \delta\end{pmatrix}
\begin{pmatrix}t + z & x - iy \cr x + iy & t - z\end{pmatrix}
\begin{pmatrix}\alpha^{*} & \gamma^{*} \cr \beta^{*} & \delta^{*} \end{pmatrix}

\begin{pmatrix}t^{\prime} + z^{\prime} & x^{\prime} - iy^{\prime} \cr x^{\prime} + iy^{\prime} & t^{\prime} - z^{\prime}\end{pmatrix} =
\begin{pmatrix}\alpha & \beta \cr \gamma & \delta\end{pmatrix}
\begin{pmatrix}t + z & x - iy \cr x + iy & t - z\end{pmatrix}
\begin{pmatrix}\alpha^{*} & \gamma^{*} \cr \beta^{*} & \delta^{*} \end{pmatrix}(t+zxiyx+iytz)=(αβγδ)(t+zxiyx+iytz)(αγβδ)

We can note that the above works correctly, hence one has to use the \begin{pmatrix} \end{pmatrix} formulation rather than \pmatrix{} - i.e., use the AMS formulation, rather than the TeX formulation.

Using MathML one can enter the following via the HTML editor: 

<math xmlns="http://www.w3.org/1998/Math/MathML">
		
         <mrow>
            <msup><mi>a</mi><mn>2</mn></msup>
            <mo>+</mo>
				
            <msup><mi>b</mi><mn>2</mn></msup>
            <mo>=</mo>
				
            <msup><mi>c</mi><mn>2</mn></msup>
         </mrow>
			
      </math>

You get the following equation out -(which is incorrect) as it seems to strip the MathML out! :

a2+b2=c2

Another example

<math xmlns="http://www.w3.org/1998/Math/MathML">
		
         <mrow>			
            <mrow>
				
               <msup>
                  <mi>x</mi>
                  <mn>2</mn>
               </msup>
					
               <mo>+</mo>
					
               <mrow>
                  <mn>4</mn>
                  <mo></mo>
                  <mi>x</mi>
               </mrow>
					
               <mo>+</mo>
               <mn>4</mn>
					
            </mrow>
				
            <mo>=</mo>
            <mn>0</mn>
				 
         </mrow>
      </math>
		

produces:

x2+4⁢x+4=0

As the editor strips out the MathML.

 The pages seems to use MathJax Links to an external site. to render the mathematical equations on the page.

Since the page is using MathJax, can one just put equations in directly without the editor?   Such as When $a \ne 0$, there are two solutions to ax2+bx+c=0 and they are x=b±b24ac2a.

(The idea to try this came from https://eastsideprep.instructure.com/courses/1054508/pages/javascript-injecting-mathjax?module_item_id=7579448 . Which discusses injecting MathJAX into a Canvas page.)

Interestingly one can put the text of the above without the $s and putting the text into \text{xxxx} in the advanced LaTeX Math editor and get:

\text{When } a \ne 0 \text{, there are two solutions to } (ax^2 + bx + c = 0) \text{ and they are } x = {-b \pm\sqrt{b^2-4ac}\frac{2}{a}}When a0, there are two solutions to (ax2+bx+c=0) and they are x=b±b24ac2a

It is interesting to see that the image (<img class="equation_image" ...> ) that is inserted has as the value of the "alt" attribute the LaTeX:

alt="\text{When } a \ne 0 \text{, there are two solutions to } (ax^2 + bx + c = 0) \text{ and they are } x = {-b \pm\sqrt{b^2-4ac}\frac{2}{a}}"

also this is the value of the "title" attributes

title="\text{When } a \ne 0 \text{, there are two solutions to } (ax^2 + bx + c = 0) \text{ and they are } x = {-b \pm\sqrt{b^2-4ac}\frac{2}{a}}"

Put in an equation, but without an image "src" attribute: \begin{pmatrix}t^{\prime} + z^{\prime} & x^{\prime} - iy^{\prime} \cr x^{\prime} + iy^{\prime} & t^{\prime} - z^{\prime}\end{pmatrix} =
\begin{pmatrix}\alpha & \beta \cr \gamma & \delta\end{pmatrix}
\begin{pmatrix}t + z & x - iy \cr x + iy & t - z\end{pmatrix}
\begin{pmatrix}\alpha^{*} & \gamma^{*} \cr \beta^{*} & \delta^{*} \end{pmatrix}

Now visit this equation with the editor - selected the whole text and then copy to the clipboard: \begin{pmatrix}t^{\prime} + z^{\prime} & x^{\prime} - iy^{\prime} \cr x^{\prime} + iy^{\prime} & t^{\prime} - z^{\prime}\end{pmatrix} =
\begin{pmatrix}\alpha & \beta \cr \gamma & \delta\end{pmatrix}
\begin{pmatrix}t + z & x - iy \cr x + iy & t - z\end{pmatrix}
\begin{pmatrix}\alpha^{*} & \gamma^{*} \cr \beta^{*} & \delta^{*} \end{pmatrix}(t+zxiyx+iytz)=(αβγδ)(t+zxiyx+iytz)(αγβδ)

Put in an equation, but without an image "src" or "alt" attribute:

This did not produce anything.

Put in an equation, but without an image "src" or "title" attribute:

\begin{pmatrix}t^{\prime} + z^{\prime} & x^{\prime} - iy^{\prime} \cr x^{\prime} + iy^{\prime} & t^{\prime} - z^{\prime}\end{pmatrix} =
\begin{pmatrix}\alpha & \beta \cr \gamma & \delta\end{pmatrix}
\begin{pmatrix}t + z & x - iy \cr x + iy & t - z\end{pmatrix}
\begin{pmatrix}\alpha^{*} & \gamma^{*} \cr \beta^{*} & \delta^{*} \end{pmatrix}

\begin{pmatrix}t^{\prime} + z^{\prime} & x^{\prime} - iy^{\prime} \cr x^{\prime} + iy^{\prime} & t^{\prime} - z^{\prime}\end{pmatrix} =
\begin{pmatrix}\alpha & \beta \cr \gamma & \delta\end{pmatrix}
\begin{pmatrix}t + z & x - iy \cr x + iy & t - z\end{pmatrix}
\begin{pmatrix}\alpha^{*} & \gamma^{*} \cr \beta^{*} & \delta^{*} \end{pmatrix}(t+zxiyx+iytz)=(αβγδ)(t+zxiyx+iytz)(αγβδ)