Giter VIP home page Giter VIP logo

equation-editor-react's Introduction

Equation Editor for React Applications

Version of package

By Douwe den Blanken (v0xnihili)

Demo

To see this package in action, a demo is available here. It is possible to type an equation and see the output in LaTeX underneath the editor in pink.

Usage

When embedding the EquationEditor component into your project, you have four properties you have to set. value and onChange speak for themselves, while autoCommands contains a list of commands for which you only have to type the name of the command with a \ in front of it. The same goes for the autoOperatorNames but then for operators.

import React, { useState } from "react";

import EquationEditor from "equation-editor-react";

const Example = () => {
  const [equation, setEquation] = useState("y=x");

  console.log(equation);

  return (
    <EquationEditor
      value={equation}
      onChange={setEquation}
      autoCommands="pi theta sqrt sum prod alpha beta gamma rho"
      autoOperatorNames="sin cos tan"
    />
  )
};

export default Example;

License

MIT

equation-editor-react's People

Contributors

bobzel avatar dependabot[bot] avatar v0xnihili avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

equation-editor-react's Issues

How to edit output field and update the equation field on real time?

Hi! First I'd like to thank you for this awesome package!

I want to build an interface where user can edit both EquationEditor input and output code. Here you can see, I've added a input field as a code output. But when I put something on the input field, the equation editor field doesn't update ! Is there any way to do it?

Screen Record Gif

here is my code>>

import EquationEditor from 'equation-editor-react'
import { useState } from 'react'
import { Input } from '@chakra-ui/react'

const MathEditor = () => {
  const [equation, setEquation] = useState('\\frac{a}{b}')

  return (
    <>
      <EquationEditor
        value={equation}
        onChange={setEquation}
        autoCommands="omega"
        autoOperatorNames="sin cos tan"
        onEnter={() => window.alert('You pressed enter!')}
      />
        <Input
          variant={'outline'}
          borderRadius={'0px'}
          textAlign={'center'}
          value={equation}
          onChange={(e) => setEquation(e.target.value)}
        />
    </>
  )
}

export default MathEditor

How to evaluate?

Is posible, take the output an then evaluate it with its dependencies as variables?

Support for React 18

Does not work with react 18+ without forcing it.

npm ERR! react@"^18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0" from [email protected]
npm ERR! node_modules/equation-editor-react
npm ERR! equation-editor-react@"^0.0.10" from the root project

How to use ChemArrow accents

I want to use below extension symbols,

Screenshot 2021-10-02 at 8 04 01 AM

Screenshot 2021-10-02 at 8 04 22 AM

Screenshot 2021-10-02 at 8 04 40 AM

Screenshot 2021-10-02 at 8 05 02 AM

I am planning to use this equation editor to one my academic related project which is based React. Can you help me to solve this issue.

Feature for typing Matrices

Hi, first of all thank you so much for making this. Its very useful for inputting mathematical expressions. However, it still doesn't have the feature to input and edit matrices. It would be great if you could implement this feature.

Support for equations

mathquill ,Equations with {are not supported, can you add support for equations? How can this be achieved?

How to send commands to mathquill

Is it possible to send commands to mathquill while still using your library?

I'd like to build out an interface with buttons that can insert certain latex symbols at the current selection. I believe mathquill allows this using executeCommand(-).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.