Atreyagaurav / litex-mode

LiTeX mode for emacs; A minor mode to convert valid lisp expressions to LaTeX
GNU General Public License v3.0
43 stars 4 forks source link

Adding the function litex-solve-all-steps-align #6

Closed Doxdrum closed 2 years ago

Doxdrum commented 2 years ago

This patch adds the feature of solving the sexp step-by-step using the LaTeX align environment.


Updated: Attaching the right patch file.

solve-align.tar.gz

Atreyagaurav commented 2 years ago

Hi, this file has empty patch file inside, can you make an pull request? That'll be easier for me.

Also, is there a reason you'll need solve with align environment instead of eqnarray environment? Those might do similar thing in my opinion.

Atreyagaurav commented 2 years ago

Also a note:

Since the eqnarray environment and align does basically the same thing.

Have you tried modifying the following variables to make them use the align environment to solve step by step? It should be better than adding a function that does the same thing but with different variables in my opinion (though I guess I already have two of them).

For example something like this in your config.

(setq litex-math-eqnarray-start "\\begin{align}\n")
(setq litex-math-eqnarray-end "\n\\end{align}\n")
(setq litex-math-steps-eqnarray-join-string " & = ")
(setq litex-math-steps-eqnarray-end-string "\\\n")

if you don't use equation array then it should work, if you do want both, you can make an interactive function which has these under let, and calls the solve function like others.

Doxdrum commented 2 years ago

Hi, this file has empty patch file inside, can you make an pull request? That'll be easier for me.

Also, is there a reason you'll need solve with align environment instead of eqnarray environment? Those might do similar thing in my opinion.

Hi!

Firstly, thank you for your contribution... I see a lot of potential from it!

Sorry for the empty patch.... It was actually the first time I create a patch. I've updated the file, now it contains the real deal.

There is a slight difference in formatting when one uses align instead of eqnarray. There are lots of posts on the LaTeX forums about stopping using eqnarray... That's the reason I think should be useful to include the option (without dropping support of the eqnarray environment). Even thou there are more useful LaTeX packages (like breqn) for managing multiline expressions, the advantage of align is that it is included in the amsmath package, which is loaded by default when exporting from org to LaTeX

Atreyagaurav commented 2 years ago

Hi your patch file is not a patch on the latest commit on this repo, it seems you modified something and only made the patch for the last modification. Instead of patch file I'd really appreciate if you just commit those to your fork and make a pull request.

You don't have to send the patch again, as I can just make a new function from the codes in the patch although it can't be applied directly with git.

On that note I looked through the issues with equation arrays, and since the logic seems reasonable I'm ok with deleting equation array and just using align. But for now I'll keep both.

Atreyagaurav commented 2 years ago

Ok, I made the changes and it'll be merged in dev later. I've done some reformatting so I'll also consider those before merge. I noticed that you used single insert instead of my multiple ones, I'll edit those in my refactoring side and merge it later.

Thank you for this.