开发者

Mathematica-like (LaTeX) typesetting for own CAS application

开发者 https://www.devze.com 2023-04-13 00:20 出处:网络
As I am using Mathematica a lot I got the idea to write a small and free CAS which just exposes a very small subset of necessary functions and packages to be used and I want to present the results in

As I am using Mathematica a lot I got the idea to write a small and free CAS which just exposes a very small subset of necessary functions and packages to be used and I want to present the results in an appropriate way to the user like Mathematica does (ignore the Facebook logo in the background :D ):

Mathematica-like (LaTeX) typesetting for own CAS application

My first idea was to create LaTeX code in the backgroun开发者_运维百科d and to pdflatex the source and include the PDF then in the view... however this seems way to much overkill! I want to write this CAS either in C++ or C# and I want to know if there are any recommended solutions to output nice formula like that.

My first thought was a "real-time formula editing view" but it would be ok to have an input box to enter the commands and formulas and the upper view just to be uneditable output.


A few ways come to my mind.

  1. Use LaTeX behind the scenes to typeset equations, as you say. Again, Cadabra does this.
  2. Use TeXmacs as the front end. Cadabra does this.
  3. Use MathJax. This is a javascript framework which renders TeX equations to images or MathML. It's very easy to use it if you have a HTML view in your UI toolkit. MathJax is used in the sister site MathOverflow, for example.

I find the route 3 is the most attractive.


For calling LaTeX in the background, don't use pdflatex, but use the non-PDF latex to produce a DVI file, and convert it then to PNG with dvipng.

Have a look at the preview package or the standalone class to get the output in the right size (i.e. only the formula, not a whole page).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号