Skip to content

Commit

Permalink
Reworded customizing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hrushikeshrv committed Jan 26, 2024
1 parent f15b728 commit a8ad746
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
15 changes: 7 additions & 8 deletions docs/customizing.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ To add a symbol to the editor widget that is not already present, you will need
1. The LaTeX representation of the symbol
2. The HTML representation of the symbol (to show in the editor widget)

Once you create an MJXGUI instance, call the `MJXGUI.registerSymbol()` method to add the symbol you want.
Once you create an MJXGUI instance, call the `registerSymbol()` method on the MJXGUI instance to add the symbol you want.

### Example: Adding ∴ to the editor
For example, lets say you want to add the ∴ symbol to the editor widget. In LaTeX, you can use the `\therefore` command to render a ∴ symbol, and the HTML code for it is `&there4`;

`MJXGUI.registerSymbol()` takes 2 required and 2 optional arguments -
`registerSymbol()` takes 2 required and 2 optional arguments -

1. `latexData` - The LaTeX representation of the symbol, in this case `"\therefore"`.
2. `buttonContent` - The HTML representation of the symbol, in this case `"∴"`. This HTML representation can be a simple string, an SVG, some custom HTML, an HTML character code, or LaTeX that can be typeset using MathJax (see argument 4).
Expand All @@ -27,7 +27,6 @@ For example, lets say you want to add the ∴ symbol to the editor widget. In La

```javascript
const mjxgui = new MJXGUI('#mjxgui-button');

mjxgui.successCallback = function () {
// Handle user input here
}
Expand All @@ -42,14 +41,14 @@ Adding a function to the editor widget is a little different from adding a symbo
1. A class that knows how to generate the LaTeX you need for your function
2. An HTML representation of the function (to show in the editor widget)

You will need to create a class that extends from one of MJXGUI's many Component classes, and override the `toLatex()` method of the class. You can find a list of Component classes MJXGUI provides, along with their use cases in the [API documentation](./api/index.md).
You will need to create a class that extends from one of MJXGUI's many Component classes, and override the `toLatex()` method of the class. You can find a list of Component classes MJXGUI provides, along with when to use them in the [API documentation](./api/index.md).

Once you create this class and an MJXGUI instance, call the `MJXGUI.registerFunction()` method to add the function you want.
Once you create this class and an MJXGUI instance, call the `registerFunction()` method on the MJXGUI instance to add the function you want.

### Example: Adding $ sin^2 $ to the editor
For example, let's say we want to add a $ sin^2 $ function to the editor.
### Example: Adding $ sin^2 \framebox $ to the editor
For example, let's say we want to add the $ sin^2 \framebox $ function to the editor.

`MJXGUI.registerFunction()` takes 2 required and 2 optional arguments -
`registerFunction()` takes 2 required and 2 optional arguments -

1. `componentClass` - A class inheriting from one of MJXGUI's many component classes, which knows how to render it's content as LaTeX.
2. `buttonContent` - The HTML representation of the function. This can be a simple string, an SVG, some custom HTML, an HTML character code, or LaTeX that can be typeset using MathJax.
Expand Down
4 changes: 2 additions & 2 deletions docs/examples.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
layout: default
title: Home
title: Examples
nav_order: 5
---

# Examples
1. [Example 1 - Inserting equations](./examples/basic-example.html)
2. [Example 2 - Insert equations and displaying their LaTeX](./examples/insert-equation-and-latex.html)
2. [Example 2 - Inserting equations and displaying their LaTeX](./examples/insert-equation-and-latex.html)
3. [Example 3 - Adding a custom symbol](./examples/add-custom-symbol.html)
4. [Example 4 - Adding a custom function](./examples/add-custom-function.html)
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ MJXGUI is a widget style application meant to give users a graphical interface f

The motivation is to have something like a pop-up widget that would help users build an expression graphically just as they do in Google Docs or Microsoft Word, but then would also convert the same equation into LaTeX so it could be rendered with MathJax later.

This is what the editor widget looks like -

![MJXGUI Editor Window](media/mjxgui-editor.png)

# Features
Expand Down

0 comments on commit a8ad746

Please sign in to comment.