Tuesday, September 25, 2012

Code Syntax Highlighting Test

This is a test of the code syntax highlighter created by Alex Gorbatchev.

Various Hello World Programs

C++ code

#include <iostream>

int main(void)
{
    using namespace std;
    cout << "hello world" << endl;
}

Java code

public class HelloWorld
{
    public static void main(String[] args)
    {
        System.out.println("hello world");
    }
}

Matlab code

% print numbers 1 through 10
for i = 1:10
    printf('%d ', i);
end
printf('\n');

More Advanced Features

Different starting lines

if(a % 3 == 0)
{
    cout << "a is divisible by 0" << endl;
}

MathJax Test

I'm testing out the new MathJax functionality. This allows me to use TeX, LaTeX or MathML to display math equations. To learn more about MathJax, visit their website: www.mathjax.org

Basic tests

Equation \eqref{relations_ex} shows a basic relationship. \[ a \cdot{x} \le 5 \ge b y \label{relations_ex} \] Equation \eqref{frac_ex} shows an example of using fractions. \begin{equation} \frac{a + 2}{a + 1} \label{frac_ex} \end{equation}

Integrals and differentials

Equation \eqref{int_ex} shows an example using integrals. \[ y(t) = \int_{0}^{\infty} \! x \, \mathrm{d}t \label{int_ex} \] Equation \eqref{ode_ex_n} shows an example using differential equations using Newtons dot notation. \[ \ddot{y} - \dot{y} + p y = q \label{ode_ex_n} \] Equation \eqref{pde_ex_l} shows Leibniz's differential notation for a PDE (Wave Equation). \[ \frac{\partial^2 \! u}{\partial t^2} = c^2 \nabla^2 {u} \label{pde_ex_l} \]

Formatting

An in-line equation: \(x = 5\). Equation \eqref{color_ex} shows an example with parts of the equation highlighted red. \[ \require{color} {\color{red}{x}} = 5 \label{color_ex} \]