                   #{@contents.renderMathML(x...)}
                 </msqrt>"
 
+  # Drawing node representing an uncertainty.
   class Uncertainty extends DrawingNode
+    
+    # Make a new uncertainty drawing node.
+    #
+    # @param label [String] The label of the variable this uncertainty represents.
+    # @param class [String] Optional. The name that should be set as the class for this node if drawn as MathML or similar.
     constructor: (@label, @class="default") ->
 
+    # How strongly this node is bound.
+    #
+    # @return [Number] Binding strength.
     bindingStrength: ->
       9
 
+    # Draw the node as a LaTeX string.
+    #
+    # @return [String] This node drawn as LaTeX.
     renderLaTeX: ->
       return "\\sigma_{#{@label}}"
 
+    # Draw the node as a string.
+    #
+    # @return [String] This node drawn as a string.
     renderString: ->
       return "σ(#{@label})"
 
+    # Draw the node as MathML.
+    #
+    # @return [String] This node drawn as MathML.
     renderMathML: (x...)->
       dummy = new Variable(@label)
       return "<msub><mo>&sigma;</mo>#{dummy.renderMathML(x...)}</msub>"

      else
        return '<mi class="' + @classname + '">' + label + '</mi>'


  class Fraction extends DrawingNode
    constructor: (@top, @bottom) ->

    bindingStrength: ->
      8

    renderLaTeX: ->
      return "\\frac{#{@top.renderLaTeX()}}{#{@bottom.renderLaTeX()}}"

    renderString: ->
      return "#{@bracketIfNeeded(@top).renderString()}/#{@bracketIfNeeded(@bottom).renderString()}"

    renderMathML: (x,y) ->
      "<mfrac>
      <mrow>#{@top.renderMathML(x,y)}</mrow>

    node.terms = terms
    return node

  # Drawing node representing addition.
  class Add extends DrawingNode

    # Make a new Add drawing node.
    #
    # @param terms... [Array<DrawingNode>] Drawing nodes to add together.
    # @return [Add] A new addition drawing node.
    constructor: (@terms...) ->

    # How strongly bound the node is.
    #
    # @return [Number] Binding strength.
    bindingStrength: ->
      4

    # Draw the node as a LaTeX string.
    #
    # @return [String] This node drawn as LaTeX.
    renderLaTeX: ->
      return @terms.map((x) -> x.renderLaTeX()).join(" + ")

    # Draw the node as a string.
    #
    # @return [String] This node drawn as a string.
    renderString: ->
      return @terms.map((x) -> x.renderString()).join(" + ")

    # Draw the node as a MathML string.
    #
    # @return [String] This node drawn as MathML.
    renderMathML: ->
      return @terms.map((x) -> x.renderMathML())
                   .join("<mo>+</mo>")

  # Drawing node representing multiplication.
  class Mul extends DrawingNode

    # Make a new multiplication drawing node.
    #
    # @param terms... [Array<DrawingNode>] Drawing nodes to multiply together.
    # @return [Mul] A new multiplication drawing mode.
    constructor: (@terms...) ->

    # How strongly this node is bound.
    #
    # @return [Number] Binding strength.
    bindingStrength: ->
      6

    # Draw the node as a LaTeX string.
    #
    # @return [String] This node drawn as LaTeX.
    renderLaTeX: ->
      return @terms.map((x) -> x.renderLaTeX()).join(" \\cdot ")

    # Draw the node as a string.
    #
    # @return [String] This node drawn as a string.
    renderString: ->
      return @terms.map((x) -> x.renderString()).join("*")

    # Draw this node as a MathML string.
    renderMathML: ->
      return @terms.map((x) -> x.renderMathML()).join("<mo>&middot;</mo>")

  # Drawing node representing exponentiation.
  class Pow extends DrawingNode

    # Make a new exponentiation drawing node.
    #
    # @param left [DrawingNode] The base of the power node.
    # @param right [DrawingNode] The exponent of the power node.
    # @return [Pow] A new exponentiation drawing node.
    constructor: (@left, @right) ->

    # Draw the node as a LaTeX string.
    #
    # @return [String] This node drawn as LaTeX.
    renderLaTeX: ->
      "#{@left.renderLaTeX()}^{#{@right.renderLaTeX()}}"

    # Draw the node as a string.
    #
    # @return [String] This node drawn as a string.
    renderString: ->
      "#{@left.renderString()}**#{@bracketIfNeeded(@right).renderString()}"

    # Draw the node as a MathML string.
    #
    # @return [String] This node drawn as MathML.
    renderMathML: ->
      "<msup>#{@left.renderMathML()}#{@right.renderMathML()}</msup>"

  # Drawing node representing bracketing.
  class Bracket extends DrawingNode

    # Make a new bracket drawing node.
    #
    # @param contents [Array<DrawingNode>] Drawing nodes inside the brackets.
    # @return [Bracket] A new bracket node.
    constructor: (@contents) ->

    # How strongly bound this node is.
    #
    # @return [Number] Binding strength.
    bindingStrength: ->
      9

    # Draw the node as a LaTeX string.
    #
    # @return [String] This node drawn as LaTeX.
    renderLaTeX: ->
      return "\\left(#{@contents.renderLaTeX()}\\right)"

    # Draw the node as a string.
    #
    # @return [String] This node drawn as a string.
    renderString: ->
      return "(#{@contents.renderString()})"

    # Draw the node as a MathML string.
    #
    # @return [String] This node drawn as MathML.
    renderMathML: ->
      return "<mfenced><mrow>#{@contents.renderMathML()}</mrow></mfenced>"

  # Drawing node representing a number.
  class Number extends DrawingNode

    # Make a new number drawing node.
    #
    # @param value [Number] The value of the number.
    # @param classname [String] Optional. The name that should be set as the class for this node if drawn as MathML or similar.
    # @return [Number] A new drawing node representing this number.
    constructor: (@value, @classname="constant") ->

    # How strongly this node is bound.
    #
    # @return [Number] Binding strength.
    bindingStrength: ->
      10

    # Draw the node as a LaTeX string.
    #
    # @return [String] This node drawn as LaTeX.
    renderLaTeX: ->
      return @value+""

    # Draw the node as a string.
    #
    # @return [String] This node drawn as a string.
    renderString: ->
      return @value+""

    # Draw the node as MathML.
    #
    # @return [String] This node drawn as MathML.
    renderMathML: ->
      return "<mn class=\"#{@classname}\">#{@value}</mn>"

  # Drawing node representing a variable.
  class Variable extends DrawingNode

    # Make a new variable drawing node.
    #
    # @param label [String] The label of this variable.
    # @param classname [String] Optional. The name that should be set as the class for this node if drawn as MathML or similar.
    # @return [Variable] A new variable drawing node.
    constructor: (@label, @classname="variable") ->

    # How strongly this node is bound.
    #
    # @return [Number] Binding strength.
    bindingStrength: ->
      10

    # Draw the node as a LaTeX string.
    #
    # @return [String] This node drawn as LaTeX.
    renderLaTeX: ->
      # Check for Greek characters.
      mlabel = ""
