|
| 1 | +--- |
| 2 | +title: "Advanced examples" |
| 3 | +mathjax: true |
| 4 | +layout: post |
| 5 | +categories: media |
| 6 | +--- |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## MathJax |
| 12 | + |
| 13 | +You can enable MathJax by setting `mathjax: true` on a page or globally in the `_config.yml`. Some examples: |
| 14 | + |
| 15 | +[Euler's formula](https://en.wikipedia.org/wiki/Euler%27s_formula) relates the complex exponential function to the trigonometric functions. |
| 16 | + |
| 17 | +$$ e^{i\theta}=\cos(\theta)+i\sin(\theta) $$ |
| 18 | + |
| 19 | +The [Euler-Lagrange](https://en.wikipedia.org/wiki/Lagrangian_mechanics) differential equation is the fundamental equation of calculus of variations. |
| 20 | + |
| 21 | +$$ \frac{\mathrm{d}}{\mathrm{d}t} \left ( \frac{\partial L}{\partial \dot{q}} \right ) = \frac{\partial L}{\partial q} $$ |
| 22 | + |
| 23 | +The [Schrödinger equation](https://en.wikipedia.org/wiki/Schr%C3%B6dinger_equation) describes how the quantum state of a quantum system changes with time. |
| 24 | + |
| 25 | +$$ 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) $$ |
| 26 | + |
| 27 | +## Code |
| 28 | + |
| 29 | +Embed code by putting `{{ "{% highlight language " }}%}` `{{ "{% endhighlight " }}%}` blocks around it. Adding the parameter `linenos` will show source lines besides the code. |
| 30 | + |
| 31 | +{% highlight c %} |
| 32 | + |
| 33 | +static void asyncEnabled(Dict* args, void* vAdmin, String* txid, struct Allocator* requestAlloc) |
| 34 | +{ |
| 35 | + struct Admin* admin = Identity_check((struct Admin*) vAdmin); |
| 36 | + int64_t enabled = admin->asyncEnabled; |
| 37 | + Dict d = Dict_CONST(String_CONST("asyncEnabled"), Int_OBJ(enabled), NULL); |
| 38 | + Admin_sendMessage(&d, txid, admin); |
| 39 | +} |
| 40 | + |
| 41 | +{% endhighlight %} |
| 42 | + |
| 43 | +## Gists |
| 44 | + |
| 45 | +With the `jekyll-gist` plugin, which is preinstalled on Github Pages, you can embed gists simply by using the `gist` command: |
| 46 | + |
| 47 | +<script src="https://gist.github.com/5555251.js?file=gist.md"></script> |
| 48 | + |
| 49 | +## Images |
| 50 | + |
| 51 | +Upload an image to the *assets* folder and embed it with `)`. Keep in mind that the path needs to be adjusted if Jekyll is run inside a subfolder. |
| 52 | + |
| 53 | +A wrapper `div` with the class `large` can be used to increase the width of an image or iframe. |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +[Flower](https://unsplash.com/photos/iGrsa9rL11o) by Tj Holowaychuk |
| 58 | + |
| 59 | +## Embedded content |
| 60 | + |
| 61 | +You can also embed a lot of stuff, for example from YouTube, using the `embed.html` include. |
| 62 | + |
| 63 | +{% include embed.html url="https://www.youtube.com/embed/_C0A5zX-iqM" %} |
0 commit comments