Closed astyonax closed 6 years ago
If you have any idea on regular expressions that help I will be happy to add them. Also each type of cell the worksheet supports has a xxxCell.cpp file containing a ToTeX function. If you have ideas on how to improve them I will be very happy. My last tries to reduce the amount of unneeded {} were only partially successful, though.
If you tell me the minimal rules from your page don't break anything I will implement them.
Ok...
wxRegEx bracesAroundSingleLetter(wxT("[^ ]{([a-zA-Z0-9])}"));
bracesAroundSingleLetter.Replace(&retval,"\\1");
works fine. But the following RegEx doesn't compile. What did I do wrong?
wxRegEx bracesAroundSingleCharExponent(wxT("([^}c]){(\\*[^{]*?\^[a-zA-Z0-9])}"));
bracesAroundSingleCharExponent.Replace(&retval,"\\1");
Created a branch named BetterTeX for experimenting with the RegExs.
I started to work on the BetterTeX branch
I found that for complex regular expression, the wxRE_ADVANCED
flag is needed as in
wxRegEx bracesAroundStrBeforeExponent("([^}ct]){([a-zA-Z0-9]*?)}\\^",wxRE_ADVANCED);
bracesAroundStrBeforeExponent.Replace(&retval,"\\1 \\2^");
I'll work on the other regular expressions ASAP.
I can't promise my current set of regular expressions are completely safe, but may be it's possible to make a comprehensive list of tex expressions to use as test?
In the test folder of wxMaxima there is a .wxmx file containing many constructs wxMaxima can generate. Perhaps we can extend that file...
Do you have a Linux or Mac system and experience with git? If yes feel free to checkout or to fork the BetterTeX branch on github so we can run tests on the real program.
Thanks for the information! I saw that file indeed. I was wondering if it's possible to call ToTex programatically from within the notebook ?
I'm on Linux (ubuntu), and I've experience with git. wxmaxima compiles fine with cmake, only problem is that it does not find its resource files automatically (bcs I don't want to install over the OS version, which I use for work). So I load wxmathml.lisp by hand. Any idea how to specify a custom prefix with cmake?
Unless you prefer differently, I'll work on a fork (next weekend).
cmake -DCMAKE_INSTALL_PREFIX=/usr/local
The idea that with git forks actually do something useful still fascinates me...
There is a way to indirectly call ToTeX: The "copy as LaTeX" right-click menu item. Don't know if that is what you want.
Ok. Of course I can use the right click. Well ok. I'll let you know asap my progress with this.
Thus, You can follow the progress in here: https://github.com/astyonax/wxmaxima/tree/BetterTeX I'll make a pull request so that you can review the changes, I didn't finish yet, though.
Closing this issue as BetterTeX has been merged. But will merge any additional improvements as you find them.
Hi, I use wxMaxima regularly, but one behavior I really dislike. I think that the latex generated with the "copy as latex" from the contextual menu is hard to read. The biggest issue being the number of braces "{" and "}".
Since also the output of the maxima's
tex()
function is not much better, some time ago I put together some regular expressions to simplify the tex code I usually get. You can have a a look here https://astyonax.github.io/BetterTex4wxMaxima/, it's my sandbox for this task.I'm wondering whether it's possible (and there is interest) to reach a consensus on a set of regular expressions that wxmaxima may apply when doing the "copy as latex".
best,