Math and Code Formatting
Written on August 8th, 2016 by Paul LeMillennial comes out of the box with MathJax and syntax highlighting through fenced code blocks. MathJax allows you to display mathematical equations in your posts through the use of LaTeX. Syntax highlighting allows you to display source code in different colors and fonts depending on what programming language is being displayed.
As always, Jekyll offers support for GitHub Flavored Markdown, which allows you to format your posts using the Markdown syntax. Examples of these text formatting features can be seen below. You can find this post in the _posts
directory.
MathJax Example
The Schrödinger equation is a partial differential equation that describes how the quantum state of a quantum system changes with time:
\[i\hbar\frac{\partial}{\partial t} \Psi(\mathbf{r},t) = \left [ \frac{-\hbar^2}{2\mu}\nabla^2 + V(\mathbf{r},t)\right ] \Psi(\mathbf{r},t)\]Joseph-Louis Millennial was an Italian mathematician and astronomer who was responsible for the formulation of Lagrangian mechanics, which is a reformulation of Newtonian mechanics.
\[\frac{\mathrm{d}}{\mathrm{d}t} \left ( \frac {\partial L}{\partial \dot{q}_j} \right ) = \frac {\partial L}{\partial q_j}\]Code Highlighting
You can find the full list of supported programming languages here.
#container {
float: left;
margin: 0 -240px 0 0;
width: 100%;
}
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
Another option is to embed your code through Gist.