# How can MathJax be used offline? [duplicate]

This question already has an answer here:

I would like to be able to use MathJax offline, so I can develop questions and answers without having to do them online. I would later copy and paste my text.

So, how can I do this?

I have Windows, Mac, Android, and iOS available, although I would prefer Mac.

## marked as duplicate by Grigory M, Dan Rust, Lord_Farin, dfeuer, Martin SleziakNov 3 '13 at 8:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

## migrated from math.stackexchange.comJul 24 '13 at 18:55

This question came from our site for people studying math at any level and professionals in related fields.

• No need to use MathJax (available at mathjax.org). If you do wish to use this, you'll have to write your questions as part of an html file. You can use a TeX package instead. If I recall corectly, "Textures" is a popular mac package. – David Mitra Jul 24 '13 at 18:40
• @DavidMitra: TeXtures pretty much got eclipsed. Now there is the free TeXShop. – Ted Shifrin Jul 24 '13 at 18:48
• – Martin Sleziak Jul 24 '13 at 19:22
• I am trying Qute right now. It generally works. Thanks. – marty cohen Jul 24 '13 at 21:53

## 5 Answers

This does not mimic the markup features provided by Stack Exchange, but if you use this template in a file with a ".html" extension, and replace the body, then drag the file to your browser, you should see the MathJax rendered.

<html>
<head>
<title>MathJax</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({"HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"] },
tex2jax: { inlineMath: [ ["$", "$"], ["\\$","\$/extract_itex]"] ], displayMath: [ ["",""], ["\\[", "\$"] ], processEscapes: true, ignoreClass: "tex2jax_ignore|dno" },
TeX: { noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } } },
messageStyle: "none"
});
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/2.2-latest/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
The definition of the Euler-Mascheroni constant is
$$\gamma=\lim_{n\to\infty}\left(\sum_{k=1}^n\frac1k\right)-\frac1n$$
</body>
</html>


I use this method with the Markup > Preview in BBEdit feature of BBEdit to get live updating.

Caveat: I may have misinterpreted "offline". To use the template above, you need to be online so that you can access the server at cdn.mathjax.org, but you can work on MathJax away from MSE. To use MathJax offline, you can download the local version of MathJax as described here. Otherwise, you can get a standalone LaTeX system, many of which are listed here.

• I tried this and the mathjax was not rendered. – user1527227 Jul 28 '13 at 6:28
• @user1527227: my sample MathJax lacked $$s. It should render now. – robjohn Jul 28 '13 at 7:17 • yup. great job! – user1527227 Jul 28 '13 at 7:46 • I have a collection of math wiki pages mirrored on my hard drive, that I'd like to look at on a vacation, where I have no internet. I notice the math text won't compile. Will downloading the local version of MathJax allow me to view them in Chrome, for example? – Eric Auld Aug 3 '13 at 12:29 • @EricAuld it's unlikely to work w/o modifying MathJax. When a page using MathJax is rendered, the fonts are downloaded from the MathJax CDN. – Jonathan Aug 3 '13 at 16:40 • @EricAuld: as described here, if the fonts are installed locally, you should be okay. – robjohn Aug 3 '13 at 21:50 • Thanks @robjohn . Does it matter that they don't look like normal Math jax? They look like this when I load the mirrored version. i.imgur.com/NeY6Crp.jpg?1 I notice sometimes they're missing dollar signs, etc. – Eric Auld Aug 3 '13 at 23:12 • Is the LaTeX not being rendered? Some environments, such as array, do not need $$ delimiters to work. For example, \begin{bmatrix}1&0\\0&1\end{bmatrix} was entered without s – robjohn Aug 4 '13 at 0:15
• Oh, OK, I guess that's not the problem. Unfortunately it's not rendering...I tried installing the fonts on Windows; also I tried just placing the mathjax folder in the directory where the mirrored pages are. No luck. :( – Eric Auld Aug 6 '13 at 2:34
• @EricAuld: the fonts shouldn't stop MathJax from working; if MathJax cannot find the fonts it wants, it will use image fonts. Things won't look as nice, but they should render. I've not run a local installation, so all I can suggest is to read the sections starting here and following. – robjohn Aug 6 '13 at 10:58

I am using Qute at http://www.inkcode.net/qute.

It works quite well.

I can create a MathJax document, edit it until it looks fine, and then copy and paste the result into math.stackexchange.

Definitely recommended.

Notes on Qute:

I like the split-screen mode.

Qute formats a paragraph at a time.

Click in a paragraph to edit it, double-click to format it.

Click on the "Q" in the upper left corner to get the menu.

To break a line in a paragraph, use shift-enter.

When a mathematician wants to write a document using, well, maths, they use a $\LaTeX$ compiler program package thing. $\LaTeX$ is a markup language for the $\TeX$ typesetting program, much like MathJax. Therefore, everything which goes between the dollar signs in MathJax code works in $\LaTeX$ (as between the dollar signs is simply $\TeX$ code). The stuff outside the dollar signs is different, as Martin Sleziak has pointed out in the comments. So $\LaTeX$ is well-suited to your needs! I am a mac user, and I use $\TeX$Shop.

To use $\LaTeX$, open a new $\TeX$ file using your favourite program (e.g. $\TeX$shop)and write,

\documentclass[12pt,a4paper]{article}

\usepackage{amssymb, amsmath}

\begin{document}
Hello. This is a test. Also, $e^{\pi i}=-1$.
\end{document}


The document class thing tells the complier what to make it look like (12pt writing, etc). the package bit adds some more power to what you can do. For example, amssymb gives you more symbols to play with, while amsmath allows you to have an improved layout. Compiling this file will produce a pdf file which will contain the stuff you wrote between the \begin and \end document bits rendered as maths.

As you can tell from $\TeX$.SE, $\TeX$ is a pretty popular thing...

• Of course, it has to be said that on MSE you use MarkDown, which is not interpreted by LaTeX compiler. Similarly, there are many things that work in LaTeX but will \textbf{not} work here. But the parts using only math (no formatting) should work more-or-less the same. (There are still some differences.) – Martin Sleziak Jul 25 '13 at 10:08
• Thanks, didn't think about that. – user1729 Jul 25 '13 at 10:15

A while back, I wrote a small program that allows me to write MathJax markup offline in a standalone app. If you want to download it, click here. If you don't trust me, I can provide the sources as well (C#)

There's a MathJax plugin for TiddlyWiki. If you read through the comments of this web page there's a modification for offline usage.