101 Commits

Author SHA1 Message Date
Max Bruckner
5767f1f912 OperatorNode: Fix bug from wrong use of getIdentifier
1+(1+1) with parenthesis set to 'auto' triggered a bug because
getPrecedence gets the precedence of the content of a node, but
getIdentifier still returns the 'ParenthesisNode' identifier in case of
a ParenthesisNode.
2015-05-07 12:04:53 +02:00
Max Bruckner
60e2b5700a ParenthesisNode: Make use of the parenthesis config option 2015-05-07 10:13:41 +02:00
Max Bruckner
6c2cd7f7b7 Node: add method 'getContent()'
The 'getContent' method returns the next node down the node tree that
isn't a ParenthesisNode.
2015-05-07 10:12:41 +02:00
Max Bruckner
dd0a5e3a68 Parse parentheses into ParenthesisNodes 2015-05-07 10:12:41 +02:00
Max Bruckner
ea04373028 New ParenthesisNode to represent parentheses in the node tree 2015-05-07 10:12:40 +02:00
Max Bruckner
472aba4e35 BlockNode: add whitespaces to the LaTeX output 2015-05-03 22:17:21 +02:00
jos
e348cb70a2 Refactored Range and Index. Reorganized index.js 2015-04-30 20:36:45 +02:00
Max Bruckner
dca94e67b7 Node.toTex: improve 'not implemented' error message to contain the type. 2015-04-29 23:59:31 +02:00
Max Bruckner
250707b668 Convert the isNode function into a boolean property. 2015-04-28 09:56:01 +02:00
Max Bruckner
390a0060b4 Add is<NameOfNode> property to enable type checking across constructors 2015-04-28 09:14:53 +02:00
Max Bruckner
e62ab0dae4 Proper toTex for units and symbols.
Symbols now don't use `\mathrm` anymore by default, but units do.
2015-04-27 11:08:31 +02:00
Max Bruckner
ca4a0bfda4 Change LaTeX output of string function
toTex shouldn't do operations like toString on the node tree
2015-04-27 10:09:42 +02:00
jos
d3d3212633 Refactored all nodes into factory functions (see #342) 2015-04-26 21:25:31 +02:00
Max Bruckner
8ad525b66e util/latex: get rid of many unnecessary curly braces 2015-04-19 11:08:00 +02:00
Max Bruckner
9c606c044f latex.toSymbol: get rid of unnecessary curly braces and wire up units 2015-04-19 09:56:40 +02:00
Max Bruckner
ee4486c3df SymbolNode.toTex: Prevent symbols from breaking operators
If a symbol comes after an operator like '\cdot', there needs to be a
space in between, otherwise the cdot won't get recognized by the LaTeX
parser.
2015-04-19 09:49:10 +02:00
Max Bruckner
1c73dc1262 ConstantNode.toTex: simplify exponential notatian and add test 2015-04-19 09:49:09 +02:00
Max Bruckner
2cd3da416e UpdateNode.toTex: Fix syntax of assignment and fix test 2015-04-19 09:49:09 +02:00
Max Bruckner
55a66aeaaf OperatorNode.toTex: get rid of unnecessary curly braces 2015-04-19 09:49:09 +02:00
Max Bruckner
753a0e7893 IndexNode.toTex: Bugfix: execute toTex on Range Arguments
Also changes the Layout of the LaTeX output of IndexNode.
2015-04-19 09:49:08 +02:00
Max Bruckner
978bc2bc31 FunctionAssignmentNode.toTex: get rid of unnecessary curly braces 2015-04-19 09:49:08 +02:00
Max Bruckner
816b6314a7 AssignmentNode.toTex: get rid of unnecessary curly braces 2015-04-19 02:13:27 +02:00
Max Bruckner
8db07e23ad OperatorNode.toTex: BUGFIX: make clear where the exponent belongs to
Without proper parentheses it's impossible to decide whether an exponent
belongs to the numerator of a fraction or to the entire fraction.

For ConditionalNode, the exponent is hard to see without parentheses.
2015-04-19 02:11:20 +02:00
Max Bruckner
f2bcfed89f LaTeX: no spaces between operands and operators 2015-04-17 14:18:24 +02:00
Max Bruckner
7c1c9c0cef Show less unnecessary parentheses in LaTeX output
OperatorNodes with exponentiation, fractions and conditions use less
parentheses.
2015-04-16 22:31:02 +02:00
Jos de Jong
bc6f63b6c9 Merge pull request #318 from FSMaxB/latex-restructure
Restructure and complete the LaTeX generator.
2015-04-13 09:39:16 +02:00
jos
3150e21c8e Fixed #313: parsed functions did not handle recursive calls correctly 2015-04-09 20:29:51 +02:00
Max Bruckner
dacf9fba46 OperatorNode: bugfix: toTex creates invalid LaTeX
toTex has been creating invalid LaTeX for fractions where the operands
are in parenthesis, see '(1+1)/2' for example
2015-04-05 14:29:15 +02:00
Max Bruckner
0868987cdf util/latex: use ":=" for assignments and '=' 'equal' 2015-04-05 14:29:14 +02:00
Max Bruckner
6b1d09f2cb util/latex: new toSymbol 2015-04-05 14:29:12 +02:00
Max Bruckner
5dcb87aeaa util/latex: Remove unused functions
* toArgs
* addBraces
* dots and curly functions

util/latex.js: Remove Function addBraces

util/latex.js remove dots and curly functions
2015-04-05 14:29:09 +02:00
Max Bruckner
13e35217b7 Latex restructure 2015-04-05 14:25:54 +02:00
Max Bruckner
47f76f35ac Limit custom toTex with multiple callbacks to FunctionNodes
Now only FunctionNode's toTex can be overwritten mit a map of callbacks
2015-03-17 18:14:14 +01:00
Max Bruckner
af763aa996 Fix breaking change (Node.toTex should return an empty string) 2015-03-13 21:23:14 +01:00
Max Bruckner
0fee9173c8 Enable custom toTex functions 2015-03-13 21:23:14 +01:00
Max Bruckner
35ce7f7fb4 Make Node.toTex a wrapper like Node.compile
Node.prototype.toTex is now a wrapper that calls the node's _toTex
2015-03-13 21:23:14 +01:00
Max Bruckner
6a9c2df38c Update FunctionAssignmentNode to better handle parenthesis 2015-03-01 17:10:09 +01:00
Max Bruckner
bb2bfc939c Update AssignmentNode to better handle parenthesis 2015-03-01 17:02:42 +01:00
Max Bruckner
b2d868c2ed Update OperatorNode's toTex to better handle parens
Use the new infrastructure in OperatorNode's toTex
2015-03-01 16:34:09 +01:00
Max Bruckner
b5ce799e9d New generic toString for AssignmentNode 2015-03-01 10:35:04 +01:00
Max Bruckner
1f2f42012c New generic toString for FunctionAssignmentNode 2015-03-01 10:35:04 +01:00
Max Bruckner
b1a438fd7f New generic toString for RangeNode 2015-03-01 10:35:03 +01:00
Max Bruckner
9489fbf9dc New generic toString for ConditionalNode 2015-03-01 10:35:03 +01:00
Max Bruckner
1ac3319656 OperatorNode: validate input 2015-03-01 10:35:03 +01:00
Max Bruckner
0e5a6e5a38 New generic toString for OperatorNode 2015-03-01 10:35:03 +01:00
Max Bruckner
d593e749e9 New function getIdentifier() for Nodes
getIdentifier() returns a String that contains the name of the node and
the function associated with it ( in case of FunctionNode and
OperatorNode ).
2015-03-01 10:35:03 +01:00
Max Bruckner
e587f0ce00 New tests for Operator mode
* Factorial of Operator node
* Test unaryMinus with sums and differences
* Test OperatorNode that substracts an OperatorNode
2015-02-14 16:31:05 +01:00
jos
3d84b47658 Fixed #258: missing parentheses in the toTex representation of function permutations. 2015-01-03 10:29:55 +01:00
jos
309bf3938d Added proper error messages to Node.map 2014-11-15 13:32:02 +01:00
jos
9257ec3c33 Added unit tests for Node.map and Node.forEach 2014-11-15 13:16:32 +01:00