Trusted by 729 journals in 43 countries729 journals · 43 countries
MathJax for OJS: a LaTeX formula and how it is rendered on the page
Free OJS plugin · OJS 3.3, 3.4 and 3.5

If your journal publishes mathematics, statistics, physics or engineering articles, you know this sight: in the title, the abstract and the references, a line of LaTeX full of backslashes and braces sits where a formula should be. MathJax for OJS is a free plugin that renders those formulas properly in the reader’s browser. It does not touch the text the author entered; it only fixes what the reader sees.

Plugin off
An article page with the plugin off: formulas in the title and abstract appear as raw LaTeX text
Plugin on
The same article page with the plugin on: the formulas in the title and abstract are rendered
Freeopen source, GPL v3
OJS 3.3, 3.4, 3.5two packages, same features
No external requestsdefault: your own server
Per-journal settingsyou choose the pages it runs on
Settings in 3 languagesEnglish, Turkish, Spanish

Where are formulas rendered?

On the pages below. The screenshots are all from the same demo article.

Article title and abstract

Inline formulas are rendered within the sentence, display formulas centred on their own line. Fractions, sums, roots and matrices included.

  • Inline: \( ... \)
  • Display: $$ ... $$ or \[ ... \]
  • There is a separate option for titles written with single dollars (below)
Formulas rendered in the title and abstract of an article page: an inline formula, two display formulas and a matrix

References

Formulas in the reference list are rendered too. One writing rule applies here: OJS removes single backslashes when it reads the references field, so in references every backslash is typed twice.

  • In references: \\(\\gamma\\) shows the formula
  • Titles, abstracts and full text are not affected by this rule
  • You can add this sentence to your author guidelines
Formulas rendered in the reference list

The “How to Cite” box

If the article title in the citation box contains a formula, it is rendered as well. When the reader switches citation format (from APA to IEEE, say), the text loaded afterwards is rendered automatically.

The How to Cite box with the article title's formula renderedThe same box after switching citation format: the formula is still rendered

Issue contents, archive and search

Titles with formulas look right not only on the article page but also in the issue’s table of contents, the archive and search results.

An article title with formulas in the issue table of contentsAn article title with formulas in search results

HTML full text

OJS displays the HTML full text as a separate document inside the page; scripts added to the page header cannot reach it. The plugin adds MathJax to the full-text document itself.

  • OJS’s HTML Article Galley plugin must be enabled
  • PDF files are out of scope: maths in a PDF is already typeset in the PDF itself
Formulas rendered on an HTML full-text page: an inline formula, display formulas and a 3 x 3 matrix

Works with your theme too

The screenshots above were taken with OJS’s default theme. The plugin needs nothing theme-specific; alongside is the same article in the Atlas theme.

The same article in the Atlas theme: formulas rendered in the title and abstractThe Atlas theme's citation dialog with the title's formula rendered

The settings form: four sections

In the plugin list it appears as MathJax for OJS. The “Settings” button opens a single form; its four sections follow below in order. Settings are per journal; on a multi-journal installation each journal makes its own choices.

The Enabled areas section of the settings form: six checkboxes

1. Enabled areas

MathJax is loaded only on the pages you select. Unselected pages are left completely untouched: no script, no overhead.

  • Article landing page (abstract) on
    title, abstract, references and citation box
  • HTML galley (full text) pages on
  • Issue table of contents and archive on
  • Search results on
  • Journal homepage and announcements off
  • Editorial backend off
    experimental: renders formulas in editor lists such as submission titles. Nothing is rendered inside rich-text editing boxes, so when an editor saves, the formula’s original LaTeX is what gets stored. If it ever interferes with editorial work, simply turn it off here.
  • When you enable the editorial backend, one more option appears in the form: treat single dollar signs as inline math in the backend on
    independent of the single-dollar setting for the public pages
The MathJax source section of the settings form: the CDN and bundled copy options

2. MathJax source

You choose where MathJax is loaded from.

  • Bundled copy default
    files are served from your own server; no request goes to any other address
  • CDN (jsDelivr, pinned version 3.2.2) optional
    files come from an external network
  • If the bundled copy is selected but its files are missing from the server (an incomplete upload, say), the settings form warns you and MathJax is loaded from the CDN in the meantime; reinstalling the package fixes it
The Formula delimiters section of the settings form: the single-dollar option and its warning

3. Formula delimiters

In mathematics journals, titles are usually written with single dollars: $\mathbb{Z}_n$-symmetric … for example. With this option off, single-dollar notation stays as plain text.

  • Also treat single dollar signs ($ … $) as inline math off
    turn it on if your journal consistently writes inline math with single dollars
  • Once it is on, write real money amounts as \$25; the amount stays as plain text (see the screenshot)
With the single-dollar option on, the formula in the title is rendered and the money amounts in the abstract stay as plain text
The Input formats section of the settings form: TeX always on, MathML and AsciiMath optional

4. Input formats

TeX and LaTeX are always on. You can enable two more formats if you need them; doing so loads a slightly larger MathJax build.

  • TeX / LaTeX always on
  • MathML off
  • AsciiMath off
    formulas are delimited with backticks

How to write formulas

Authors type the formula straight into the title, the abstract or the HTML full text. The plugin only displays it; the stored text stays exactly as entered.

WhatHow to write itNote
Inline formula\(E=mc^2\)always works
Display formula$$\int_0^1 x\,dx$$ or \[ ... \]always works
Inline with single dollars$E=mc^2$when the single-dollar option is on
Money amount\$25write amounts this way when single dollars are on
Formula in references\\(\\gamma\\)backslashes typed twice in the references field

Privacy and security

Visitor data stays on your site

By default, MathJax’s script and fonts are served from the plugin’s own directory, that is, from your server. The plugin makes no request to any other address. This is the setting to prefer for privacy and GDPR, or for intranet installations.

If you choose the CDN, the reader’s browser downloads the files from cdn.jsdelivr.net; as with any third-party hosted script, that service sees the reader’s IP address, browser information and the page address. The plugin sends no data to us, OJS Services, either.

Safe mode

Titles, abstracts and references are entered by authors. That is why MathJax runs in safe mode: links written inside a formula can only be http and https; class, id and style commands are restricted. Ordinary formulas are not affected.

The plugin does not change stored data. When an editor edits and saves a title or an abstract, what is stored is the LaTeX the author wrote.

Limits you should know

  • Single backslashes disappear in references. This is OJS’s own behaviour; if you type \(\gamma\) in a reference, the page shows (gamma). The fix is to type every backslash twice in the references field. The stored text is not changed; titles, abstracts and full text are not affected.
  • Truncated abstracts. Themes that shorten the abstract on issue and search cards can cut a formula in half; the visible fragment is then plain LaTeX.
  • PDF is out of scope. Maths in a PDF file is already typeset in the PDF itself.
  • Plain-text fields. The browser tab title and the metadata tags read by indexes carry the title as the author entered it, LaTeX included. The plugin does not touch them.
  • HTML full text requires OJS’s HTML Article Galley plugin to be enabled.
  • Rendering in the editorial backend is experimental. If it interferes with editorial work, turn it off in the settings; no data is affected.

Compatibility and installation

PackageOJS, tested in fullOJS, checked by the automated regression run onlyPHP (full tests)
OJS 3.3 package3.3.0.223.3.0.16, 3.3.0.20, 3.3.0.217.4, 8.1
OJS 3.4–3.5 package3.4.0.10, 3.5.0.53.4.0.3, 3.5.0.1, 3.5.0.33.4: 8.1, 8.2 · 3.5: 8.2

“Tested in full”: formula rendering was tried page by page (title, abstract, references, citation box, issue and search lists, HTML full text). “Automated regression run”: it verifies that the plugin loads exactly once, with the configured source and delimiters, on article, issue, search and home pages; it does not try formula rendering page by page. Other versions of these release lines have not been tested.

Installation

  1. If another plugin that loads MathJax is installed, disable or remove it first; two plugins would load MathJax twice.
  2. In OJS, go to Website Settings → Plugins → Upload A New Plugin and upload the package that matches your OJS version.
  3. Enable MathJax for OJS in the Generic Plugins list.
  4. Open “Settings” and choose the enabled areas, the source and the delimiters.

If formulas do not appear, clear the OJS caches.

Upgrading from OJS 3.3 to 3.4 or 3.5

The two packages are not interchangeable. After upgrading OJS, delete the old plugin directory (plugins/generic/mathJaxRender) and install the OJS 3.4–3.5 package. OJS 3.5 does not render formulas with the old package; OJS 3.4 loads the old package but it should still be replaced. Then clear the OJS caches. Your settings are kept.

Download

Licence: GPL v3. The bundled copy of MathJax is under the Apache License 2.0.

For journals that publish formulas

MathJax for OJS is free; download the package and install it from the OJS plugins page. For questions and bug reports, open an issue in the repository.

We develop themes and plugins for academic journals and OJS, and provide support services. Whatever you need, get in touch with us.

Categories:

Comments are closed

0
0
Your Cart
Your cart is emptyReturn to Shop