Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs	(revision 7037)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs	(revision 7038)
@@ -58,7 +58,8 @@
         constants.Clear();
         strBuilder.AppendLine("% needs \\usepackage{amsmath}");
-        strBuilder.AppendLine("\\begin{align}");
+        strBuilder.AppendLine("\\begin{align*}");
+        strBuilder.AppendLine("\\nonumber");
         strBuilder.AppendLine(FormatRecursively(symbolicExpressionTree.Root));
-        strBuilder.AppendLine("\\end{align}");
+        strBuilder.AppendLine("\\end{align*}");
         return strBuilder.ToString();
       }
@@ -89,10 +90,10 @@
     private void FormatBegin(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
       if (node.Symbol is Addition) {
-        strBuilder.Append(@" \left( ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is Subtraction) {
         if (node.SubtreeCount == 1) {
-          strBuilder.Append(@"- \left(");
+          strBuilder.Append(@"- ");
         } else {
-          strBuilder.Append(@" \left( ");
+          strBuilder.Append(@"  ");
         }
       } else if (node.Symbol is Multiplication) {
@@ -108,27 +109,27 @@
           strBuilder.Append(@" \cfrac{1}{" + node.SubtreeCount + @"}");
         }
-        strBuilder.Append(@" \left(");
+        strBuilder.Append(@" ");
       } else if (node.Symbol is Logarithm) {
-        strBuilder.Append(@"\log \left(");
+        strBuilder.Append(@"\log ");
       } else if (node.Symbol is Exponential) {
-        strBuilder.Append(@"\exp \left(");
+        strBuilder.Append(@"\exp ");
       } else if (node.Symbol is Sine) {
-        strBuilder.Append(@"\sin \left(");
+        strBuilder.Append(@"\sin ");
       } else if (node.Symbol is Cosine) {
-        strBuilder.Append(@"\cos \left(");
+        strBuilder.Append(@"\cos ");
       } else if (node.Symbol is Tangent) {
-        strBuilder.Append(@"\tan \left(");
+        strBuilder.Append(@"\tan ");
       } else if (node.Symbol is GreaterThan) {
-        strBuilder.Append(@" \left( ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is LessThan) {
-        strBuilder.Append(@" \left( ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is And) {
-        strBuilder.Append(@" \left( \left( ");
+        strBuilder.Append(@"   ");
       } else if (node.Symbol is Or) {
-        strBuilder.Append(@" \left( \left( ");
+        strBuilder.Append(@"   ");
       } else if (node.Symbol is Not) {
-        strBuilder.Append(@" \neg \left( ");
+        strBuilder.Append(@" \neg  ");
       } else if (node.Symbol is IfThenElse) {
-        strBuilder.Append(@"\left( \operatorname{if} \left( 0 < ");
+        strBuilder.Append(@" \operatorname{if}  0 < ");
       } else if (node.Symbol is Constant) {
         strBuilder.Append("c_{" + constants.Count + "} ");
@@ -137,12 +138,19 @@
       } else if (node.Symbol is LaggedVariable) {
         var laggedVarNode = node as LaggedVariableTreeNode;
-        strBuilder.Append("c_{" + constants.Count + "} " + EscapeLatexString(laggedVarNode.VariableName));
+        if (!laggedVarNode.Weight.IsAlmost(1.0)) {
+          strBuilder.Append("c_{" + constants.Count + "} \\cdot ");
+          constants.Add(laggedVarNode.Weight);
+        }
+        strBuilder.Append(EscapeLatexString(laggedVarNode.VariableName));
         strBuilder.Append(LagToString(currentLag + laggedVarNode.Lag));
-        constants.Add(laggedVarNode.Weight);
-      } else if (node.Symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.Variable) {
+
+      } else if (node.Symbol is Variable) {
         var varNode = node as VariableTreeNode;
-        strBuilder.Append("c_{" + constants.Count + "} " + EscapeLatexString(varNode.VariableName));
+        if (!varNode.Weight.IsAlmost((1.0))) {
+          strBuilder.Append("c_{" + constants.Count + "} \\cdot ");
+          constants.Add(varNode.Weight);
+        }
+        strBuilder.Append(EscapeLatexString(varNode.VariableName));
         strBuilder.Append(LagToString(currentLag));
-        constants.Add(varNode.Weight);
       } else if (node.Symbol is ProgramRootSymbol) {
       } else if (node.Symbol is Defun) {
@@ -151,5 +159,5 @@
       } else if (node.Symbol is InvokeFunction) {
         var invokeNode = node as InvokeFunctionTreeNode;
-        strBuilder.Append(invokeNode.Symbol.FunctionName + @" \left( ");
+        strBuilder.Append(invokeNode.Symbol.FunctionName + @"  ");
       } else if (node.Symbol is StartSymbol) {
         strBuilder.Append("Result & = ");
@@ -158,23 +166,23 @@
         strBuilder.Append(" ARG+" + argSym.ArgumentIndex + " ");
       } else if (node.Symbol is Derivative) {
-        strBuilder.Append(@" \cfrac{d \left(");
+        strBuilder.Append(@" \cfrac{d ");
       } else if (node.Symbol is TimeLag) {
         var laggedNode = node as ILaggedTreeNode;
         currentLag += laggedNode.Lag;
       } else if (node.Symbol is Power) {
-        strBuilder.Append(@"\left(");
+        strBuilder.Append(@"");
       } else if (node.Symbol is Root) {
-        strBuilder.Append(@"\left(");
+        strBuilder.Append(@"");
       } else if (node.Symbol is Integral) {
         // actually a new variable for t is needed in all subtrees (TODO)
         var laggedTreeNode = node as ILaggedTreeNode;
-        strBuilder.Append(@"\sum_{t=" + (laggedTreeNode.Lag + currentLag) + @"}^0 \left(");
+        strBuilder.Append(@"\sum_{t=" + (laggedTreeNode.Lag + currentLag) + @"}^0 ");
       } else if (node.Symbol is VariableCondition) {
         var conditionTreeNode = node as VariableConditionTreeNode;
-        string p = @"1 / \left( 1 + \exp \left( - c_{" + constants.Count + "} ";
+        string p = @"1 /  1 + \exp  - c_{" + constants.Count + "} ";
         constants.Add(conditionTreeNode.Slope);
-        p += @" \cdot \left(" + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"} \right) \right) \right)";
+        p += @" \cdot " + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"}   ";
         constants.Add(conditionTreeNode.Threshold);
-        strBuilder.Append(@"\left( " + p + @"\cdot ");
+        strBuilder.Append(@" " + p + @"\cdot ");
       } else {
         throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
@@ -208,11 +216,11 @@
         strBuilder.Append(@" < ");
       } else if (node.Symbol is And) {
-        strBuilder.Append(@" > 0 \right) \land \left(");
+        strBuilder.Append(@" > 0  \land ");
       } else if (node.Symbol is Or) {
-        strBuilder.Append(@" > 0 \right) \lor \left(");
+        strBuilder.Append(@" > 0  \lor ");
       } else if (node.Symbol is Not) {
         throw new InvalidOperationException();
       } else if (node.Symbol is IfThenElse) {
-        strBuilder.Append(@" \right) , \left(");
+        strBuilder.Append(@" , ");
       } else if (node.Symbol is ProgramRootSymbol) {
         strBuilder.Append(@"\\" + Environment.NewLine);
@@ -223,14 +231,14 @@
         strBuilder.Append(@"\\" + Environment.NewLine + " & ");
       } else if (node.Symbol is Power) {
-        strBuilder.Append(@"\right) ^ { \operatorname{round} \left(");
+        strBuilder.Append(@" ^ { \operatorname{round} ");
       } else if (node.Symbol is Root) {
-        strBuilder.Append(@"\right) ^ { \left( \cfrac{1}{ \operatorname{round} \left(");
+        strBuilder.Append(@" ^ {  \cfrac{1}{ \operatorname{round} ");
       } else if (node.Symbol is VariableCondition) {
         var conditionTreeNode = node as VariableConditionTreeNode;
-        string p = @"1 / \left( 1 + \exp \left( - c_{" + constants.Count + "} ";
+        string p = @"1 /  1 + \exp  - c_{" + constants.Count + "} ";
         constants.Add(conditionTreeNode.Slope);
-        p += @" \cdot \left(" + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"} \right) \right) \right)";
+        p += @" \cdot " + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"}   ";
         constants.Add(conditionTreeNode.Threshold);
-        strBuilder.Append(@" + \left( 1 - " + p + @" \right) \cdot ");
+        strBuilder.Append(@" +  1 - " + p + @"  \cdot ");
       } else {
         throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
@@ -240,7 +248,7 @@
     private void FormatEnd(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
       if (node.Symbol is Addition) {
-        strBuilder.Append(@" \right) ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is Subtraction) {
-        strBuilder.Append(@" \right) ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is Multiplication) {
       } else if (node.Symbol is Division) {
@@ -252,30 +260,30 @@
         }
       } else if (node.Symbol is Average) {
-        strBuilder.Append(@" \right)");
+        strBuilder.Append(@" ");
       } else if (node.Symbol is Logarithm) {
-        strBuilder.Append(@" \right) ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is Exponential) {
-        strBuilder.Append(@" \right) ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is Sine) {
-        strBuilder.Append(@" \right) ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is Cosine) {
-        strBuilder.Append(@" \right) ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is Tangent) {
-        strBuilder.Append(@" \right) ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is GreaterThan) {
-        strBuilder.Append(@" \right) ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is LessThan) {
-        strBuilder.Append(@" \right) ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is And) {
-        strBuilder.Append(@" > 0 \right) \right) ");
+        strBuilder.Append(@" > 0   ");
       } else if (node.Symbol is Or) {
-        strBuilder.Append(@" > 0 \right) \right) ");
+        strBuilder.Append(@" > 0   ");
       } else if (node.Symbol is Not) {
-        strBuilder.Append(@" \right) ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is IfThenElse) {
-        strBuilder.Append(@" \right) \right) ");
+        strBuilder.Append(@"   ");
       } else if (node.Symbol is Constant) {
       } else if (node.Symbol is LaggedVariable) {
-      } else if (node.Symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.Variable) {
+      } else if (node.Symbol is Variable) {
       } else if (node.Symbol is ProgramRootSymbol) {
         // output all constant values
@@ -290,19 +298,19 @@
       } else if (node.Symbol is Defun) {
       } else if (node.Symbol is InvokeFunction) {
-        strBuilder.Append(@" \right) ");
+        strBuilder.Append(@"  ");
       } else if (node.Symbol is StartSymbol) {
       } else if (node.Symbol is Argument) {
       } else if (node.Symbol is Derivative) {
-        strBuilder.Append(@" \right) }{dt} ");
+        strBuilder.Append(@"  }{dt} ");
       } else if (node.Symbol is TimeLag) {
         var laggedNode = node as ILaggedTreeNode;
         currentLag -= laggedNode.Lag;
       } else if (node.Symbol is Power) {
-        strBuilder.Append(@"\right) } ");
+        strBuilder.Append(@" } ");
       } else if (node.Symbol is Root) {
-        strBuilder.Append(@"\right) } \right) } ");
+        strBuilder.Append(@" }  } ");
       } else if (node.Symbol is Integral) {
         var laggedTreeNode = node as ILaggedTreeNode;
-        strBuilder.Append(@"\right) ");
+        strBuilder.Append(@" ");
       } else if (node.Symbol is VariableCondition) {
         strBuilder.Append(@"\left) ");
@@ -317,5 +325,5 @@
       } else if (lag > 0) {
         return "(t+" + lag + ")";
-      } else return "(t)";
+      } else return "";
     }
 
