Google Summer of Code 2021.
This blog describes my work during the Google Summer of Code 2021 with Maxima under INCF Organization. All my codes can be seen on GitHub here.
Package wxmx2texi, is a loadable package in Maxima provides WxMaxima Worksheet to TexInfo conversion functionality. It was developed under the mentorship of Dimiter Prodanov and Robert Dodier as an INCF project during Google Summer of Code 2021 by Aditya Sandeep Wagh of National Institute of Technology Karnataka Surathkal.
Maxima is a system for the manipulation of symbolic and numerical expressions with more than 40-year history. WxMaxima is a widely used user interface for Maxima. Texinfo is a documentation system that uses a single source file to produce both online information and printed output. It is primarily designed for writing software manuals. Moreover, Maxima provides the support for scientists without a strictly technical background (does not require programming skills to use Maxima). The idea behind this project is to convert the wxMaxima worksheet to Texinfo.
The project proposal for Google Summer of Code is available here. wxmx2texi is written in Common Lisp and Maxima.
wxmx2texi can be loaded in a Maxima instance for use, by executing load(wxmx2texi);
- QuickLisp to Load the XML Parser and Zip file Manager.
- Download quicklisp.lisp and save it in maxima.
- Load the file in maxima by executing
load("quicklisp.lisp")
. - Install quicklisp by executing
:lisp (quicklisp-quickstart:install)
- Download this package and save in the maxima directory such that maxima can find this package.
- Load the package by executing the command
load(wxmx2texi)
in maxima. - Pass the location of the wxmx file as an argument to wxmx2texi() function.
- To save the output in the texinfo file, pass second argument as location of the folder to
wxmx2texi()
function.
Example:
In maxima:
(%i1) load (wxmx2texi)$
(%i1) load(wxmx2texi);
To load "plump":
Load 1 ASDF system:
plump
; Loading "plump"
To load "zip":
Load 1 ASDF system:
zip
; Loading "zip"
To load "zip":
Load 1 ASDF system:
zip
; Loading "zip"
Provide the Location of the wxmx and texi folder inside the function wxmx2texi\
(<location>,<location>)
(%o1) /usr/local/share/maxima/5.45.1/share/wxmx2texi.mac
(%i2) wxmx2texi("sample.wxmx","test_folder");
/home/aditya/Desktop/sample_project/sample.wxmx
/home/aditya/Desktop/sample_project/test_folder/
The texi file is saved in :
/home/aditya/Desktop/sample_project/test_folder/tmpGHU3ALSV/sample.texi
(%o2) /home/aditya/Desktop/sample_project/test_folder/tmpGHU3ALSV/sample.texi
Generated Texinfo Output from Tests :
Tag | Significance |
---|---|
"v" | Variable Name |
"mo" | Operator Name |
"t" | Misc Text |
"n" | Number |
"p" | Parenthesis |
"f" | Fraction |
"e" | Superscript |
"i" | Subscript |
"fn" | Function |
"g" | Greek Symbols |
"s" | Special Constant |
"fnm" | Function Name |
"q" | Square Root |
"d" | Diff |
"sm" | Summation |
"in" | Int |
"at" | At |
"a" | Abs |
"cj" | Conjugate |
"ie" | SubSup |
"mmultiscripts" | Mmultiscripts |
"lm" | Lim |
"r" | Row |
"tb" | Table |
"mth" | Mth |
"lbl" | Output Label |
"st" | String |
"hl" | Highlight |
"h" | Hidden Operator |
"ascii" | Char Code; |
"mtd" | Mtd |
-
wxmx2texi/wxmx2texi.mac - contains the function which is used to load the wxmx2texi package.
Introduced in commit [535b3b8]
-
wxmx2texi/wxmx2texi.lisp - contains the working part of the wxmx2texi function. It parses the xml file and convert it to lisp objects and further writes the output to texinfo file.
Introduced in commit [535b3b8]
-
wxmx2texi/parse_token_list.lisp - converts list of tokens from parser to construct Maxima expression.
Introduced in commit [43fa799]
-
wxmx2texi/expressions_from_xml.mac - Contains Rules to convert the maths inside
<output>
tag to maxima expressions.Introduced in commit [43fa799]
-
wxmx2texi/expressions_from_xml.lisp - construct Maxima expressions from XML
<output>
tag.Introduced in commit [43fa799].
-
wxmx2texi/display_output_xml.mac - Converts the maxima expressions to Latex and 2-D Output.
Introduced in commit [43fa799].
The Working of the wxmx2texi package consists of the following steps-
-
The
.wxmx
file is unzipped and its contents are stored in a folder. The folder contain thecontent.xml
file and images. -
The location of the
content.xml
file is passed to$xmlparser
function located inwxmx2texi/wxmx2texi.lisp
and the function parses the xml and stores the content of the xml in lisp objects created as per the structure of the xml. -
The xml file contains multiple cells and each cell has
<input>
and<output>
tag. The contents of the<input>
tag are directly stored in the texi file using the functionprintobject
. -
The contents of the
<output>
tag contains WxMaxima specific MathML and it needs to be converted to Maxima expressions. -
The generated maxima expressions are converted to 2-D ,Latex output which are then stored in the .texi file.
-
Various rules for each XML tag are defined in
wxmx2texi/expressions_from_xml.mac
and the pattern of the xml is matched and then it gets converted to its equivalent maxima tokens.
Maxima, being a vast language, wxmx2texi supports a core subset of its main features. Future work in wxmx2texi would extend it to support a broader base. This work can include:
-
Output XML tag whose rule isn't defined currently can be easily defined in expressions_from_xml.mac by defining a rule in apply1 and creating a xml tag pattern equivalent rule in the file.
-
Further, wxmx2texi can be extended to convert the texi output to pdf, info files by integrating directly with makeinfo.
Name | Aditya Sandeep Wagh |
---|---|
GitHub | adityawagh114 |
adityawagh114 | |
adityawagh114@gmail.com |
My experience in working on this GSoC’21 project with INCF was simply awesome. It was one of the best experiences I’ve ever had. Not only did I get a chance of contributing to such a big real-world project, but also I got to learn a lot throughout the program.
I would really like to thank Robert and Dimiter who always supported me and guided me through the project and helped me a lot in resolving the blockers I faced.
Also, I would like to thank the entire maxima community which has always been so supportive. Be it solving issues, suggesting improvements or even finding issues with the implementation, the maxima community has always been there for help. I would definitely say that it is one of the most active and supportive open source communities, and that I take pride in being its member.
Finally, I would like to thank Google for conducting GSoC and providing this great opportunity for working in such a great open source community on such a big, real-world project.
-
The working environment was completely new to me when I first started and I got to learn a lot during this period of time.
-
A new paradigm of programming with Lisp language was revealed to me as I progressed.
-
Got acquainted with Git, Lisp, Maxima language , MathML, Latex and awesome development tools and softwares.
-
Improved coding practices, debugging and testing.
-
At last but not the least, I got an opportunity to get involved with a really great community of people, and got to be a part of Maxima.
I look forward to contributing and learning more from the organization.
Commit | Description |
---|---|
[0c48992] | Fixed error due to attribute in lbl tag |
[8562554] | Fixed label with attributes error |
[638797c] | Removed multiple occurrences of with-open-file |
[005688d] | Included fractions and variables in matrix |
[a1f0df3] | Included Matrix representation |
[73827d2] | Included multiple inputs in same cell |
[7f1f7f0] | Included abs and conjugate cells. |
[14ce513] | Included Multiple differential equations,strings and square roots. |
[4c19241] | Formatted the Lisp Code |
[afadc67] | Removed files which are no more required. |
[047b4d4] | Added functionality for relative path location. |
[44d77bb] | Fixed unable to create folder error. |
[60ae5f0] | Created temp folder to avoid same folder name |
[892ad92] | Changed the format of texinfo representation. |
[a2de8e5] | Included 2D output |
[99ea664] | Modified version created by merging wxmx2texi and expressions_from_xml |
[818422e] | Integrated .wxmx to .xml converter. |
[b3b9498] | Added the converter .wxmx --> .xml |
[df9d4e4] | Parsed Output of the XML test file. |
[c7586fe] | Implementation of XML parser |
[415167d] | Classes to store the parsed XML data. |
[2141715] | Initial Commit |