From be18c2811159787030c2ef32087c9cc66b625246 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sun, 17 Feb 2019 12:38:50 +0100 Subject: [PATCH] DOC: How to define LaTeX macros --- doc/conf.py | 5 ++- doc/markdown-cells.ipynb | 69 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index b6337fd1..ec188d79 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -97,7 +97,10 @@ #} mathjax_config = { - 'TeX': {'equationNumbers': {'autoNumber': 'AMS', 'useLabelIds': True}}, + 'TeX': { + 'equationNumbers': {'autoNumber': 'AMS', 'useLabelIds': True}, + 'extensions': ['newcommand.js', 'begingroup.js'], + }, } # Additional files needed for generating LaTeX/PDF output: diff --git a/doc/markdown-cells.ipynb b/doc/markdown-cells.ipynb index 2d3e9a54..9515add4 100644 --- a/doc/markdown-cells.ipynb +++ b/doc/markdown-cells.ipynb @@ -81,6 +81,69 @@ "```" ] }, + { + "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", + "\n", + "\n", + "\n", + "This makes sure that the definition itself is not visible in HTML output\n", + "(by using `