Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions for local MathJax. #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,42 @@ use_python("/usr/bin/python3", required=T)

2. You may need to configure the path in the `use_python` command.

### Using a local copy of MathJax

[MathJax](https://github.com/mathjax/MathJax) is used to generate images for rendering equations written in `LaTeX`.
It is a `JavaScript` service.
By default, your slides will need a network connection to access it.
Also, you cannot print your slides to `PDF` using `Chrome` or `chromium` from the command line when using `MathJax` in the default way.
(Well, you *can*, but you don't get your nicely-rendered equations.)

So, if you want to show slides without a network and/or export to `PDF`, you need a local `MathJax`:

```sh
git clone https://github.com/mathjax/MathJax mjtemp
mv mjtemp/es5 MathJax
```

You probably also want to add and commit the `MathJax` to your repo:

```sh
git add MathJax
git commit MathJax -m "Added local MathJax"
```

Then, edit the `YAML` front matter to look like this:

```
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts]
self_contained: true
mathjax: MathJax/tex-chtml.js
```

You still need a network connection to *build* your slides, but you can view them when offline.

Advanced options here include:

1. Using `MathJax` as a git submodule.
Doing this will save a lot of space.
2. Reading the `README` at the [MathJax repo](https://github.com/mathjax/MathJax) to learn what files you can delete from `MathJax/` to save space.