...Processing...
error
big error
Table of contents X
• ### Getting technical: Code snippets and mathematical equations

In this section we will learn how to add mathematical equations and code snippets to our courses or tutorials.

• ## Code snippets

You can include snippets of computer programming code in your courses and tutorials. When added via the course builder, code snippets will automatically get:

• Line numbers;
• Alternating line colors; and
• Syntax highlighting.

To add a code snippet in the course builder:

1. Click the "Add content" link.
2. Select the "Add code snippet" option from the drop-down menu.
3. Add your code snippet. If the textarea is too small, double-click it to open a larger editing window.
4. Optionally, you can provide a title and specify the programming language (only necessary for the more exotic programming languages).
5. The code snippet will appear at the end of the course and can be dragged and dropped into the correct position.

Code snippets can also be embedded in text blocks using Markdown syntax or created inline, for example, print "hello cruel world";.

You can learn more about embedding code snippets using Markdown in our Markdown tutorial.

Example of code snippet embedded using the course builder:

• <?php
echo "Hello world!";
?>
• ## Mathematical equations and formulae

TutnIQ supports the use of LaTeX math macros for creating equations and formulae. MathML should also work, but is not officially supported.

To add a math formula in the course builder:

1. Click the "Add content" link.
2. Select the "Add mathematical formula" option from the drop-down menu.
3. Paste your equation. If the textarea is too small, double-click it to open a larger editing window.
4. Make sure that that you do not forget to enclose your equations with the LaTeX math delimiters: $...$. We do NOT use the dollar sign delimiters often used by LaTeX users.
5. Optionally, you can provide a title.
6. The mathematical equation will appear at the end of the course and can be dragged and dropped into the correct position.

Mathematical equations can also be embedded in text blocks using Markdown syntax. For example, an inline equation: $$\sqrt{3x-1}+(1+x)^2$$.

Example of equation added a via the course builder (Maxwell's equation):

• \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}

• Equation building software can be used to simplify the process of creating an equation in LaTeX format:

« Previous
[Section: 5 of 5]