
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
mathjax-angular
Advanced tools
This plugins implements the browser version of Mathjax v3 into Angular
Note:This library was generated with Angular CLI version 12.
This library helps you implement the version 3 of Mathjax into any of your angular web application.
Below are the steps you need to use this library. NPM:
npm install mathjax-angular
Yarn:
yarn add mathjax-angular
Load the module in the @NgModule class of the application. You need
to pass a RootMathjaxConfig instance to the config method to
configure the module.
We provide a premade example with the library itself, You can see the example here, or alternatively run it locally by cloning the repository and running.
To do that first install the requirements:
npm install (or) yarn
Then either run it in production:
npm run dev production (or) yarn dev production
or run it in dev:
npm run dev (or) yarn dev
When importing in the root module, the module should be configured with .forRoot method.
import { NgModule } from '@angular/core';
import { AppComponent } from './src/app/app.component';
/*Import*/
import { MathjaxModule } from 'mathjax-angular';
/*Configuration*/
@NgModule({
declarations: [
AppComponent
],
imports: [
MathJaxModule.forRoot(/*Optional Config*/)
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
You can optionally pass config. for this refer to majax configuration guide
Current configuration defaults to:
{
"config": {
"loader": {
"load": ["output/svg", "[tex]/require", "[tex]/ams"]
},
"tex": {
"inlineMath": [["$", "$"]],
"packages": ["base", "require", "ams"]
},
"svg": { "fontCache": "global" }
},
"src": "https://cdn.jsdelivr.net/npm/mathjax@3.0.0/es5/startup.js"
}
When importing in a child module, the module must be configured to re-use the same module instance as the root module. So simply configure the module with the .forChild method.
import { MathjaxModule } from 'mathjax-angular';
...
imports: [
MathJaxModule.forChild()
]
...
Add the mathjax directive to elements which you want to apply
MathJax typesetting on load.
<div [mathjax]="content"></div>
In your ts component
content = "$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}$"
For more info and help with the mathjax library refer to their site.
FAQs
A quick way to implement Mathjax v3 into your Angular project!
The npm package mathjax-angular receives a total of 724 weekly downloads. As such, mathjax-angular popularity was classified as not popular.
We found that mathjax-angular demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.