Skip to content

Call toTex on expression arg of derivative if it is a node#2564

Merged
josdejong merged 1 commit into
josdejong:developfrom
goodproblems:bug/fix-derivative-to-tex
May 20, 2022
Merged

Call toTex on expression arg of derivative if it is a node#2564
josdejong merged 1 commit into
josdejong:developfrom
goodproblems:bug/fix-derivative-to-tex

Conversation

@mattvague
Copy link
Copy Markdown
Contributor

@mattvague mattvague commented May 20, 2022

The Problem

Not sure if there's a good reason for this, but currently the expression argument of derivative(expr,x) is not TeX-ified when calling toTex() on the derivative node. This is a bit suprising since other functions seems to do this.

Compare the behaviour of derivative(expr, var) to add(x, y):

image

Looks like we're just calling toString() when the expression is a Node: https://github.com/josdejong/mathjs/blob/develop/src/function/algebra/derivative.js#L132

The solution

This PR simply calls toTex on the expression arg if it's a Node

@mattvague mattvague force-pushed the bug/fix-derivative-to-tex branch from 2117a4d to b775b8e Compare May 20, 2022 03:40
@mattvague mattvague force-pushed the bug/fix-derivative-to-tex branch from b775b8e to 41f1152 Compare May 20, 2022 03:47
@josdejong
Copy link
Copy Markdown
Owner

Ah, that makes sense, should indeed be toTex() there I think. Thanks for the fix.

@josdejong josdejong merged commit 0b0c16c into josdejong:develop May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants