diff --git a/doc/markdown-cells.ipynb b/doc/markdown-cells.ipynb
index 2d3e9a54..e1c89c60 100644
--- a/doc/markdown-cells.ipynb
+++ b/doc/markdown-cells.ipynb
@@ -81,6 +81,70 @@
"```"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Defining LaTeX Macros\n",
+ "\n",
+ "LaTeX users will be familiar with defining new macros by using\n",
+ "`\\newcommand` or the more low-level `\\def` command .\n",
+ "\n",
+ "If you want to use that for both HTML and LaTeX output,\n",
+ "you have to take some extra care.\n",
+ "You should make your definitions like this:\n",
+ "\n",
+ "```\n",
+ "
\n",
+ "\n",
+ "\\def\\require#1{}\n",
+ "$\\require{begingroup}\\require{newcommand}$\n",
+ "$\\gdef\\vec#1{\\boldsymbol{#1}}$\n",
+ "$\\gdef\\i{\\mathrm{i}}$\n",
+ "\n",
+ "\\vskip-\\parskip\n",
+ "\\vskip-\\baselineskip\n",
+ "\n",
+ "
\n",
+ "```\n",
+ "\n",
+ "\n",
+ "\n",
+ "\\def\\require#1{}\n",
+ "$\\require{begingroup}\\require{newcommand}$\n",
+ "$\\gdef\\vec#1{\\boldsymbol{#1}}$\n",
+ "$\\gdef\\i{\\mathrm{i}}$\n",
+ "\n",
+ "\\vskip-\\parskip\n",
+ "\\vskip-\\baselineskip\n",
+ "\n",
+ "
\n",
+ "\n",
+ "This makes sure that the definition itself is not visible in HTML output\n",
+ "(by using ``).\n",
+ "In LaTeX output, the definition creates an empty equation in a new paragraph.\n",
+ "To get rid of the additional vertical spacing, `\\vskip` is used.\n",
+ "\n",
+ "Using `\\def` inside math mode is supported in MathJax,\n",
+ "but in LaTeX, it doesn't have any effect on later math expressions.\n",
+ "Using `\\gdef` works in both.\n",
+ "Sadly, `\\gdef` isn't activated by default in MathJax,\n",
+ "so we have to use `\\require` to activate the `newcommand` and `begingroup` extensions.\n",
+ "Since `\\require` is a MathJax feature that's unknown to LaTeX,\n",
+ "we'll have to provide a dummy definition to not confuse LaTeX\n",
+ "\n",
+ "With the above definitions,\n",
+ "you can use your new macro like this:\n",
+ "\n",
+ "```\n",
+ "$2 \\vec{a} + \\vec{b}$\n",
+ "```\n",
+ "\n",
+ "... which looks like this: $2 \\vec{a} + \\vec{b}$.\n",
+ "\n",
+ "You can of course use as many `\\gdef` lines as you want."
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
@@ -100,7 +164,9 @@
"\n",
"```python\n",
"mathjax_config = {\n",
- " 'TeX': {'equationNumbers': {'autoNumber': 'AMS', 'useLabelIds': True}},\n",
+ " 'TeX': {\n",
+ " 'equationNumbers': {'autoNumber': 'AMS', 'useLabelIds': True},\n",
+ " },\n",
"}\n",
"```\n",
"\n",
@@ -491,7 +557,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.7.1"
+ "version": "3.7.3rc1"
}
},
"nbformat": 4,