Changeset 17434 for branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
- Timestamp:
- 02/11/20 13:36:02 (5 years ago)
- Location:
- branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
r16130 r17434 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2018Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 using System.Linq; 25 25 using System.Text; 26 using HEAL.Attic; 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Core; 28 29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;30 30 31 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 32 32 [Item("LaTeX String Formatter", "Formatter for symbolic expression trees for import into LaTeX documents.")] 33 [Storable Class]33 [StorableType("D7186DFF-1596-4A58-B27D-974DF0D93E4F")] 34 34 public sealed class SymbolicDataAnalysisExpressionLatexFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter { 35 35 private readonly List<KeyValuePair<string, double>> constants; … … 41 41 42 42 [StorableConstructor] 43 private SymbolicDataAnalysisExpressionLatexFormatter( bool deserializing) : base(deserializing) { }43 private SymbolicDataAnalysisExpressionLatexFormatter(StorableConstructorFlag _) : base(_) { } 44 44 private SymbolicDataAnalysisExpressionLatexFormatter(SymbolicDataAnalysisExpressionLatexFormatter original, Cloner cloner) 45 45 : base(original, cloner) { … … 117 117 strBuilder.Append(@" \cfrac{ "); 118 118 } 119 } else if (node.Symbol is Absolute) { 120 strBuilder.Append(@"\operatorname{abs} \left( "); 121 } else if (node.Symbol is AnalyticQuotient) { 122 strBuilder.Append(@" \frac { "); 119 123 } else if (node.Symbol is Average) { 120 124 // skip output of (1/1) if only one subtree … … 131 135 } else if (node.Symbol is SquareRoot) { 132 136 strBuilder.Append(@"\sqrt{"); 137 } else if (node.Symbol is Cube) { 138 strBuilder.Append(@"\left("); 139 } else if (node.Symbol is CubeRoot) { 140 strBuilder.Append(@"\operatorname{cbrt}\left("); 133 141 } else if (node.Symbol is Sine) { 134 142 strBuilder.Append(@"\sin \left( "); … … 137 145 } else if (node.Symbol is Tangent) { 138 146 strBuilder.Append(@"\tan \left( "); 147 } else if (node.Symbol is HyperbolicTangent) { 148 strBuilder.Append(@"\tanh \left( "); 139 149 } else if (node.Symbol is AiryA) { 140 150 strBuilder.Append(@"\operatorname{airy}_a \left( "); … … 287 297 else 288 298 strBuilder.Append(@" }{ \cfrac{ "); 299 } else if (node.Symbol is Absolute) { 300 throw new InvalidOperationException(); 301 } else if (node.Symbol is AnalyticQuotient) { 302 strBuilder.Append(@"}{\sqrt{1 + \left( "); 289 303 } else if (node.Symbol is Average) { 290 304 strBuilder.Append(@" + "); … … 297 311 } else if (node.Symbol is SquareRoot) { 298 312 throw new InvalidOperationException(); 313 } else if (node.Symbol is Cube) { 314 throw new InvalidOperationException(); 315 } else if (node.Symbol is CubeRoot) { 316 throw new InvalidOperationException(); 299 317 } else if (node.Symbol is Sine) { 300 318 throw new InvalidOperationException(); … … 302 320 throw new InvalidOperationException(); 303 321 } else if (node.Symbol is Tangent) { 322 throw new InvalidOperationException(); 323 } else if (node.Symbol is HyperbolicTangent) { 304 324 throw new InvalidOperationException(); 305 325 } else if (node.Symbol is AiryA) { … … 383 403 for (int i = 2; i < node.SubtreeCount; i++) 384 404 strBuilder.Append(" } "); 405 } else if (node.Symbol is Absolute) { 406 strBuilder.Append(@" \right)"); 407 } else if (node.Symbol is AnalyticQuotient) { 408 strBuilder.Append(@" \right)^2}}"); 385 409 } else if (node.Symbol is Average) { 386 410 strBuilder.Append(@" \right) "); … … 393 417 } else if (node.Symbol is SquareRoot) { 394 418 strBuilder.Append(@"}"); 419 } else if (node.Symbol is Cube) { 420 strBuilder.Append(@"\right)^3"); 421 } else if (node.Symbol is CubeRoot) { 422 strBuilder.Append(@"\right)"); 395 423 } else if (node.Symbol is Sine) { 396 424 strBuilder.Append(@" \right) "); … … 398 426 strBuilder.Append(@" \right) "); 399 427 } else if (node.Symbol is Tangent) { 428 strBuilder.Append(@" \right) "); 429 } else if (node.Symbol is HyperbolicTangent) { 400 430 strBuilder.Append(@" \right) "); 401 431 } else if (node.Symbol is AiryA) {
Note: See TracChangeset
for help on using the changeset viewer.