Sample

This is a sample article which contains example materials, including source code, mathematics, etc.

The author usually writes articles in Markdown (more specifically, a kind of GitHub Flavored Markdown), so the materials may accompany the corresponding markdowns for reference.

Markdown files are converted to HTML using pandoc with githubMarkdownExtensions reader option.

Basic writing

Styling text

**bold**, *italic*, ~~strike through~~

bold, italic, strike through

Blockquotes

Upon crossing the Rubicon, Gaius Julius Caesar said:
> The die is cast.

Upon crossing the Rubicon, Gaius Julius Caesar said:

The die is cast.

Lists

Unordered lists

- Item
- Item
- Item
  • Item
  • Item
  • Item

Ordered lists

1. Item 1
2. Item 2
3. Item 3
  1. Item 1
  2. Item 2
  3. Item 3

Nested lists

- Item
    1.  Nested item 1
    2.  Nested item 2
- Item
    - Nested item
    - Nested item
        - More nested item
  • Item
    1. Nested item 1
    2. Nested item 2
  • Item
    • Nested item
    • Nested item
      • More nested item

Tables

GitHub Flavored Markdown offers syntax to create tables as below.

| Tables   |      Are      |  Cool |
|----------|:-------------:|------:|
| col 1 is |  left-aligned | $1600 |
| col 2 is |    centered   |   $12 |
| col 3 is | right-aligned |    $1 |

Although it is more concise and readable, it cannot specify table classes. So, I have to use <table> tags to specify Bootstrap table classes, unless modify table styles directly.

<table class="table">
  <thead>
    <tr>
      <th>Tables</th>
      <th style="text-align: center">Are</th>
      <th style="text-align: right">Cool</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>col 1 is</td>
      <td align="center">left-aligned</td>
      <td align="right">$1600</td>
    </tr>
    <tr>
      <td>col 2 is</td>
      <td align="center">centered</td>
      <td align="right">$12</td>
    </tr>
    <tr>
      <td>col 3 is</td>
      <td align="center">right-aligned</td>
      <td align="right">$1</td>
    </tr>
  </tbody>
</table>
Tables Are Cool
col 1 is left-aligned $1600
col 2 is centered $12
col 3 is right-aligned $1

Bordered tables

To create bordered tables, just add .table-bordered. See Bootstrap documentation for other table styles.

Tables Are Cool
col 1 is left-aligned $1600
col 2 is centered $12
col 3 is right-aligned $1

Source code

GitHub Flavored Markdown supports Fenced Code Blocks, which can specify a class for code blocks shown in the example below. Syntax highlighting is added by highlight.js with github style.

Clojure:

```clojure
(defn hello []
  (println "Hello, world!"))
```
(defn hello []
  (println "Hello, world!"))

Haskell:

```haskell
main :: IO ()
main = putStrLn "Hello, world!"
```
main :: IO ()
main = putStrLn "Hello, world!"

JavaScript:

```javascript
console.log('Hello, world!');
```
console.log('Hello, world!');

Mathematics

Mathematics is beautifully displayed by MathJax engine, which supports TeX/LaTeX, MathML, and AsciiMath for syntax.

The Lorenz Equations

$$
\begin{aligned}
\dot{x}\ & = \sigma(y-x) \\
\dot{y}\ & = \rho x - y - xz \\
\dot{z}\ & = -\beta z + xy
\end{aligned}
$$

The Cauchy-Schwarz Inequality

$$
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
$$

A Cross Product Formula

$$
\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \\
\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\
\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0
\end{vmatrix}
$$

The probability of getting k heads when flipping n coins is

$$ P(E) = {n \choose k} p^k (1-p)^{ n-k} $$

An Identity of Ramanujan

$$
\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} =
1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}}
{1+\frac{e^{-8\pi}} {1+\ldots} } } }
$$

A Rogers-Ramanujan Identity

$$
1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =
\prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})},
\quad\quad \text{for $|q|<1$}.
$$

Maxwell’s Equations

$$
\begin{aligned}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t}\ & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}}\ & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t}\ & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}}\ & = 0
\end{aligned}
$$